diff options
author | John Reck <jreck@google.com> | 2012-05-21 12:39:52 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-21 12:39:52 -0700 |
commit | 1e685f76b45c48a939a1f9870a7c74f0a12a975e (patch) | |
tree | 99c7fc8ece551a0705944c78536e2ede23b837a3 /Source/WebKit/android | |
parent | aa45f8f68bf7e298be8ce20359cb12c659806e28 (diff) | |
parent | c085b5fefdf5cbd9a203f11ce239ee0dce48ec1d (diff) | |
download | external_webkit-1e685f76b45c48a939a1f9870a7c74f0a12a975e.zip external_webkit-1e685f76b45c48a939a1f9870a7c74f0a12a975e.tar.gz external_webkit-1e685f76b45c48a939a1f9870a7c74f0a12a975e.tar.bz2 |
am c085b5fe: am 02085505: Merge "Track where we want to click the mouse independently" into jb-dev
* commit 'c085b5fefdf5cbd9a203f11ce239ee0dce48ec1d':
Track where we want to click the mouse independently
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 12 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 29f8f1e..d0287b4 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -1783,7 +1783,7 @@ bool WebViewCore::nodeIsClickableOrFocusable(Node* node) AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool doMoveMouse) { if (doMoveMouse) - moveMouse(x, y); + moveMouse(x, y, 0, true); HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), false, false, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly, IntSize(slop, slop)); AndroidHitTestResult androidHitResult(this, hitTestResult); @@ -1942,7 +1942,7 @@ AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool do testRect.move(frameAdjust.x(), frameAdjust.y()); testRect.intersect(rect); if (!testRect.contains(x, y)) - moveMouse(testRect.center().x(), testRect.center().y()); + moveMouse(testRect.center().x(), testRect.center().y(), 0, true); } } else { androidHitResult.searchContentDetectors(); @@ -2121,10 +2121,12 @@ static PluginView* nodeIsPlugin(Node* node) { /////////////////////////////////////////////////////////////////////////////// // Update mouse position -void WebViewCore::moveMouse(int x, int y, HitTestResult* hoveredNode) +void WebViewCore::moveMouse(int x, int y, HitTestResult* hoveredNode, bool isClickCandidate) { // mouse event expects the position in the window coordinate m_mousePos = WebCore::IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY); + if (isClickCandidate) + m_mouseClickPos = m_mousePos; // validNode will still return true if the node is null, as long as we have // a valid frame. Do not want to make a call on frame unless it is valid. WebCore::PlatformMouseEvent mouseEvent(m_mousePos, m_mousePos, @@ -3240,12 +3242,12 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint bool WebViewCore::performMouseClick() { - WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, + WebCore::PlatformMouseEvent mouseDown(m_mouseClickPos, m_mouseClickPos, WebCore::LeftButton, WebCore::MouseEventPressed, 1, false, false, false, false, WTF::currentTime()); // ignore the return from as it will return true if the hit point can trigger selection change m_mainFrame->eventHandler()->handleMousePressEvent(mouseDown); - WebCore::PlatformMouseEvent mouseUp(m_mousePos, m_mousePos, WebCore::LeftButton, + WebCore::PlatformMouseEvent mouseUp(m_mouseClickPos, m_mouseClickPos, WebCore::LeftButton, WebCore::MouseEventReleased, 1, false, false, false, false, WTF::currentTime()); bool handled = m_mainFrame->eventHandler()->handleMouseReleaseEvent(mouseUp); diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index c6b26c6..bfd9387 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -299,7 +299,8 @@ namespace android { // scroll the selection on screen (if necessary). void revealSelection(); - void moveMouse(int x, int y, WebCore::HitTestResult* hoveredNode = 0); + void moveMouse(int x, int y, WebCore::HitTestResult* hoveredNode = 0, + bool isClickCandidate = false); // set the scroll amount that webview.java is currently showing void setScrollOffset(bool sendScrollEvent, int dx, int dy); @@ -766,6 +767,13 @@ namespace android { int m_scrollOffsetY; // webview.java's current scroll in Y double m_scrollSetTime; // when the scroll was last set WebCore::IntPoint m_mousePos; + // This is the location at which we will click. This is tracked + // separately from m_mousePos, because m_mousePos may be updated + // in the interval between ACTION_UP and when the click fires since + // that occurs after a delay. This also works around potential hardware + // issues if we get onHoverEvents when using the touch screen, as that + // will nullify the slop checking we do in hitTest (aka, ACTION_DOWN) + WebCore::IntPoint m_mouseClickPos; int m_screenWidth; // width of the visible rect in document coordinates int m_screenHeight;// height of the visible rect in document coordinates int m_textWrapWidth; |