Title: [292656] branches/safari-613-branch
Revision
292656
Author
[email protected]
Date
2022-04-08 17:13:51 -0700 (Fri, 08 Apr 2022)

Log Message

Cherry-pick r291886. rdar://problem/72814440

    `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
    https://bugs.webkit.org/show_bug.cgi?id=220194
    <rdar://problem/72814440>

    Reviewed by Simon Fraser.

    LayoutTests/imported/w3c:

    * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
    This change causes the test to progress further than before, but there still appear to be
    other issues elsewhere, so adjust the expected output to reflect that.

    Source/WebCore:

    Test: pointer-lock/pointermove-movement-delta.html

    * dom/PointerEvent.cpp:
    (WebCore::PointerEvent::PointerEvent):
    Also pass along the movement delta in the constructor that takes a `MouseEvent`.

    * dom/MouseEvent.h:
    * dom/MouseEvent.cpp:
    (WebCore::MouseEvent::create):
    (WebCore::MouseEvent::MouseEvent):
    Require that all constructors that aren't invoked from JS always provide a movement delta.

    * dom/MouseRelatedEvent.h:
    (WebCore::MouseRelatedEvent::movementX const):
    (WebCore::MouseRelatedEvent::movementY const):
    Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
    the callsite having to also have a `#if`.

    * page/EventHandler.cpp:
    (WebCore::EventHandler::dispatchDragEvent):
    Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.

    Tools:

    * DumpRenderTree/mac/EventSendingController.mm:
    (-[EventSendingController mouseMoveToX:Y:]):
    * WebKitTestRunner/mac/EventSenderProxy.mm:
    (WTR::EventSenderProxy::mouseMoveTo):
    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.

    LayoutTests:

    * pointer-lock/pointermove-movement-delta.html: Added.
    * pointer-lock/pointermove-movement-delta-expected.txt: Added.

    * pointer-lock/mouse-event-delivery-expected.txt: Added.
    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.

    * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
    This change causes the test to progress further than before, but there still appear to be
    other issues elsewhere, so adjust the expected output to reflect that.

    * platform/mac-wk1/TestExpectations:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (292655 => 292656)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-09 00:13:51 UTC (rev 292656)
@@ -1,5 +1,90 @@
 2022-04-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r291886. rdar://problem/72814440
