Title: [115747] trunk/Source/WebCore
Revision
115747
Author
[email protected]
Date
2012-05-01 13:50:00 -0700 (Tue, 01 May 2012)

Log Message

Allow a pre-targeted node to be specified when dispatching a GestureTap event
https://bugs.webkit.org/show_bug.cgi?id=85296

Patch by Terry Anderson <[email protected]> on 2012-05-01
Reviewed by Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=85101
    The new parameter will be used and tested in this patch.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureTap):
    The new preTargetedNode parameter can be used to pass in the Node that is
    the target of the GestureTap event. If this parameter is used, adjustedPoint
    is changed to be the center of the Node's bounding rectangle.
* page/EventHandler.h:
(EventHandler):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115746 => 115747)


--- trunk/Source/WebCore/ChangeLog	2012-05-01 20:15:26 UTC (rev 115746)
+++ trunk/Source/WebCore/ChangeLog	2012-05-01 20:50:00 UTC (rev 115747)
@@ -1,3 +1,21 @@
+2012-05-01  Terry Anderson  <[email protected]>
+
+        Allow a pre-targeted node to be specified when dispatching a GestureTap event
+        https://bugs.webkit.org/show_bug.cgi?id=85296
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=85101
+            The new parameter will be used and tested in this patch.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleGestureTap):
+            The new preTargetedNode parameter can be used to pass in the Node that is
+            the target of the GestureTap event. If this parameter is used, adjustedPoint
+            is changed to be the center of the Node's bounding rectangle.
+        * page/EventHandler.h:
+        (EventHandler):
+
 2012-05-01  Jessie Berlin  <[email protected]>
 
         Crash calling disconnectFrame on a DOMWindowExtension a second time.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (115746 => 115747)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-05-01 20:15:26 UTC (rev 115746)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-05-01 20:50:00 UTC (rev 115747)
@@ -2429,12 +2429,11 @@
     return false;
 }
 
-bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent)
+bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent, Node* preTargetedNode)
 {
-    // FIXME: Refactor this code to not hit test multiple times.
     IntPoint adjustedPoint = gestureEvent.position();
 #if ENABLE(TOUCH_ADJUSTMENT)
-    if (!gestureEvent.area().isEmpty()) {
+    if (!gestureEvent.area().isEmpty() && !preTargetedNode) {
         Node* targetNode = 0;
         // For now we use the adjusted position to ensure the later redundant hit-tests hits the right node.
         bestClickableNodeForTouchPoint(gestureEvent.position(), IntSize(gestureEvent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, targetNode);
@@ -2442,6 +2441,10 @@
             return false;
     }
 #endif
+    // FIXME: Refactor to avoid hit testing multiple times (this is only an interim step).
+    if (preTargetedNode)
+        adjustedPoint = preTargetedNode->getRect().center();
+
     bool defaultPrevented = false;
     PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(), NoButton, PlatformEvent::MouseMoved, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
     PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(), LeftButton, PlatformEvent::MousePressed, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());

Modified: trunk/Source/WebCore/page/EventHandler.h (115746 => 115747)


--- trunk/Source/WebCore/page/EventHandler.h	2012-05-01 20:15:26 UTC (rev 115746)
+++ trunk/Source/WebCore/page/EventHandler.h	2012-05-01 20:50:00 UTC (rev 115747)
@@ -163,7 +163,7 @@
 
 #if ENABLE(GESTURE_EVENTS)
     bool handleGestureEvent(const PlatformGestureEvent&);
-    bool handleGestureTap(const PlatformGestureEvent&);
+    bool handleGestureTap(const PlatformGestureEvent&, Node* preTargetedNode = 0);
     bool handleGestureScrollUpdate(const PlatformGestureEvent&);
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to