diff options
author | John Reck <jreck@google.com> | 2012-05-17 16:44:05 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-17 16:44:05 -0700 |
commit | 37df6b06a8481e3608cff1718038d353a8733d6c (patch) | |
tree | 36f386d5f0ac835ff7ac0da0d0f05a0af861b1e3 | |
parent | 824ebef65508846b8155ad893f40f6fd145e3c13 (diff) | |
parent | 580a4ea41896c60f782ce1fbaa9363320100c24b (diff) | |
download | external_webkit-37df6b06a8481e3608cff1718038d353a8733d6c.zip external_webkit-37df6b06a8481e3608cff1718038d353a8733d6c.tar.gz external_webkit-37df6b06a8481e3608cff1718038d353a8733d6c.tar.bz2 |
Merge "Fix mouse nudging in hit test" into jb-dev
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 8870b70..73abb07 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(); |