+
+    `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+    https://bugs.webkit.org/show_bug.cgi?id=220194
+    <rdar://problem/72814440>
+    
+    Reviewed by Simon Fraser.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    Source/WebCore:
+    
+    Test: pointer-lock/pointermove-movement-delta.html
+    
+    * dom/PointerEvent.cpp:
+    (WebCore::PointerEvent::PointerEvent):
+    Also pass along the movement delta in the constructor that takes a `MouseEvent`.
+    
+    * dom/MouseEvent.h:
+    * dom/MouseEvent.cpp:
+    (WebCore::MouseEvent::create):
+    (WebCore::MouseEvent::MouseEvent):
+    Require that all constructors that aren't invoked from JS always provide a movement delta.
+    
+    * dom/MouseRelatedEvent.h:
+    (WebCore::MouseRelatedEvent::movementX const):
+    (WebCore::MouseRelatedEvent::movementY const):
+    Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
+    the callsite having to also have a `#if`.
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchDragEvent):
+    Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.
+    
+    Tools:
+    
+    * DumpRenderTree/mac/EventSendingController.mm:
+    (-[EventSendingController mouseMoveToX:Y:]):
+    * WebKitTestRunner/mac/EventSenderProxy.mm:
+    (WTR::EventSenderProxy::mouseMoveTo):
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    LayoutTests:
+    
+    * pointer-lock/pointermove-movement-delta.html: Added.
+    * pointer-lock/pointermove-movement-delta-expected.txt: Added.
+    
+    * pointer-lock/mouse-event-delivery-expected.txt: Added.
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    * platform/mac-wk1/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-25  Devin Rousso  <[email protected]>
+
+            `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+            https://bugs.webkit.org/show_bug.cgi?id=220194
+            <rdar://problem/72814440>
+
+            Reviewed by Simon Fraser.
+
+            * pointer-lock/pointermove-movement-delta.html: Added.
+            * pointer-lock/pointermove-movement-delta-expected.txt: Added.
+
+            * pointer-lock/mouse-event-delivery-expected.txt: Added.
+            On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+
+            * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
+            This change causes the test to progress further than before, but there still appear to be
+            other issues elsewhere, so adjust the expected output to reflect that.
+
+            * platform/mac-wk1/TestExpectations:
+
+2022-04-07  Alan Coon  <[email protected]>
+
         Cherry-pick r291816. rdar://problem/90599352
 
     REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog (292655 => 292656)


--- branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-04-09 00:13:51 UTC (rev 292656)
@@ -1,5 +1,82 @@
 2022-04-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r291886. rdar://problem/72814440
+
+    `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+    https://bugs.webkit.org/show_bug.cgi?id=220194
+    <rdar://problem/72814440>
+    
+    Reviewed by Simon Fraser.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    Source/WebCore:
+    
+    Test: pointer-lock/pointermove-movement-delta.html
+    
+    * dom/PointerEvent.cpp:
+    (WebCore::PointerEvent::PointerEvent):
+    Also pass along the movement delta in the constructor that takes a `MouseEvent`.
+    
+    * dom/MouseEvent.h:
+    * dom/MouseEvent.cpp:
+    (WebCore::MouseEvent::create):
+    (WebCore::MouseEvent::MouseEvent):
+    Require that all constructors that aren't invoked from JS always provide a movement delta.
+    
+    * dom/MouseRelatedEvent.h:
+    (WebCore::MouseRelatedEvent::movementX const):
+    (WebCore::MouseRelatedEvent::movementY const):
+    Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
+    the callsite having to also have a `#if`.
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchDragEvent):
+    Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.
+    
+    Tools:
+    
+    * DumpRenderTree/mac/EventSendingController.mm:
+    (-[EventSendingController mouseMoveToX:Y:]):
+    * WebKitTestRunner/mac/EventSenderProxy.mm:
+    (WTR::EventSenderProxy::mouseMoveTo):
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    LayoutTests:
+    
+    * pointer-lock/pointermove-movement-delta.html: Added.
+    * pointer-lock/pointermove-movement-delta-expected.txt: Added.
+    
+    * pointer-lock/mouse-event-delivery-expected.txt: Added.
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    * platform/mac-wk1/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-25  Devin Rousso  <[email protected]>
+
+            `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+            https://bugs.webkit.org/show_bug.cgi?id=220194
+            <rdar://problem/72814440>
+
+            Reviewed by Simon Fraser.
+
+            * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
+            This change causes the test to progress further than before, but there still appear to be
+            other issues elsewhere, so adjust the expected output to reflect that.
+
+2022-04-07  Alan Coon  <[email protected]>
+
         Cherry-pick r291420. rdar://problem/90335275
 
     REGRESSION (iOS 15.4 / r287669): Mobile app stopped working due to CSS / angular animation

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt (292655 => 292656)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt	2022-04-09 00:13:51 UTC (rev 292656)
@@ -12,5 +12,5 @@
 Test passes if the proper behavior of the events is observed.
 
 
-FAIL mouse pointerevent movementX/Y with pointerlock test assert_equals: expected 0 but got 10
+FAIL mouse pointerevent movementX/Y with pointerlock test assert_equals: expected -9991 but got -9981
 

Copied: branches/safari-613-branch/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt (from rev 292655, branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt) (0 => 292656)


--- branches/safari-613-branch/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt	2022-04-09 00:13:51 UTC (rev 292656)
@@ -0,0 +1,16 @@
+Pointer Events movement with pointerlock test
+
+Follow the test instructions with mouse. If you don't have the device skip it.
+
+Test Description: This test checks pointerevent movementX/Y value with pointerlock. It checks whether movement X/Y matches event.screenX/Y - last_event.screenX/Y when pointer is not locked; And if pointermove.movementX/Y matches mousemove.movementX/Y when pointer is locked.
+Move the mouse inside the green rectangle.
+Click left button on the green rectangle.(Enter pointerlock)
+Move the mouse around.
+Click left button again
+Move the mouse inside the green rectangle.
+Click left button again to end the test.
+Test passes if the proper behavior of the events is observed.
+
+
+FAIL mouse pointerevent movementX/Y with pointerlock test assert_equals: expected 9 but got 19
+

Modified: branches/safari-613-branch/LayoutTests/platform/mac-wk1/TestExpectations (292655 => 292656)


--- branches/safari-613-branch/LayoutTests/platform/mac-wk1/TestExpectations	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/LayoutTests/platform/mac-wk1/TestExpectations	2022-04-09 00:13:51 UTC (rev 292656)
@@ -874,6 +874,7 @@
 webkit.org/b/195098 pointerevents/mouse/over-enter-out-leave.html [ Failure ]
 webkit.org/b/195098 pointerevents/mouse/pointer-capture.html [ Failure ]
 webkit.org/b/195098 pointerevents/mouse/pointer-events-before-mouse-events.html [ Failure ]
+webkit.org/b/195098 pointer-lock/pointermove-movement-delta.html [ Failure ]
 
 webkit.org/b/196915 [ Debug ] inspector/timeline/timeline-recording.html [ Pass Failure ]
 

Modified: branches/safari-613-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt (292655 => 292656)


--- branches/safari-613-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/LayoutTests/pointer-lock/mouse-event-delivery-expected.txt	2022-04-09 00:13:51 UTC (rev 292656)
@@ -9,8 +9,8 @@
 PASS event type: wheel, target: target1, received on: target1
 PASS event type: wheel, target: target1, received on: body
      With a lock in place move the mouse.
-PASS event type: mousemove, movementX: 25, movementY: -30, target: target1, received on: target1
-PASS event type: mousemove, movementX: 25, movementY: -30, target: target1, received on: body
+PASS event type: mousemove, movementX: 25, movementY: 30, target: target1, received on: target1
+PASS event type: mousemove, movementX: 25, movementY: 30, 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

Added: branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta-expected.txt (0 => 292656)


--- branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta-expected.txt	2022-04-09 00:13:51 UTC (rev 292656)
@@ -0,0 +1,3 @@
+
+PASS Testing the movementX and movementY properties of a pointer event triggered by a mouse.
+

Added: branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta.html (0 => 292656)


--- branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/pointer-lock/pointermove-movement-delta.html	2022-04-09 00:13:51 UTC (rev 292656)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+"use strict";
+
+target_test((target, test) => {
+    eventSender.mouseMoveTo(100, 100);
+
+    target.addEventListener("pointermove", (event) => {
+        assert_equals(event.x, 150, "The x property value is as expected.");
+        assert_equals(event.y, 150, "The y property value is as expected.");
+
+        assert_equals(event.movementX, 50, "The movementX property value is as expected.");
+        assert_equals(event.movementY, 50, "The movementY property value is as expected.");
+
+        test.done();
+    });
+
+    eventSender.mouseMoveTo(150, 150);
+}, "Testing the movementX and movementY properties of a pointer event triggered by a mouse.");
+
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-09 00:13:51 UTC (rev 292656)
@@ -1,5 +1,100 @@
 2022-04-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r291886. rdar://problem/72814440
+
+    `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+    https://bugs.webkit.org/show_bug.cgi?id=220194
+    <rdar://problem/72814440>
+    
+    Reviewed by Simon Fraser.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    Source/WebCore:
+    
+    Test: pointer-lock/pointermove-movement-delta.html
+    
+    * dom/PointerEvent.cpp:
+    (WebCore::PointerEvent::PointerEvent):
+    Also pass along the movement delta in the constructor that takes a `MouseEvent`.
+    
+    * dom/MouseEvent.h:
+    * dom/MouseEvent.cpp:
+    (WebCore::MouseEvent::create):
+    (WebCore::MouseEvent::MouseEvent):
+    Require that all constructors that aren't invoked from JS always provide a movement delta.
+    
+    * dom/MouseRelatedEvent.h:
+    (WebCore::MouseRelatedEvent::movementX const):
+    (WebCore::MouseRelatedEvent::movementY const):
+    Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
+    the callsite having to also have a `#if`.
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchDragEvent):
+    Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.
+    
+    Tools:
+    
+    * DumpRenderTree/mac/EventSendingController.mm:
+    (-[EventSendingController mouseMoveToX:Y:]):
+    * WebKitTestRunner/mac/EventSenderProxy.mm:
+    (WTR::EventSenderProxy::mouseMoveTo):
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    LayoutTests:
+    
+    * pointer-lock/pointermove-movement-delta.html: Added.
+    * pointer-lock/pointermove-movement-delta-expected.txt: Added.
+    
+    * pointer-lock/mouse-event-delivery-expected.txt: Added.
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    * platform/mac-wk1/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-25  Devin Rousso  <[email protected]>
+
+            `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+            https://bugs.webkit.org/show_bug.cgi?id=220194
+            <rdar://problem/72814440>
+
+            Reviewed by Simon Fraser.
+
+            Test: pointer-lock/pointermove-movement-delta.html
+
+            * dom/PointerEvent.cpp:
+            (WebCore::PointerEvent::PointerEvent):
+            Also pass along the movement delta in the constructor that takes a `MouseEvent`.
+
+            * dom/MouseEvent.h:
+            * dom/MouseEvent.cpp:
+            (WebCore::MouseEvent::create):
+            (WebCore::MouseEvent::MouseEvent):
+            Require that all constructors that aren't invoked from JS always provide a movement delta.
+
+            * dom/MouseRelatedEvent.h:
+            (WebCore::MouseRelatedEvent::movementX const):
+            (WebCore::MouseRelatedEvent::movementY const):
+            Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
+            the callsite having to also have a `#if`.
+
+            * page/EventHandler.cpp:
+            (WebCore::EventHandler::dispatchDragEvent):
+            Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.
+
+2022-04-07  Alan Coon  <[email protected]>
+
         Cherry-pick r291816. rdar://problem/90599352
 
     REGRESSION (Safari 15.4): Nonce from link isn't used when loading style sheet

