Title: [287431] trunk
Revision
287431
Author
[email protected]
Date
2021-12-24 13:02:24 -0800 (Fri, 24 Dec 2021)

Log Message

Apply the scroll delta in the "began" wheel event
https://bugs.webkit.org/show_bug.cgi?id=234645

Reviewed by Wenson Hsieh.

Source/WebCore:

ScrollingEffectsController::handleWheelEvent() previously early returned without applying
the delta in the "Began" event, which means that scrolling started a frame later than it
should have. For snappier scrolling in Safari, we should apply this delta.

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

Source/WebKit:

* Shared/WebWheelEventCoalescer.cpp:
(WebKit::WebWheelEventCoalescer::nextEventToDispatch): Fix logging typo.

LayoutTests:

Fix various test issues, and rebase tests affected by the change.

* fast/scrolling/iframe-scrollable-after-back.html:
* fast/scrolling/overflow-scrollable-after-back.html: Applying the delta from the "began" event caused
    multiple scroll events to fire, triggering multiple navigations (previously, event coalescing would result in a single
    scroll for multiple "changed" events).
    Fix by using UIHelper.mouseWheelScrollAt() and logging the scroll only once.
* fast/scrolling/latching/iframe-latch-small-deltas-expected.txt: Accumulated offset includes "began" delta.
* fast/scrolling/latching/iframe-latch-small-deltas.html: Ditto
* fast/scrolling/latching/latching-and-wheel-events-expected.txt: Ditto
* fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto
* fast/scrolling/mac/momentum-animator-in-overflow.html: Remove comment.
* fast/scrolling/mac/momentum-animator-maybegin-stops.html: Ditto
* fast/scrolling/mac/momentum-animator.html: Ditto
* fast/scrolling/mac/momentum-event-sequence-expected.txt: Accumulated offset includes "began" delta.
* fast/scrolling/mac/momentum-event-sequence.html: Accumulated offset includes "began" delta.
* fast/scrolling/mac/rubberband-overflow-in-wheel-region.html: Wheel event coalescing resulted in
    unpredictable behavior, so ensure there is one.
* platform/mac-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt: Removed.
* platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt: Accumulated offset includes "began" delta.
* platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto
* scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow-expected.txt: Ditto
* scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html: Ditto
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt: Ditto
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt: Ditto
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt: Ditto
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Test was designed with overlay scrollbars,
allowing for some between-snapoint slow that allowed an x delta to get applied. Fix to make room for scrollbars so that
snapping is always predictable.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287430 => 287431)


--- trunk/LayoutTests/ChangeLog	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/ChangeLog	2021-12-24 21:02:24 UTC (rev 287431)
@@ -1,3 +1,40 @@
+2021-12-24  Simon Fraser  <[email protected]>
+
+        Apply the scroll delta in the "began" wheel event
+        https://bugs.webkit.org/show_bug.cgi?id=234645
+
+        Reviewed by Wenson Hsieh.
+
+        Fix various test issues, and rebase tests affected by the change.
+
+        * fast/scrolling/iframe-scrollable-after-back.html:
+        * fast/scrolling/overflow-scrollable-after-back.html: Applying the delta from the "began" event caused
+            multiple scroll events to fire, triggering multiple navigations (previously, event coalescing would result in a single
+            scroll for multiple "changed" events).
+            Fix by using UIHelper.mouseWheelScrollAt() and logging the scroll only once.
+        * fast/scrolling/latching/iframe-latch-small-deltas-expected.txt: Accumulated offset includes "began" delta.
+        * fast/scrolling/latching/iframe-latch-small-deltas.html: Ditto
+        * fast/scrolling/latching/latching-and-wheel-events-expected.txt: Ditto
+        * fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto
+        * fast/scrolling/mac/momentum-animator-in-overflow.html: Remove comment.
+        * fast/scrolling/mac/momentum-animator-maybegin-stops.html: Ditto
+        * fast/scrolling/mac/momentum-animator.html: Ditto
+        * fast/scrolling/mac/momentum-event-sequence-expected.txt: Accumulated offset includes "began" delta.
+        * fast/scrolling/mac/momentum-event-sequence.html: Accumulated offset includes "began" delta.
+        * fast/scrolling/mac/rubberband-overflow-in-wheel-region.html: Wheel event coalescing resulted in
+            unpredictable behavior, so ensure there is one.
+        * platform/mac-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt: Removed.
+        * platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt: Accumulated offset includes "began" delta.
+        * platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto
+        * scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow-expected.txt: Ditto
+        * scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html: Ditto
+        * tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt: Ditto
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt: Ditto
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt: Ditto
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Test was designed with overlay scrollbars,
+        allowing for some between-snapoint slow that allowed an x delta to get applied. Fix to make room for scrollbars so that
+        snapping is always predictable.
+
 2021-12-24  Tim Nguyen  <[email protected]>
 
         Unreviewed, r287356 followups and rebaselining for glib

