Title: [139904] trunk
Revision
139904
Author
[email protected]
Date
2013-01-16 11:48:44 -0800 (Wed, 16 Jan 2013)

Log Message

LinkHighlight should use touch adjustment to match active state on GestureTapDown.
https://bugs.webkit.org/show_bug.cgi?id=107032

Reviewed by Adam Barth.

Source/WebKit/chromium:

LinkHighlight node selection should produce results that match the node marked
active during GestureTapDown.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::bestTouchLinkNode):
* tests/LinkHighlightTest.cpp:
(WebCore::TEST):

LayoutTests:

* platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-multi-line.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139903 => 139904)


--- trunk/LayoutTests/ChangeLog	2013-01-16 19:26:57 UTC (rev 139903)
+++ trunk/LayoutTests/ChangeLog	2013-01-16 19:48:44 UTC (rev 139904)
@@ -1,3 +1,12 @@
+2013-01-16  W. James MacLean  <[email protected]>
+
+        LinkHighlight should use touch adjustment to match active state on GestureTapDown.
+        https://bugs.webkit.org/show_bug.cgi?id=107032
+
+        Reviewed by Adam Barth.
+
+        * platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-multi-line.html:
+
 2013-01-16  Levi Weintraub  <[email protected]>
 
         Unreviewed gardening. Marking several tests as crashing on Debug builds following

Modified: trunk/LayoutTests/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-multi-line.html (139903 => 139904)


--- trunk/LayoutTests/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-multi-line.html	2013-01-16 19:26:57 UTC (rev 139903)
+++ trunk/LayoutTests/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-multi-line.html	2013-01-16 19:48:44 UTC (rev 139904)
@@ -15,13 +15,15 @@
     var clientRect = document.getElementById('targetLink').getBoundingClientRect();
     x = (clientRect.left + clientRect.right) / 2;
     y = (clientRect.top + clientRect.bottom) / 2;
+    touchWidth = (clientRect.right - clientRect.left) / 4;
+    touchHeight = (clientRect.bottom - clientRect.top) / 4;
     if (window.testRunner) {
         testRunner.dumpAsText(true);
         testRunner.waitUntilDone();
     }
 
     if (window.eventSender) {
-        eventSender.gestureTapDown(x, y);
+        eventSender.gestureTapDown(x, y, touchWidth, touchHeight);
         window.setTimeout(function() { window.testRunner.notifyDone(); }, 0);
     } else {
         debug("This test requires DumpRenderTree.");

Modified: trunk/Source/WebKit/chromium/ChangeLog (139903 => 139904)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-16 19:26:57 UTC (rev 139903)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-16 19:48:44 UTC (rev 139904)
@@ -1,3 +1,18 @@
+2013-01-16  W. James MacLean  <[email protected]>
+
+        LinkHighlight should use touch adjustment to match active state on GestureTapDown.
+        https://bugs.webkit.org/show_bug.cgi?id=107032
+
+        Reviewed by Adam Barth.
+
+        LinkHighlight node selection should produce results that match the node marked
+        active during GestureTapDown.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::bestTouchLinkNode):
+        * tests/LinkHighlightTest.cpp:
+        (WebCore::TEST):
+
 2013-01-16  Kentaro Hara  <[email protected]>
 
         [V8] Make a creationContext parameter of toV8() mandatory

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (139903 => 139904)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-16 19:26:57 UTC (rev 139903)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2013-01-16 19:48:44 UTC (rev 139904)
@@ -1224,12 +1224,19 @@
 
     Node* bestTouchNode = 0;
 
-    // FIXME: Should accept a search region from the caller instead of hard-coding the size.
-    IntSize touchEventSearchRegionSize(4, 2);
+    IntSize touchEventSearchRegionSize(touchEvent.data.tapDown.width / 2, touchEvent.data.tapDown.height / 2);
     IntPoint touchEventLocation(touchEvent.x, touchEvent.y);
-    m_page->mainFrame()->eventHandler()->bestClickableNodeForTouchPoint(touchEventLocation, touchEventSearchRegionSize, touchEventLocation, bestTouchNode);
-    // bestClickableNodeForTouchPoint() doesn't always return a node that is a link, so let's try and find
-    // a link to highlight.
+#if ENABLE(TOUCH_ADJUSTMENT)
+    m_page->mainFrame()->eventHandler()->adjustGesturePosition(PlatformGestureEventBuilder(mainFrameImpl()->frameView(), touchEvent), touchEventLocation);
+#endif
+
+    IntPoint hitTestPoint = m_page->mainFrame()->view()->windowToContents(touchEventLocation);
+    HitTestResult result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(
+        hitTestPoint, false, false, DontHitTestScrollbars, HitTestRequest::TouchEvent);
+    bestTouchNode = result.targetNode();
+
+    // Make sure our highlight candidate uses a hand cursor as a heuristic to
+    // choose appropriate targets.
     bool shiftKey = touchEvent.modifiers & WebGestureEvent::ShiftKey;
     while (bestTouchNode && !invokesHandCursor(bestTouchNode, shiftKey, m_page->mainFrame()))
         bestTouchNode = bestTouchNode->parentNode();

Modified: trunk/Source/WebKit/chromium/tests/LinkHighlightTest.cpp (139903 => 139904)


--- trunk/Source/WebKit/chromium/tests/LinkHighlightTest.cpp	2013-01-16 19:26:57 UTC (rev 139903)
+++ trunk/Source/WebKit/chromium/tests/LinkHighlightTest.cpp	2013-01-16 19:48:44 UTC (rev 139904)
@@ -61,6 +61,7 @@
     webViewImpl->layout();
 
     WebGestureEvent touchEvent;
+    touchEvent.type = WebInputEvent::GestureTapDown;
 
     // The coordinates below are linked to absolute positions in the referenced .html file.
     touchEvent.x = 20;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to