Modified: branches/safari-613-branch/Source/WebCore/dom/MouseEvent.cpp (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/dom/MouseEvent.cpp	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/dom/MouseEvent.cpp	2022-04-09 00:13:51 UTC (rev 292656)
@@ -56,12 +56,7 @@
     auto isComposed = !isMouseEnterOrLeave ? IsComposed::Yes : IsComposed::No;
 
     return MouseEvent::create(eventType, canBubble, isCancelable, isComposed, event.timestamp().approximateMonotonicTime(), WTFMove(view), detail,
-        event.globalPosition(), event.position(),
-#if ENABLE(POINTER_LOCK)
-        event.movementDelta(),
-#else
-        { },
-#endif
+        event.globalPosition(), event.position(), event.movementDelta(),
         event.modifiers(), event.button(), event.buttons(), relatedTarget, event.force(), event.syntheticClickType());
 }
 
@@ -77,7 +72,7 @@
     int screenX, int screenY, int clientX, int clientY, OptionSet<Modifier> modifiers, short button, unsigned short buttons,
     unsigned short syntheticClickType, EventTarget* relatedTarget)
 {
-    return adoptRef(*new MouseEvent(eventType, canBubble, isCancelable, isComposed, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, modifiers, button, buttons, syntheticClickType, relatedTarget));
+    return adoptRef(*new MouseEvent(eventType, canBubble, isCancelable, isComposed, WTFMove(view), detail, { screenX, screenY }, { clientX, clientY }, { }, modifiers, button, buttons, syntheticClickType, relatedTarget));
 }
 
 MouseEvent::MouseEvent() = default;