Modified: trunk/LayoutTests/fast/scrolling/iframe-scrollable-after-back.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/iframe-scrollable-after-back.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/iframe-scrollable-after-back.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -16,6 +16,7 @@
             background-image: linear-gradient(white, gray)
         }
     </style>
+    <script src=""
     <script>
         if (window.testRunner) {
             testRunner.dumpAsText();
@@ -28,38 +29,30 @@
         }
 
         var scrollTopBeforeScroll;
-        var postScrollCallback;
+        var scrollTopAfterScroll;
 
         function iframeScrolled()
         {
-            var newScrollTop = document.getElementById('iframe').contentDocument.scrollingElement.scrollTop;
-            if (newScrollTop > scrollTopBeforeScroll)
-                logResult('PASS: mouseWheel caused scrolling');
-            else
-                logResult('FAIL; mouseWheel did not scroll; scrollTop is ' + newScrollTop + ', was ' + scrollTopBeforeScroll);
-
-            if (postScrollCallback)
-                postScrollCallback();
+            scrollTopAfterScroll = document.getElementById('iframe').contentDocument.scrollingElement.scrollTop;
         }
         
-        function testScrollability(completionHandler)
+        async function testScrollability()
         {
             var iframeTarget = document.getElementById('iframe');
             var iframeBounds = iframeTarget.getBoundingClientRect();
-            
+
             scrollTopBeforeScroll = iframeTarget.contentDocument.scrollingElement.scrollTop;
             logResult('Sending mouseWheel events');
 
-            eventSender.mouseMoveTo(iframeBounds.left + 10, iframeBounds.top + 10);
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+            await UIHelper.mouseWheelScrollAt(iframeBounds.left + 10, iframeBounds.top + 10, 0, -1, 0, -1);
 
-            postScrollCallback = completionHandler;
+            if (scrollTopAfterScroll > scrollTopBeforeScroll)
+                logResult('PASS: mouseWheel caused scrolling');
+            else
+                logResult('FAIL; mouseWheel did not scroll; scrollTop is ' + scrollTopAfterScroll + ', was ' + scrollTopBeforeScroll);
         }
         
-        function startTest()
+        async function startTest()
         {
             if (!window.eventSender) {
                 logResult('This test must be run in DumpRenderTree/WebKitTestRunner');
@@ -66,22 +59,19 @@
                 return;
             }
 
-            testScrollability(function() {
-                window.setTimeout(function() {
-                    logResult('\nNavigating forward then back\n');
-                    window.location.href = "" _onload_='history.back()'></body>";
-                }, 0);
-            });
-            
+            await testScrollability();
+            setTimeout(() => {
+                logResult('\nNavigating forward then back\n');
+                window.location.href = "" _onload_='history.back()'></body>";
+            }, 0);
         }
         
         var showCount = 0;
-        function pageShowed()
+        async function pageShowed()
         {
             if (++showCount == 2) {
-                testScrollability(function() {
-                    testRunner.notifyDone();
-                });
+                await testScrollability();
+                testRunner.notifyDone();
             }
         }
         

Modified: trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -7,13 +7,13 @@
 PASS iframeTarget.contentWindow.pageYOffset is 0
 PASS window.pageYOffset is 200
 After scroll
