Title: [241617] trunk/Source/WebCore
Revision
241617
Author
[email protected]
Date
2019-02-15 14:18:36 -0800 (Fri, 15 Feb 2019)

Log Message

Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
https://bugs.webkit.org/show_bug.cgi?id=194702
<rdar://problem/48109355>

Reviewed by Dean Jackson.

* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
* page/EventHandler.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (241616 => 241617)


--- trunk/Source/WebCore/ChangeLog	2019-02-15 22:14:29 UTC (rev 241616)
+++ trunk/Source/WebCore/ChangeLog	2019-02-15 22:18:36 UTC (rev 241617)
@@ -1,3 +1,15 @@
+2019-02-15  Antoine Quint  <[email protected]>
+
+        Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
+        https://bugs.webkit.org/show_bug.cgi?id=194702
+        <rdar://problem/48109355>
+
+        Reviewed by Dean Jackson.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
+        * page/EventHandler.h:
+
 2019-02-15  Per Arne Vollan  <[email protected]>
 
         [WebVTT] Inline WebVTT styles should start with '::cue'

Modified: trunk/Source/WebCore/page/EventHandler.cpp (241616 => 241617)


--- trunk/Source/WebCore/page/EventHandler.cpp	2019-02-15 22:14:29 UTC (rev 241616)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2019-02-15 22:18:36 UTC (rev 241617)
@@ -114,6 +114,11 @@
 #include "TouchList.h"
 #endif
 
+#if ENABLE(TOUCH_EVENTS) && ENABLE(POINTER_EVENTS)
+#include "PointerCaptureController.h"
+#include "PointerEvent.h"
+#endif
+
 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
 #include "PlatformTouchEvent.h"
 #endif
@@ -4266,6 +4271,18 @@
 }
 #endif // ENABLE(TOUCH_EVENTS)
 
+#if ENABLE(TOUCH_EVENTS) && ENABLE(POINTER_EVENTS)
+Ref<PointerEvent> EventHandler::dispatchPointerEventForTouchAtIndex(EventTarget& target, const PlatformTouchEvent& platformTouchEvent, unsigned index, bool isPrimary)
+{
+    auto& pointerCaptureController = m_frame.page()->pointerCaptureController();
+    auto pointerEvent = PointerEvent::create(platformTouchEvent, index, isPrimary, m_frame.windowProxy());
+    pointerCaptureController.pointerEventWillBeDispatched(pointerEvent, &target);
+    target.dispatchEvent(pointerEvent);
+    pointerCaptureController.pointerEventWasDispatched(pointerEvent);
+    return pointerEvent;
+}
+#endif // ENABLE(TOUCH_EVENTS) && ENABLE(POINTER_EVENTS)
+
 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
 {
     m_mousePositionIsUnknown = false;

Modified: trunk/Source/WebCore/page/EventHandler.h (241616 => 241617)


--- trunk/Source/WebCore/page/EventHandler.h	2019-02-15 22:14:29 UTC (rev 241616)
+++ trunk/Source/WebCore/page/EventHandler.h	2019-02-15 22:18:36 UTC (rev 241617)
@@ -81,6 +81,7 @@
 class PlatformKeyboardEvent;
 class PlatformTouchEvent;
 class PlatformWheelEvent;
+class PointerEvent;
 class RenderBox;
 class RenderElement;
 class RenderLayer;
@@ -319,6 +320,10 @@
     WEBCORE_EXPORT bool handleTouchEvent(const PlatformTouchEvent&);
 #endif
 
+#if ENABLE(TOUCH_EVENTS) && ENABLE(POINTER_EVENTS)
+    Ref<PointerEvent> dispatchPointerEventForTouchAtIndex(EventTarget&, const PlatformTouchEvent&, unsigned, bool isPrimary);
+#endif
+
     bool useHandCursor(Node*, bool isOverLink, bool shiftKey);
     void updateCursor();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to