@@ -97,9 +92,9 @@
 }
 
 MouseEvent::MouseEvent(const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed,
-    RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation,
+    RefPtr<WindowProxy>&& view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, const IntPoint& movementDelta,
     OptionSet<Modifier> modifiers, short button, unsigned short buttons, unsigned short syntheticClickType, EventTarget* relatedTarget)
-    : MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { }, { }, modifiers, IsSimulated::No)
+    : MouseRelatedEvent(eventType, canBubble, isCancelable, isComposed, MonotonicTime::now(), WTFMove(view), detail, screenLocation, { }, movementDelta, modifiers, IsSimulated::No)
     , m_button(button == -2 ? 0 : button)
     , m_buttons(buttons)
     , m_syntheticClickType(button == -2 ? 0 : syntheticClickType)

Modified: branches/safari-613-branch/Source/WebCore/dom/MouseEvent.h (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/dom/MouseEvent.h	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/dom/MouseEvent.h	2022-04-09 00:13:51 UTC (rev 292656)
@@ -93,7 +93,7 @@
         EventTarget* relatedTarget, double force, unsigned short syntheticClickType, IsSimulated, IsTrusted);
 
     MouseEvent(const AtomString& type, CanBubble, IsCancelable, IsComposed, RefPtr<WindowProxy>&&, int detail,
-        const IntPoint& screenLocation, const IntPoint& clientLocation, OptionSet<Modifier>, short button, unsigned short buttons,
+        const IntPoint& screenLocation, const IntPoint& clientLocation, const IntPoint& movementDelta, OptionSet<Modifier>, short button, unsigned short buttons,
         unsigned short syntheticClickType, EventTarget* relatedTarget);
 
     MouseEvent(const AtomString& type, const MouseEventInit&);