-PASS iframeTarget.contentWindow.pageYOffset is 400
+PASS iframeTarget.contentWindow.pageYOffset is 410
 PASS window.pageYOffset is 200
 After wait
+PASS iframeTarget.contentWindow.pageYOffset is 410
+PASS window.pageYOffset is 200
 PASS iframeTarget.contentWindow.pageYOffset is 400
 PASS window.pageYOffset is 200
-PASS iframeTarget.contentWindow.pageYOffset is 380
-PASS window.pageYOffset is 200
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/latching/iframe-latch-small-deltas.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -38,13 +38,13 @@
             await UIHelper.waitForScrollCompletion();
 
             debug('After scroll');
-            shouldBe('iframeTarget.contentWindow.pageYOffset', '400');
+            shouldBe('iframeTarget.contentWindow.pageYOffset', '410');
             shouldBe('window.pageYOffset', '200');
 
             await UIHelper.animationFrame();
 
             debug('After wait');
-            shouldBe('iframeTarget.contentWindow.pageYOffset', '400');
+            shouldBe('iframeTarget.contentWindow.pageYOffset', '410');
             shouldBe('window.pageYOffset', '200');
 
             eventSender.monitorWheelEvents({ resetLatching: false });
@@ -54,7 +54,7 @@
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
 
             await UIHelper.waitForScrollCompletion();
-            shouldBe('iframeTarget.contentWindow.pageYOffset', '380');
+            shouldBe('iframeTarget.contentWindow.pageYOffset', '400');
             shouldBe('window.pageYOffset', '200');
 
             finishJSTest();

Modified: trunk/LayoutTests/fast/scrolling/latching/latching-and-wheel-events-expected.txt (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -13,7 +13,7 @@
 PASS overflowInIframeWheelEventCount is 0
 After scroll
 FAIL iframeTarget.contentWindow.pageYOffset should be 0. Was 100.
-FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 210.
 PASS window.pageYOffset is 20
 PASS mainFrameWheelEventCount is 0
 PASS iframeWindowWheelEventCount is 2

Modified: trunk/LayoutTests/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -9,7 +9,7 @@
 PASS window.pageYOffset is 20
 After scroll
 FAIL iframeTarget.contentWindow.pageYOffset should be 0. Was 100.
-FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 210.
 PASS window.pageYOffset is 20
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-animator-in-overflow.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-animator-in-overflow.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-animator-in-overflow.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -33,7 +33,7 @@
                         type : "wheel",
                         viewX : 100,
                         viewY : 100,
-                        deltaY : -10, // Note that this delta is currently ignored.
+                        deltaY : -10,
                         phase : "began"
                     },
                     {

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -24,7 +24,7 @@
                     type : "wheel",
                     viewX : 100,
                     viewY : 100,
-                    deltaY : -10, // Note that this delta is currently ignored.
+                    deltaY : -10,
                     phase : "began"
                 },
                 {

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-animator.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-animator.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-animator.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -20,7 +20,7 @@
                         type : "wheel",
                         viewX : 100,
                         viewY : 100,
-                        deltaY : -10, // Note that this delta is currently ignored.
+                        deltaY : -10,
                         phase : "began"
                     },
                     {

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence-expected.txt (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -1,4 +1,4 @@
-PASS window.scrollY is 46
+PASS window.scrollY is 56
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/momentum-event-sequence.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -20,7 +20,7 @@
                         type : "wheel",
                         viewX : 100,
                         viewY : 100,
-                        deltaY : -10, // Note that this delta is currently ignored.
+                        deltaY : -10,
                         phase : "began"
                     },
                     {
@@ -60,7 +60,7 @@
             };
 
             await UIHelper.mouseWheelSequence(wheelEventSquence);
-            shouldBe('window.scrollY', '46');
+            shouldBe('window.scrollY', '56');
         }
 
         async function scrollTest()

