Title: [211270] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211269 => 211270)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-01-27 08:02:21 UTC (rev 211270)
@@ -1,5 +1,26 @@
 2017-01-26  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211235. rdar://problem/30058933
+
+    2017-01-26  Jeremy Jones  <jere...@apple.com>
+
+            Pointer lock events should be delivered directly to the target element
+            https://bugs.webkit.org/show_bug.cgi?id=167134
+
+            Reviewed by Jon Lee.
+
+            The pointer-lock/mouse-event-delivery.html test is modified to explicitly move the mouse pointer to a valid
+            location before sending mouse actions. Without this, the test infrastructure doesn't know that the pointer
+            is over the web view and doesn't deliver events.
+
+            Added code to test for wheel events.
+
+            * platform/mac/TestExpectations: enabled test.
+            * pointer-lock/mouse-event-delivery.html:
+            * pointer-lock/mouse-event-delivery-expected.txt:
+
+2017-01-26  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211234. rdar://problem/29899862
 
     2017-01-26  Jeremy Jones  <jere...@apple.com>

Modified: branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations (211269 => 211270)


--- branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations	2017-01-27 08:02:21 UTC (rev 211270)
@@ -282,7 +282,6 @@
 pointer-lock/bug90391-move-then-window-open-crash.html
 pointer-lock/locked-element-iframe-removed-from-dom.html
 pointer-lock/locked-element-removed-from-dom.html
-pointer-lock/mouse-event-delivery.html
 pointer-lock/pointerlockchange-event-on-lock-lost.html
 pointer-lock/pointerlockchange-pointerlockerror-events.html
 pointer-lock/pointerlockelement-null-when-pending.html

Modified: branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt (211269 => 211270)


--- branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt	2017-01-27 08:02:21 UTC (rev 211270)
@@ -5,11 +5,17 @@
 
 PASS document.onpointerlockchange event received.
 PASS document.pointerLockElement is targetdiv1
+     With a lock in place send a wheel event.
+PASS event type: wheel, target: target1, received on: target1
+PASS event type: wheel, target: target1, received on: body
      With a lock in place send a click.
 PASS event type: mousedown, target: target1, received on: target1
 PASS event type: mousedown, target: target1, received on: body
 PASS document.onpointerlockchange event received.
 PASS document.pointerLockElement is targetdiv2
+     With a lock in place send a wheel event.
+PASS event type: wheel, target: target2, received on: target2
+PASS event type: wheel, target: target2, received on: body
      With a lock in place send a click.
 PASS event type: mousedown, target: target2, received on: target2
 PASS event type: mousedown, target: target2, received on: body

Modified: branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery.html (211269 => 211270)


--- branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery.html	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/LayoutTests/pointer-lock/mouse-event-delivery.html	2017-01-27 08:02:21 UTC (rev 211270)
@@ -42,6 +42,18 @@
             // doNextStep() called by onpointerlockchange handler.
         },
         function () {
+            debug("     With a lock in place send a wheel event.")
+            targetdiv1._onwheel_ = eventExpected;
+            targetdiv2._onwheel_ = eventNotExpected;
+            document.body._onwheel_ = eventExpected;
+            if (window.eventSender) {
+                window.eventSender.mouseMoveTo(20,20);
+                window.eventSender.leapForward(1000);
+                window.eventSender.mouseScrollBy(0,10);
+            }
+            doNextStep();
+        },
+        function () {
             debug("     With a lock in place send a click.")
             targetdiv1._onmousedown_ = eventExpected;
             targetdiv2._onmousedown_ = eventNotExpected;
@@ -59,6 +71,17 @@
             // doNextStep() called by onpointerlockchange handler.
         },
         function () {
+            debug("     With a lock in place send a wheel event.")
+            targetdiv1._onwheel_ = eventNotExpected;
+            targetdiv2._onwheel_ = eventExpected;
+            document.body._onwheel_ = eventExpected;
+            if (window.eventSender) {
+                window.eventSender.leapForward(1000);
+                window.eventSender.mouseScrollBy(0,10);
+            }
+            doNextStep();
+        },
+        function () {
             debug("     With a lock in place send a click.")
             targetdiv1._onmousedown_ = eventNotExpected;
             targetdiv2._onmousedown_ = eventExpected;

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211269 => 211270)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-01-27 08:02:21 UTC (rev 211270)
@@ -1,5 +1,33 @@
 2017-01-26  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211235. rdar://problem/30058933
