summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni/WebViewCore.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-21 12:43:17 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-21 12:43:17 -0700
commit6e7f4226159cf0f7746c457f5e78a76718c4fbd2 (patch)
tree1de87571d67586ea6f108af52aa55543133170dc /Source/WebKit/android/jni/WebViewCore.cpp
parent575f32db1ae2d0a9ad887464dafcc6e2994bd6a0 (diff)
parentc328457e578cf0c594ef7db2259754d3ee0b1fcd (diff)
downloadexternal_webkit-6e7f4226159cf0f7746c457f5e78a76718c4fbd2.zip
external_webkit-6e7f4226159cf0f7746c457f5e78a76718c4fbd2.tar.gz
external_webkit-6e7f4226159cf0f7746c457f5e78a76718c4fbd2.tar.bz2
am c328457e: am 37df6b06: Merge "Fix mouse nudging in hit test" into jb-dev
* commit 'c328457e578cf0c594ef7db2259754d3ee0b1fcd': Fix mouse nudging in hit test
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.cpp')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index d0287b4..ff45b30 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -1930,19 +1930,26 @@ AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool do
} else {
androidHitResult.setURLElement(0);
}
- IntPoint frameAdjust;
- if (frame != m_mainFrame) {
- frameAdjust = frame->view()->contentsToWindow(IntPoint());
- frameAdjust.move(m_scrollOffsetX, m_scrollOffsetY);
- }
- IntRect rect = final.mBounds;
- rect.move(frameAdjust.x(), frameAdjust.y());
- if (doMoveMouse) {
- // adjust m_mousePos if it is not inside the returned highlight rectangle
- testRect.move(frameAdjust.x(), frameAdjust.y());
- testRect.intersect(rect);
- if (!testRect.contains(x, y))
- moveMouse(testRect.center().x(), testRect.center().y(), 0, true);
+ Vector<IntRect>& highlightRects = androidHitResult.highlightRects();
+ if (doMoveMouse && highlightRects.size() > 0) {
+ // adjust m_mousePos if it is not inside the returned highlight
+ // rectangles
+ IntRect foundIntersection;
+ IntRect inputRect = IntRect(x - slop, y - slop,
+ slop * 2 + 1, slop * 2 + 1);
+ for (size_t i = 0; i < highlightRects.size(); i++) {
+ IntRect& hr = highlightRects[i];
+ IntRect test = inputRect;
+ test.intersect(hr);
+ if (!test.isEmpty()) {
+ foundIntersection = test;
+ break;
+ }
+ }
+ if (!foundIntersection.isEmpty() && !foundIntersection.contains(x, y)) {
+ IntPoint pt = foundIntersection.center();
+ moveMouse(pt.x(), pt.y(), 0, true);
+ }
}
} else {
androidHitResult.searchContentDetectors();