Modified: branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.cpp (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.cpp	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.cpp	2022-04-09 00:13:51 UTC (rev 292656)
@@ -41,14 +41,9 @@
     const IntPoint& screenLocation, const IntPoint& windowLocation, const IntPoint& movementDelta, OptionSet<Modifier> modifiers, IsSimulated isSimulated, IsTrusted isTrusted)
     : UIEventWithKeyState(eventType, canBubble, isCancelable, isComposed, timestamp, WTFMove(view), detail, modifiers, isTrusted)
     , m_screenLocation(screenLocation)
-#if ENABLE(POINTER_LOCK)
     , m_movementDelta(movementDelta)
-#endif
     , m_isSimulated(isSimulated == IsSimulated::Yes)
 {
-#if !ENABLE(POINTER_LOCK)
-    UNUSED_PARAM(movementDelta);
-#endif
     init(m_isSimulated, windowLocation);
 }
 
@@ -61,9 +56,7 @@
 MouseRelatedEvent::MouseRelatedEvent(const AtomString& eventType, const MouseRelatedEventInit& initializer, IsTrusted isTrusted)
     : UIEventWithKeyState(eventType, initializer)
     , m_screenLocation(IntPoint(initializer.screenX, initializer.screenY))
-#if ENABLE(POINTER_LOCK)
     , m_movementDelta(IntPoint(0, 0))