Modified: trunk/LayoutTests/fast/scrolling/mac/rubberband-overflow-in-wheel-region.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/mac/rubberband-overflow-in-wheel-region.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/mac/rubberband-overflow-in-wheel-region.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -46,13 +46,48 @@
         async function doMouseWheelScroll()
         {
             eventSender.mouseMoveTo(100, 100);
+
             // Scroll down to latch, then up to rubberband.
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "began", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 12, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 12, "changed", "none");
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+            const wheelEventSquence = {
+                "events" : [
+                    {
+                        type : "wheel",
+                        viewX : 100,
+                        viewY : 100,
+                        deltaX : -10,
+                        phase : "began"
+                    },
+                    {
+                        type : "wheel",
+                        deltaX : -100,
+                        phase : "changed"
+                    },
+                    {
+                        type : "wheel",
+                        viewX : 101, // defeat coalescing
+                        deltaX : -100,
+                        phase : "changed"
+                    },
+                    {
+                        type : "wheel",
+                        viewX : 100, // defeat coalescing
+                        deltaY : 120,
+                        phase : "changed"
+                    },
+                    {
+                        type : "wheel",
+                        viewX : 101, // defeat coalescing
+                        deltaY : 120,
+                        phase : "changed"
+                    },
+                    {
+                        type : "wheel",
+                        phase : "ended"
+                    }
+                ]
+            };
+
+            await UIHelper.sendEventStream(wheelEventSquence);
             await UIHelper.renderingUpdate();
         }
         
@@ -61,6 +96,7 @@
             debug('');
             debug('Test rubberband of overflow:scroll inside the non-fast scrollable region');
             await resetScrollPositions();
+
             await doMouseWheelScroll();
 
             shouldBecomeEqual('sawOverflowScrollWithNegativeOffset', 'true', finishJSTest);

Modified: trunk/LayoutTests/fast/scrolling/overflow-scrollable-after-back.html (287430 => 287431)


--- trunk/LayoutTests/fast/scrolling/overflow-scrollable-after-back.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/fast/scrolling/overflow-scrollable-after-back.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -16,6 +16,7 @@
             background-image: linear-gradient(white, gray)
         }
     </style>
+    <script src=""
     <script>
         if (window.testRunner) {
             testRunner.dumpAsText();
@@ -28,39 +29,30 @@
         }
 
         var scrollTopBeforeScroll;
-        var postScrollCallback;
+        var scrollTopAfterScroll;
 
         function divScrolled()
         {
-            var newScrollTop = document.getElementById('overflowing').scrollTop;
-
-            if (newScrollTop > scrollTopBeforeScroll)
-                logResult('PASS: mouseWheel caused scrolling');
-            else
-                logResult('FAIL; mouseWheel did not scroll; scrollTop is ' + newScrollTop + ', was ' + scrollTopBeforeScroll);
-
-            if (postScrollCallback)
-                postScrollCallback();
+            scrollTopAfterScroll = document.getElementById('overflowing').scrollTop;
         }
         
-        function testScrollability(completionHandler)
+        async function testScrollability()
         {
             var divTarget = document.getElementById('overflowing');
             var divBounds = divTarget.getBoundingClientRect();
-            
+
             scrollTopBeforeScroll = divTarget.scrollTop;
             logResult('Sending mouseWheel events');
 
-            eventSender.mouseMoveTo(divBounds.left + 10, divBounds.top + 10);
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+            await UIHelper.mouseWheelScrollAt(divBounds.left + 10, divBounds.top + 10, 0, -1, 0, -1);
 
-            postScrollCallback = completionHandler;
+            if (scrollTopAfterScroll > scrollTopBeforeScroll)
+                logResult('PASS: mouseWheel caused scrolling');
+            else
+                logResult('FAIL; mouseWheel did not scroll; scrollTop is ' + scrollTopAfterScroll + ', was ' + scrollTopBeforeScroll);
         }
         
-        function startTest()
+        async function startTest()
         {
             if (!window.eventSender) {
                 logResult('This test must be run in DumpRenderTree/WebKitTestRunner');
@@ -67,22 +59,19 @@
                 return;
             }
 
-            testScrollability(function() {
-                window.setTimeout(function() {
-                    logResult('\nNavigating forward then back\n');
-                    window.location.href = "" _onload_='history.back()'></body>";
-                }, 0);
-            });
-            
+            await testScrollability();
+            setTimeout(() => {
+                logResult('\nNavigating forward then back\n');
+                window.location.href = "" _onload_='history.back()'></body>";
+            }, 0);
         }
         
         var showCount = 0;