+
+    2017-01-26  Jeremy Jones  <jere...@apple.com>
+
+            Pointer lock events should be delivered directly to the target element
+            https://bugs.webkit.org/show_bug.cgi?id=167134
+
+            Reviewed by Jon Lee.
+
+            pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
+
+            When pointer is locked on an element, route mouse events directly to the target element, instead of
+            doing the normal event disptach.
+
+            * page/EventHandler.cpp:
+            (WebCore::EventHandler::handleMousePressEvent):
+            (WebCore::EventHandler::handleMouseDoubleClickEvent):
+            (WebCore::EventHandler::handleMouseMoveEvent):
+            (WebCore::EventHandler::handleMouseReleaseEvent):
+            (WebCore::EventHandler::handleMouseForceEvent):
+            (WebCore::EventHandler::handleWheelEvent):
+            * page/PointerLockController.cpp:
+            (WebCore::PointerLockController::isLocked): Added.
+            (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
+            * page/PointerLockController.h:
+
+2017-01-26  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211233. rdar://problem/30220959
 
     2017-01-26  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp (211269 => 211270)


--- branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/Source/WebCore/page/EventHandler.cpp	2017-01-27 08:02:21 UTC (rev 211270)
@@ -1631,6 +1631,13 @@
         return true;
     }
 
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedMouseEvent(platformMouseEvent, eventNames().mousedownEvent);
+        return true;
+    }
+#endif
+
     if (m_frame.mainFrame().pageOverlayController().handleMouseEvent(platformMouseEvent))
         return true;
 
@@ -1771,6 +1778,13 @@
 
     UserGestureIndicator gestureIndicator(ProcessingUserGesture, m_frame.document());
 
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedMouseEvent(platformMouseEvent, eventNames().mouseupEvent);
+        return true;
+    }
+#endif
+
     // We get this instead of a second mouse-up 
     m_mousePressed = false;
     setLastKnownMousePosition(platformMouseEvent);
@@ -1865,7 +1879,14 @@
 
     Ref<Frame> protectedFrame(m_frame);
     RefPtr<FrameView> protector(m_frame.view());
-    
+
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedMouseEvent(platformMouseEvent, eventNames().mousemoveEvent);
+        return true;
+    }
+#endif
+
     setLastKnownMousePosition(platformMouseEvent);
 
     if (m_hoverTimer.isActive())
@@ -2004,6 +2025,13 @@
 
     m_frame.selection().setCaretBlinkingSuspended(false);
 
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedMouseEvent(platformMouseEvent, eventNames().mouseupEvent);
+        return true;
+    }
+#endif
+
     if (m_frame.mainFrame().pageOverlayController().handleMouseEvent(platformMouseEvent))
         return true;
 
@@ -2082,6 +2110,17 @@
     Ref<Frame> protectedFrame(m_frame);
     RefPtr<FrameView> protector(m_frame.view());
 
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedMouseEvent(event, eventNames().webkitmouseforcechangedEvent);
+        if (event.type() == PlatformEvent::MouseForceDown)
+            m_frame.page()->pointerLockController().dispatchLockedMouseEvent(event, eventNames().webkitmouseforcedownEvent);
+        if (event.type() == PlatformEvent::MouseForceUp)
+            m_frame.page()->pointerLockController().dispatchLockedMouseEvent(event, eventNames().webkitmouseforceupEvent);
+        return true;
+    }
+#endif
+
     setLastKnownMousePosition(event);
 
     HitTestRequest::HitTestRequestType hitType = HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::Active;
@@ -2686,6 +2725,13 @@
     if (!view)
         return false;
 
+#if ENABLE(POINTER_LOCK)
+    if (m_frame.page()->pointerLockController().isLocked()) {
+        m_frame.page()->pointerLockController().dispatchLockedWheelEvent(event);
+        return true;
+    }
+#endif
+
     m_isHandlingWheelEvent = true;
     setFrameWasScrolledByUser();
 

Modified: branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp (211269 => 211270)


--- branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp	2017-01-27 08:02:21 UTC (rev 211270)
@@ -121,6 +121,11 @@
     }
 }
 
+bool PointerLockController::isLocked() const
+{
+    return m_element && !m_lockPending;
+}
+
 bool PointerLockController::lockPending() const
 {
     return m_lockPending;
@@ -166,6 +171,14 @@
         m_element->dispatchMouseEvent(event, eventNames().clickEvent, event.clickCount());
 }
 
+void PointerLockController::dispatchLockedWheelEvent(const PlatformWheelEvent& event)
+{
+    if (!m_element || !m_element->document().frame())
+        return;
+
+    m_element->dispatchWheelEvent(event);
+}
+
 void PointerLockController::clearElement()
 {
     m_lockPending = false;

Modified: branches/safari-603-branch/Source/WebCore/page/PointerLockController.h (211269 => 211270)


--- branches/safari-603-branch/Source/WebCore/page/PointerLockController.h	2017-01-27 08:02:17 UTC (rev 211269)
+++ branches/safari-603-branch/Source/WebCore/page/PointerLockController.h	2017-01-27 08:02:21 UTC (rev 211270)
@@ -35,6 +35,7 @@
 class Document;
 class Page;
 class PlatformMouseEvent;
+class PlatformWheelEvent;
 class VoidCallback;
 
 class PointerLockController {
@@ -48,6 +49,7 @@
     void requestPointerUnlockAndForceCursorVisible();
     void elementRemoved(Element&);
     void documentDetached(Document&);
+    bool isLocked() const;
     WEBCORE_EXPORT bool lockPending() const;
     WEBCORE_EXPORT Element* element() const;
 
@@ -55,6 +57,7 @@
     WEBCORE_EXPORT void didNotAcquirePointerLock();
     WEBCORE_EXPORT void didLosePointerLock();
     void dispatchLockedMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType);
+    void dispatchLockedWheelEvent(const PlatformWheelEvent&);
 
 private:
     void clearElement();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to