-#endif
 {
     ASSERT_UNUSED(isTrusted, isTrusted == IsTrusted::No);
     init(false, IntPoint(0, 0));

Modified: branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.h (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.h	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/dom/MouseRelatedEvent.h	2022-04-09 00:13:51 UTC (rev 292656)
@@ -48,10 +48,9 @@
     const IntPoint& screenLocation() const { return m_screenLocation; }
     int clientX() const { return m_clientLocation.x(); }
     int clientY() const { return m_clientLocation.y(); }
-#if ENABLE(POINTER_LOCK)
     int movementX() const { return m_movementDelta.x(); }
     int movementY() const { return m_movementDelta.y(); }
-#endif
+
     const LayoutPoint& clientLocation() const { return m_clientLocation; }
     int layerX() override;
     int layerY() override;
@@ -95,9 +94,7 @@
     // Expose these so MouseEvent::initMouseEvent can set them.
     IntPoint m_screenLocation;
     LayoutPoint m_clientLocation;
-#if ENABLE(POINTER_LOCK)
     LayoutPoint m_movementDelta;
-#endif
 
 private:
     void init(bool isSimulated, const IntPoint&);

Modified: branches/safari-613-branch/Source/WebCore/dom/PointerEvent.cpp (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/dom/PointerEvent.cpp	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/dom/PointerEvent.cpp	2022-04-09 00:13:51 UTC (rev 292656)
@@ -92,7 +92,7 @@
 }
 
 PointerEvent::PointerEvent(const AtomString& type, short button, const MouseEvent& mouseEvent, PointerID pointerId, const String& pointerType)
-    : MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), mouseEvent.view(), mouseEvent.detail(), mouseEvent.screenLocation(), { mouseEvent.clientX(), mouseEvent.clientY() }, mouseEvent.modifierKeys(), button, mouseEvent.buttons(), mouseEvent.syntheticClickType(), mouseEvent.relatedTarget())
+    : MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), mouseEvent.view(), mouseEvent.detail(), mouseEvent.screenLocation(), { mouseEvent.clientX(), mouseEvent.clientY() }, { mouseEvent.movementX(), mouseEvent.movementY() }, mouseEvent.modifierKeys(), button, mouseEvent.buttons(), mouseEvent.syntheticClickType(), mouseEvent.relatedTarget())
     , m_pointerId(pointerId)
     , m_pointerType(pointerType)
     , m_isPrimary(true)
@@ -100,7 +100,7 @@
 }
 
 PointerEvent::PointerEvent(const AtomString& type, PointerID pointerId, const String& pointerType, IsPrimary isPrimary)
-    : MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), nullptr, 0, { }, { }, { }, 0, 0, 0, nullptr)
+    : MouseEvent(type, typeCanBubble(type), typeIsCancelable(type), typeIsComposed(type), nullptr, 0, { }, { }, { }, { }, 0, 0, 0, nullptr)
     , m_pointerId(pointerId)
     , m_pointerType(pointerType)
     , m_isPrimary(isPrimary == IsPrimary::Yes)

Modified: branches/safari-613-branch/Source/WebCore/page/EventHandler.cpp (292655 => 292656)


--- branches/safari-613-branch/Source/WebCore/page/EventHandler.cpp	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Source/WebCore/page/EventHandler.cpp	2022-04-09 00:13:51 UTC (rev 292656)
@@ -2265,12 +2265,7 @@
 
     auto dragEvent = DragEvent::create(eventType, Event::CanBubble::Yes, Event::IsCancelable::Yes, Event::IsComposed::Yes,
         event.timestamp().approximateMonotonicTime(), &m_frame.windowProxy(), 0,
-        event.globalPosition(), event.position(),
-#if ENABLE(POINTER_LOCK)
-        event.movementDelta(),
-#else
-        { },
-#endif
+        event.globalPosition(), event.position(), event.movementDelta(),
         event.modifiers(), 0, 0, nullptr, event.force(), NoTap, &dataTransfer);
 
     dragTarget.dispatchEvent(dragEvent);

Modified: branches/safari-613-branch/Tools/ChangeLog (292655 => 292656)


