Title: [283555] trunk
Revision
283555
Author
[email protected]
Date
2021-10-05 09:57:27 -0700 (Tue, 05 Oct 2021)

Log Message

REGRESSION (r283335): Momentum scrolling is no longer locked to an axis
https://bugs.webkit.org/show_bug.cgi?id=231206

Reviewed by Wenson Hsieh.

Source/WebCore:

r283335 removed the line that constrained the scroll delta to an axis, so restore it.

This bug only manifested during the momentum phase because both EventDispatcher and
EventHandler send only non-momentum events through the filter. We should also filter
deltas on momentum events (webkit.org/b/231207).

Test: fast/scrolling/mac/momentum-axis-locking.html

* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::handleWheelEvent):

LayoutTests:

* fast/scrolling/mac/momentum-axis-locking-expected.txt: Added.
* fast/scrolling/mac/momentum-axis-locking.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283554 => 283555)


--- trunk/LayoutTests/ChangeLog	2021-10-05 16:46:59 UTC (rev 283554)
+++ trunk/LayoutTests/ChangeLog	2021-10-05 16:57:27 UTC (rev 283555)
@@ -1,3 +1,13 @@
+2021-10-05  Simon Fraser  <[email protected]>
+
+        REGRESSION (r283335): Momentum scrolling is no longer locked to an axis
+        https://bugs.webkit.org/show_bug.cgi?id=231206
+
+        Reviewed by Wenson Hsieh.
+
+        * fast/scrolling/mac/momentum-axis-locking-expected.txt: Added.
+        * fast/scrolling/mac/momentum-axis-locking.html: Added.
+
 2021-10-05  Alan Bujtas  <[email protected]>
 
         [IFC][Integration] Enable first-line style for modern line layout

Added: trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking-expected.txt (0 => 283555)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking-expected.txt	2021-10-05 16:57:27 UTC (rev 283555)
@@ -0,0 +1,6 @@
+
+Tests axis locking in the momentum wheel gesture phase
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html (0 => 283555)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-axis-locking.html	2021-10-05 16:57:27 UTC (rev 283555)
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+            width: 200%;
+        }
+    </style>
+    <script src=""
+    <script src=""
+    <script>
+        var jsTestIsAsync = true;
+        
+        var initialScrollX;
+        var initialScrollY;
+
+        async function resetScrollPositions(x, y)
+        {
+            window.scrollTo(x, y);
+            // Wait for scroll events to fire.
+            await UIHelper.renderingUpdate();
+        }
+        
+        async function testVerticalRubberband()
+        {
+            await resetScrollPositions(100, 0);
+            initialScrollX = window.scrollX;
+            
+            let scrollListener = () => {
+                if (window.scrollX != initialScrollX)
+                    testFailed('Horizontal scroll position ' + window.scrollX + ' is not ' + initialScrollX);
+            }
+
+            window.addEventListener('scroll', scrollListener);
+
+            eventSender.monitorWheelEvents();
+            eventSender.mouseMoveTo(100, 100);
+            // Scroll up with some sideways drift.
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -2, "began", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "begin");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(2, -3, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(1, -2, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
+            await UIHelper.waitForScrollCompletion();
+
+            window.removeEventListener('scroll', scrollListener);
+        }
+
+        async function testHorizontalRubberband()
+        {
+            await resetScrollPositions(0, 100);
+            initialScrollY = window.scrollY;
+
+            let scrollListener = () => {
+                if (window.scrollY != initialScrollY)
+                    testFailed('Vertical scroll position ' + window.scrollY + ' is not ' + initialScrollY);
+            }
+
+            window.addEventListener('scroll', scrollListener);
+
+            eventSender.monitorWheelEvents();
+            eventSender.mouseMoveTo(100, 100);
+            // Scroll right with some upwards drift.
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 0, "began", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, -1, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, -1, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 0, "none", "begin");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 1, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-3, 2, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(-2, 1, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
+            await UIHelper.waitForScrollCompletion();
+
+            window.removeEventListener('scroll', scrollListener);
+        }
+
+        async function scrollTest()
+        {
+            debug('');
+            debug('Tests axis locking in the momentum wheel gesture phase');
+
+            await testVerticalRubberband();
+            await testHorizontalRubberband();
+
+            finishJSTest();
+        }
+
+        window.addEventListener('load', () => {
+            setTimeout(scrollTest, 0);
+        }, false);
+    </script>
+</head>
+<body>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (283554 => 283555)


--- trunk/Source/WebCore/ChangeLog	2021-10-05 16:46:59 UTC (rev 283554)
+++ trunk/Source/WebCore/ChangeLog	2021-10-05 16:57:27 UTC (rev 283555)
@@ -1,3 +1,21 @@
+2021-10-05  Simon Fraser  <[email protected]>
+
+        REGRESSION (r283335): Momentum scrolling is no longer locked to an axis
+        https://bugs.webkit.org/show_bug.cgi?id=231206
+
+        Reviewed by Wenson Hsieh.
+
+        r283335 removed the line that constrained the scroll delta to an axis, so restore it.
+
+        This bug only manifested during the momentum phase because both EventDispatcher and
+        EventHandler send only non-momentum events through the filter. We should also filter
+        deltas on momentum events (webkit.org/b/231207).
+
+        Test: fast/scrolling/mac/momentum-axis-locking.html
+
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::handleWheelEvent):
+
 2021-10-05  Antti Koivisto  <[email protected]>
 
         [LFC][Integration] Introduce InlineBoxIterator

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (283554 => 283555)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-10-05 16:46:59 UTC (rev 283554)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-10-05 16:57:27 UTC (rev 283555)
@@ -176,6 +176,8 @@
     // Reset unapplied overscroll because we may decide to remove delta at various points and put it into this value.
     auto delta = std::exchange(m_unappliedOverscrollDelta, { });
     delta += eventDelta;
+    // FIXME: This replicates what WheelEventDeltaFilter does. We should apply that to events in all phases, and remove axis locking here (webkit.org/b/231207).
+    delta = deltaAlignedToDominantAxis(delta);
 
     auto momentumPhase = wheelEvent.momentumPhase();
     if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase::Began || momentumPhase == PlatformWheelEventPhase::Changed))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to