-        function pageShowed()
+        async function pageShowed()
         {
             if (++showCount == 2) {
-                testScrollability(function() {
-                    testRunner.notifyDone();
-                });
+                await testScrollability();
+                testRunner.notifyDone();
             }
         }
         

Modified: trunk/LayoutTests/platform/mac-catalina-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt (287430 => 287431)


--- trunk/LayoutTests/platform/mac-catalina-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/platform/mac-catalina-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -7,12 +7,12 @@
 PASS iframeTarget.contentWindow.pageYOffset is 0
 PASS window.pageYOffset is 200
 After scroll
-FAIL iframeTarget.contentWindow.pageYOffset should be 400. Was 205.
+FAIL iframeTarget.contentWindow.pageYOffset should be 410. Was 205.
 PASS window.pageYOffset is 200
 After wait
-FAIL iframeTarget.contentWindow.pageYOffset should be 400. Was 205.
+FAIL iframeTarget.contentWindow.pageYOffset should be 410. Was 205.
 PASS window.pageYOffset is 200
-FAIL iframeTarget.contentWindow.pageYOffset should be 380. Was 200.
+FAIL iframeTarget.contentWindow.pageYOffset should be 400. Was 200.
 PASS window.pageYOffset is 200
 PASS successfullyParsed is true
 

Deleted: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt (287430 => 287431)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/iframe-latch-small-deltas-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -1,20 +0,0 @@
-
-Tests that a second scroll with small x/y deltas uses latching from an earlier scroll.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS iframeTarget.contentWindow.pageYOffset is 0
-PASS window.pageYOffset is 200
-After scroll
-FAIL iframeTarget.contentWindow.pageYOffset should be 400. Was 410.
-PASS window.pageYOffset is 200
-After wait
-FAIL iframeTarget.contentWindow.pageYOffset should be 400. Was 410.
-PASS window.pageYOffset is 200
-FAIL iframeTarget.contentWindow.pageYOffset should be 380. Was 400.
-PASS window.pageYOffset is 200
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt (287430 => 287431)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -13,7 +13,7 @@
 PASS overflowInIframeWheelEventCount is 0
 After scroll
 FAIL iframeTarget.contentWindow.pageYOffset should be 0. Was 100.
-FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 210.
 PASS window.pageYOffset is 20
 PASS mainFrameWheelEventCount is 0
 FAIL iframeWindowWheelEventCount should be 2. Was 3.

Modified: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt (287430 => 287431)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -9,7 +9,7 @@
 PASS window.pageYOffset is 20
 After scroll
 FAIL iframeTarget.contentWindow.pageYOffset should be 0. Was 100.
-FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 210.
 PASS window.pageYOffset is 20
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow-expected.txt (287430 => 287431)


--- trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -4,7 +4,7 @@
 PASS outerScroller.scrollTop is 0
 PASS innerScroller.scrollTop is 0
 After scrolll
-PASS outerScroller.scrollTop is 200
+PASS outerScroller.scrollTop is 210
 PASS innerScroller.scrollTop is 0
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html (287430 => 287431)


--- trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-in-vertical-overflow.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -43,7 +43,7 @@
         function checkForScroll()
         {
             debug('After scrolll');
-            shouldBe('outerScroller.scrollTop', '200');
+            shouldBe('outerScroller.scrollTop', '210');
             shouldBe('innerScroller.scrollTop', '0');
 
             finishJSTest();

Modified: trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt (287430 => 287431)


--- trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -15,8 +15,8 @@
 (GraphicsLayer
   (anchor 0.00 0.00)
   (bounds 2008.00 2236.00)
-  (visible rect 0.00, 70.00 785.00 x 585.00)
-  (coverage rect 0.00, 70.00 785.00 x 585.00)
+  (visible rect 0.00, 80.00 785.00 x 585.00)
+  (coverage rect 0.00, 80.00 785.00 x 585.00)
   (intersects coverage rect 1)
   (contentsScale 1.00)
   (children 1
@@ -23,7 +23,7 @@
     (GraphicsLayer
       (bounds 2008.00 2236.00)
       (contentsOpaque 1)
-      (visible rect 0.00, 70.00 785.00 x 585.00)
+      (visible rect 0.00, 80.00 785.00 x 585.00)
       (coverage rect 0.00, 0.00 1570.00 x 1755.00)
       (intersects coverage rect 1)
       (contentsScale 1.00)

Modified: trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt (287430 => 287431)


--- trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -12,8 +12,8 @@
 (GraphicsLayer
   (anchor 0.00 0.00)
   (bounds 785.00 2266.00)
-  (visible rect 0.00, 70.00 785.00 x 600.00)
-  (coverage rect 0.00, 70.00 785.00 x 600.00)
+  (visible rect 0.00, 80.00 785.00 x 600.00)
+  (coverage rect 0.00, 80.00 785.00 x 600.00)
   (intersects coverage rect 1)
   (contentsScale 1.00)
   (children 1
@@ -20,7 +20,7 @@
     (GraphicsLayer
       (bounds 785.00 2266.00)
       (contentsOpaque 1)
-      (visible rect 0.00, 70.00 785.00 x 600.00)
+      (visible rect 0.00, 80.00 785.00 x 600.00)
       (coverage rect 0.00, 0.00 785.00 x 1800.00)
       (intersects coverage rect 1)
       (contentsScale 1.00)

Modified: trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt (287430 => 287431)


--- trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -14,8 +14,8 @@
 (GraphicsLayer
   (anchor 0.00 0.00)
   (bounds 2008.00 2266.00)
-  (visible rect 0.00, 70.00 785.00 x 585.00)
-  (coverage rect 0.00, 70.00 785.00 x 585.00)
+  (visible rect 0.00, 80.00 785.00 x 585.00)
+  (coverage rect 0.00, 80.00 785.00 x 585.00)
   (intersects coverage rect 1)
   (contentsScale 1.00)
   (children 1
@@ -22,7 +22,7 @@
     (GraphicsLayer
       (bounds 2008.00 2266.00)
       (contentsOpaque 1)
-      (visible rect 0.00, 70.00 785.00 x 585.00)
+      (visible rect 0.00, 80.00 785.00 x 585.00)
       (coverage rect 0.00, 0.00 1570.00 x 1755.00)
       (intersects coverage rect 1)
       (contentsScale 1.00)

Modified: trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt (287430 => 287431)


--- trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt	2021-12-24 21:02:24 UTC (rev 287431)
@@ -14,8 +14,8 @@
 (GraphicsLayer
   (anchor 0.00 0.00)
   (bounds 2008.00 2221.00)
-  (visible rect 0.00, 70.00 785.00 x 585.00)
-  (coverage rect 0.00, 70.00 785.00 x 585.00)
+  (visible rect 0.00, 80.00 785.00 x 585.00)
+  (coverage rect 0.00, 80.00 785.00 x 585.00)
   (intersects coverage rect 1)
   (contentsScale 1.00)
   (children 1
@@ -22,7 +22,7 @@
     (GraphicsLayer
       (bounds 2008.00 2221.00)
       (contentsOpaque 1)
-      (visible rect 0.00, 70.00 785.00 x 585.00)
+      (visible rect 0.00, 80.00 785.00 x 585.00)
       (coverage rect 0.00, 0.00 1570.00 x 1755.00)
       (intersects coverage rect 1)
       (contentsScale 1.00)

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html (287430 => 287431)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html	2021-12-24 21:02:24 UTC (rev 287431)
@@ -3,8 +3,8 @@
     <head>
         <style>
             #grid-container {
-                width: 400px;
-                height: 400px;
+                width: 415px;
+                height: 415px;
                 overflow: scroll;
                 white-space: nowrap;
                 -webkit-overflow-scrolling: touch;

Modified: trunk/Source/WebCore/ChangeLog (287430 => 287431)


--- trunk/Source/WebCore/ChangeLog	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/Source/WebCore/ChangeLog	2021-12-24 21:02:24 UTC (rev 287431)
@@ -1,3 +1,19 @@
+2021-12-24  Simon Fraser  <[email protected]>
+
+        Apply the scroll delta in the "began" wheel event
+        https://bugs.webkit.org/show_bug.cgi?id=234645
+
+        Reviewed by Wenson Hsieh.
+
+        ScrollingEffectsController::handleWheelEvent() previously early returned without applying
+        the delta in the "Began" event, which means that scrolling started a frame later than it
+        should have. For snappier scrolling in Safari, we should apply this delta.
+
+        * platform/ScrollSnapAnimatorState.cpp:
+        (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::handleWheelEvent):
+
 2021-12-24  Tim Nguyen  <[email protected]>
 
         Unreviewed, r287356 followups and rebaselining for glib

Modified: trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp (287430 => 287431)


--- trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp	2021-12-24 21:02:24 UTC (rev 287431)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ScrollSnapAnimatorState.h"
 
+#include "Logging.h"
 #include "ScrollExtents.h"
 #include "ScrollingEffectsController.h"
 #include <wtf/MathExtras.h>
@@ -55,7 +56,7 @@
         float targetOffsetX, targetOffsetY;
         std::tie(targetOffsetX, m_activeSnapIndexX) = targetOffsetForStartOffset(ScrollEventAxis::Horizontal, scrollExtents, initialOffset.x(), targetOffset, pageScale, initialDelta.width());
         std::tie(targetOffsetY, m_activeSnapIndexY) = targetOffsetForStartOffset(ScrollEventAxis::Vertical, scrollExtents, initialOffset.y(), targetOffset, pageScale, initialDelta.height());
-
+        LOG_WITH_STREAM(ScrollAnimations, stream << "ScrollSnapAnimatorState::setupAnimationForState() - target offset " << targetOffset << " modified to " << FloatPoint(targetOffsetX, targetOffsetY));
         return FloatPoint { targetOffsetX, targetOffsetY };
     });
 

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (287430 => 287431)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-24 21:02:24 UTC (rev 287431)
@@ -141,7 +141,6 @@
 
         stopRubberBandAnimation();
         updateRubberBandingState();
-        return true;
     }
 
     if (wheelEvent.phase() == PlatformWheelEventPhase::Ended) {

Modified: trunk/Source/WebKit/ChangeLog (287430 => 287431)


--- trunk/Source/WebKit/ChangeLog	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/Source/WebKit/ChangeLog	2021-12-24 21:02:24 UTC (rev 287431)
@@ -1,3 +1,13 @@
+2021-12-24  Simon Fraser  <[email protected]>
+
+        Apply the scroll delta in the "began" wheel event
+        https://bugs.webkit.org/show_bug.cgi?id=234645
+
+        Reviewed by Wenson Hsieh.
+
+        * Shared/WebWheelEventCoalescer.cpp:
+        (WebKit::WebWheelEventCoalescer::nextEventToDispatch): Fix logging typo.
+
 2021-12-23  Wenson Hsieh  <[email protected]>
 
         Modal container control classifier fails on some neutral controls that contain multiplication symbols

Modified: trunk/Source/WebKit/Shared/WebWheelEventCoalescer.cpp (287430 => 287431)


--- trunk/Source/WebKit/Shared/WebWheelEventCoalescer.cpp	2021-12-24 20:20:17 UTC (rev 287430)
+++ trunk/Source/WebKit/Shared/WebWheelEventCoalescer.cpp	2021-12-24 21:02:24 UTC (rev 287431)
@@ -129,7 +129,7 @@
 
 #if !LOG_DISABLED
     if (coalescedSequence->size() > 1)
-        LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::wheelEventWithCoalescing coalsesced " << *coalescedSequence << " into " << coalescedWebEvent);
+        LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::wheelEventWithCoalescing coalesced " << *coalescedSequence << " into " << coalescedWebEvent);
 #endif
 
     m_eventsBeingProcessed.append(WTFMove(coalescedSequence));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to