Title: [259162] trunk
Revision
259162
Author
[email protected]
Date
2020-03-28 10:22:50 -0700 (Sat, 28 Mar 2020)

Log Message

Sideways jiggles when scrolling the shelves on beta.music.apple.com
https://bugs.webkit.org/show_bug.cgi?id=209696
<rdar://problem/55092050>

Reviewed by Anders Carlsson.
Source/WebCore:

If a scroll snapping animation was running, EventHandler::platformNotifyIfEndGesture() would
reset the latching state. This was added in r190423, but not longer seems necessary
according to manual testing, and the passing layout test.

platformNotifyIfEndGesture() would be called at the end of the fingers-down scroll but
before momentum, and resetting latching here would cause the momentum events to go to
a new target, triggering incorrect scrolls.

Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::platformNotifyIfEndGesture):

LayoutTests:

Test that sends scroll and momentum events to a vertically-scrolling overflow with snap-points,
which checked that the document didn't scroll.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching-expected.txt: Added.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259161 => 259162)


--- trunk/LayoutTests/ChangeLog	2020-03-28 17:22:45 UTC (rev 259161)
+++ trunk/LayoutTests/ChangeLog	2020-03-28 17:22:50 UTC (rev 259162)
@@ -1,3 +1,17 @@
+2020-03-27  Simon Fraser  <[email protected]>
+
+        Sideways jiggles when scrolling the shelves on beta.music.apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=209696
+        <rdar://problem/55092050>
+
+        Reviewed by Anders Carlsson.
+
+        Test that sends scroll and momentum events to a vertically-scrolling overflow with snap-points,
+        which checked that the document didn't scroll.
+
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching-expected.txt: Added.
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html: Added.
+
 2020-03-28  Antti Koivisto  <[email protected]>
 
         Nullptr crash in InlineTextBox::emphasisMarkExistsAndIsAbove

Added: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching-expected.txt (0 => 259162)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching-expected.txt	2020-03-28 17:22:50 UTC (rev 259162)
@@ -0,0 +1,11 @@
+Tests that latching is not recomputed between the scroll and momentum phases, which triggers a document scroll.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS targetScroller.scrollTop is targetScroller.clientHeight
+PASS document.scrollingElement.scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html (0 => 259162)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html	                        (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html	2020-03-28 17:22:50 UTC (rev 259162)
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+        }
+        #scroller {
+            width: 300px;
+            height: 300px;
+            overflow-x: hidden;
+            overflow-y: auto;
+            margin: 20px;
+            scroll-snap-type: y mandatory;
+        }
+        #scroller > div {
+            height: 100%;
+            width: 100%;
+            scroll-snap-align: start;
+        }
+    </style>
+    <script src=""
+    <script>
+    jsTestIsAsync = true;
+
+    var targetScroller;
+
+    function checkEndState()
+    {
+        shouldBe('targetScroller.scrollTop', 'targetScroller.clientHeight');
+        shouldBe('document.scrollingElement.scrollTop', '0');
+        finishJSTest();
+    }
+
+    function scrollTest()
+    {
+        targetScroller = document.getElementById('scroller');
+
+        var targetRect = targetScroller.getBoundingClientRect();
+
+        var dx = 0;
+        var dy = -1;
+        var startPosX = targetRect.left + 50;
+        var startPosY = targetRect.top + 50;
+        eventSender.monitorWheelEvents();
+        eventSender.mouseMoveTo(startPosX, startPosY);
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'began', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'none', 'begin');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(dx, dy, 'none', 'continue');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+        eventSender.callAfterScrollingCompletes(checkEndState);
+    }
+
+    function startTest()
+    {
+        description('Tests that latching is not recomputed between the scroll and momentum phases, which triggers a document scroll.');
+        if (window.eventSender) {
+            internals.setPlatformMomentumScrollingPredictionEnabled(false);
+            setTimeout(scrollTest, 0);
+            return;
+        } 
+        
+        debug('This test requires eventSender');
+        finishJSTest();
+    }
+    
+    window.addEventListener('load', startTest, false);
+    </script>
+</head>
+<body>
+    <div id="scroller">
+        <div style="background-color: orange"></div>
+        <div style="background-color: green"></div>
+        <div style="background-color: blue"></div>
+        <div style="background-color: aqua"></div>
+        <div style="background-color: yellow"></div>
+        <div style="background-color: fuchsia"></div>
+    </div>
+    <div id="console"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (259161 => 259162)


--- trunk/Source/WebCore/ChangeLog	2020-03-28 17:22:45 UTC (rev 259161)
+++ trunk/Source/WebCore/ChangeLog	2020-03-28 17:22:50 UTC (rev 259162)
@@ -1,5 +1,26 @@
 2020-03-27  Simon Fraser  <[email protected]>
 
+        Sideways jiggles when scrolling the shelves on beta.music.apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=209696
+        <rdar://problem/55092050>
+
+        Reviewed by Anders Carlsson.
+        
+        If a scroll snapping animation was running, EventHandler::platformNotifyIfEndGesture() would
+        reset the latching state. This was added in r190423, but not longer seems necessary
+        according to manual testing, and the passing layout test.
+        
+        platformNotifyIfEndGesture() would be called at the end of the fingers-down scroll but
+        before momentum, and resetting latching here would cause the momentum events to go to
+        a new target, triggering incorrect scrolls.
+
+        Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-phase-change-relatching.html
+
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::platformNotifyIfEndGesture):
+
+2020-03-27  Simon Fraser  <[email protected]>
+
         Define ENABLE_WHEEL_EVENT_LATCHING and use it to wrap wheel event latching code
         https://bugs.webkit.org/show_bug.cgi?id=209693
 

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (259161 => 259162)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-03-28 17:22:45 UTC (rev 259161)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-03-28 17:22:50 UTC (rev 259162)
@@ -1105,11 +1105,8 @@
         return;
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    if (ScrollAnimator* scrollAnimator = scrollableArea->existingScrollAnimator()) {
+    if (ScrollAnimator* scrollAnimator = scrollableArea->existingScrollAnimator())
         scrollAnimator->processWheelEventForScrollSnap(wheelEvent);
-        if (scrollAnimator->isScrollSnapInProgress())
-            clearLatchedState();
-    }
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to