--- branches/safari-613-branch/Tools/ChangeLog	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Tools/ChangeLog	2022-04-09 00:13:51 UTC (rev 292656)
@@ -1,3 +1,82 @@
+2022-04-07  Alan Coon  <[email protected]>
+
+        Cherry-pick r291886. rdar://problem/72814440
+
+    `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+    https://bugs.webkit.org/show_bug.cgi?id=220194
+    <rdar://problem/72814440>
+    
+    Reviewed by Simon Fraser.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt:
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    Source/WebCore:
+    
+    Test: pointer-lock/pointermove-movement-delta.html
+    
+    * dom/PointerEvent.cpp:
+    (WebCore::PointerEvent::PointerEvent):
+    Also pass along the movement delta in the constructor that takes a `MouseEvent`.
+    
+    * dom/MouseEvent.h:
+    * dom/MouseEvent.cpp:
+    (WebCore::MouseEvent::create):
+    (WebCore::MouseEvent::MouseEvent):
+    Require that all constructors that aren't invoked from JS always provide a movement delta.
+    
+    * dom/MouseRelatedEvent.h:
+    (WebCore::MouseRelatedEvent::movementX const):
+    (WebCore::MouseRelatedEvent::movementY const):
+    Expose these methods even when `!ENABLE(POINTER_LOCK)` so that they can be called without
+    the callsite having to also have a `#if`.
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchDragEvent):
+    Pass along the movement delta even when `!ENABLE(POINTER_LOCK)`.
+    
+    Tools:
+    
+    * DumpRenderTree/mac/EventSendingController.mm:
+    (-[EventSendingController mouseMoveToX:Y:]):
+    * WebKitTestRunner/mac/EventSenderProxy.mm:
+    (WTR::EventSenderProxy::mouseMoveTo):
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    LayoutTests:
+    
+    * pointer-lock/pointermove-movement-delta.html: Added.
+    * pointer-lock/pointermove-movement-delta-expected.txt: Added.
+    
+    * pointer-lock/mouse-event-delivery-expected.txt: Added.
+    On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+    
+    * platform/gtk/imported/w3c/web-platform-tests/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock-expected.txt: Added.
+    This change causes the test to progress further than before, but there still appear to be
+    other issues elsewhere, so adjust the expected output to reflect that.
+    
+    * platform/mac-wk1/TestExpectations:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-25  Devin Rousso  <[email protected]>
+
+            `PointerEvent.movementX` always 0 (breaks https://noisecraft.app/)
+            https://bugs.webkit.org/show_bug.cgi?id=220194
+            <rdar://problem/72814440>
+
+            Reviewed by Simon Fraser.
+
+            * DumpRenderTree/mac/EventSendingController.mm:
+            (-[EventSendingController mouseMoveToX:Y:]):
+            * WebKitTestRunner/mac/EventSenderProxy.mm:
+            (WTR::EventSenderProxy::mouseMoveTo):
+            On macOS, the screen's origin is the bottom-left corner, so we need to flip the `deltaY`.
+
 2022-03-29  Alan Coon  <[email protected]>
 
         Cherry-pick r290371. rdar://problem/88652375

Modified: branches/safari-613-branch/Tools/DumpRenderTree/mac/EventSendingController.mm (292655 => 292656)


--- branches/safari-613-branch/Tools/DumpRenderTree/mac/EventSendingController.mm	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Tools/DumpRenderTree/mac/EventSendingController.mm	2022-04-09 00:13:51 UTC (rev 292656)
@@ -766,7 +766,7 @@
                                         pressure:0.0]);
     CGEventRef cgEvent = [event CGEvent];
     CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaX, newMousePosition.x - lastMousePosition.x);
-    CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaY, newMousePosition.y - lastMousePosition.y);
+    CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaY, -1 * (newMousePosition.y - lastMousePosition.y));
     event = retainPtr([NSEvent eventWithCGEvent:cgEvent]);
     lastMousePosition = newMousePosition;
 #else

Modified: branches/safari-613-branch/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (292655 => 292656)


--- branches/safari-613-branch/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2022-04-09 00:13:44 UTC (rev 292655)
+++ branches/safari-613-branch/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2022-04-09 00:13:51 UTC (rev 292656)
@@ -599,7 +599,7 @@
 
     CGEventRef cgEvent = event.CGEvent;
     CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaX, newMousePosition.x - m_position.x);
-    CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaY, newMousePosition.y - m_position.y);
+    CGEventSetIntegerValueField(cgEvent, kCGMouseEventDeltaY, -1 * (newMousePosition.y - m_position.y));
     event = [NSEvent eventWithCGEvent:cgEvent];
     m_position.x = newMousePosition.x;
     m_position.y = newMousePosition.y;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to