Title: [271072] trunk
Revision
271072
Author
[email protected]
Date
2020-12-23 10:51:36 -0800 (Wed, 23 Dec 2020)

Log Message

REGRESSION: Scroll snapping triggers body scroll
https://bugs.webkit.org/show_bug.cgi?id=220056
Source/WebCore:

<rdar://problem/72595482>

Reviewed by Wenson Hsieh.

ScrollController::handleWheelEvent() needs to return true to indicate that it
handled the event when it has been processed for scroll snap. If we don't do this,
the latching code thinks that no node handled the event so the latch times out.

Test: fast/scrolling/latching/scroll-snap-latching.html

* platform/cocoa/ScrollController.h:
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::handleWheelEvent):

LayoutTests:

Reviewed by Wenson Hsieh.

* fast/scrolling/latching/scroll-snap-latching-expected.txt: Added.
* fast/scrolling/latching/scroll-snap-latching.html: Added.
* platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271071 => 271072)


--- trunk/LayoutTests/ChangeLog	2020-12-23 18:51:07 UTC (rev 271071)
+++ trunk/LayoutTests/ChangeLog	2020-12-23 18:51:36 UTC (rev 271072)
@@ -1,5 +1,16 @@
 2020-12-23  Simon Fraser  <[email protected]>
 
+        REGRESSION: Scroll snapping triggers body scroll
+        https://bugs.webkit.org/show_bug.cgi?id=220056
+
+        Reviewed by Wenson Hsieh.
+
+        * fast/scrolling/latching/scroll-snap-latching-expected.txt: Added.
+        * fast/scrolling/latching/scroll-snap-latching.html: Added.
+        * platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt: Added.
+
+2020-12-23  Simon Fraser  <[email protected]>
+
         Standardize on "allows scrolling" terminology instead of asking about scrollbars
         https://bugs.webkit.org/show_bug.cgi?id=220111
 

Added: trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching-expected.txt (0 => 271072)


--- trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching-expected.txt	2020-12-23 18:51:36 UTC (rev 271072)
@@ -0,0 +1,11 @@
+Tests that scrolling in an overflow-scroll with scroll-snap doesn't fail to latch and scroll the document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching.html (0 => 271072)


--- trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/latching/scroll-snap-latching.html	2020-12-23 18:51:36 UTC (rev 271072)
@@ -0,0 +1,123 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+<style>
+    body {
+        height: 2000px;
+    }
+
+    .scroll-wrapper {
+        position: fixed;
+        left: 10px;
+        top: 10px;
+        width: 300px;
+        height: 500px;
+        background-color: silver;
+    }
+
+    #scroller {
+        width: 100%;
+        height: 100%;
+        overflow-y: auto;
+        overflow-x: hidden;
+        scroll-snap-type: y mandatory;
+        border: 1px solid black;
+    }
+
+    .inner-content {
+        margin: 20px;
+        width: auto;
+        height: 75%;
+        scroll-snap-align: center;
+        background-color: green;
+    }
+</style>
+<script src=""
+<script src=""
+<script>
+    jsTestIsAsync = true;
+
+    var overflowScrollEventCount = 0;
+    var windowScrollEventCount = 0;
+
+    function checkForScrolls()
+    {
+        shouldBeTrue('overflowScrollEventCount > 0');
+        shouldBe('windowScrollEventCount', '0');
+    }
+
+    async function sendWheelEvents()
+    {
+        eventSender.monitorWheelEvents();
+        eventSender.mouseMoveTo(100, 100);
+        // This sequence needs to be long enough (> resetLatchedStateTimeout or 100ms) to allow latching to time out.
+
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -2, 'changed', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -3, 'changed', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'begin');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue');
+        await UIHelper.renderingUpdate();
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+        
+        await UIHelper.waitForScrollCompletion();
+    }
+
+    async function scrollTest()
+    {
+        await sendWheelEvents();
+        checkForScrolls();
+        finishJSTest();
+    }
+
+    window.addEventListener('load', () => {
+        description("Tests that scrolling in an overflow-scroll with scroll-snap doesn't fail to latch and scroll the document");
+        
+        document.getElementById('scroller').addEventListener('scroll', () => {
+            ++overflowScrollEventCount;
+        }, false);
+
+        window.addEventListener('scroll', () => {
+            ++windowScrollEventCount;
+        }, false);
+
+        if (window.eventSender) {
+            setTimeout(scrollTest, 0);
+            return;
+        }
+        
+        finishJSTest();
+    }, false);
+</script>
+</head>
+<body>
+<div class="scroll-wrapper">
+    <div id="scroller">
+        <div class="inner-content"></div>
+        <div class="inner-content"></div>
+    </div>
+</div>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt (0 => 271072)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	2020-12-23 18:51:36 UTC (rev 271072)
@@ -0,0 +1,11 @@
+Tests that scrolling in an overflow-scroll with scroll-snap doesn't fail to latch and scroll the document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS overflowScrollEventCount > 0 is true
+FAIL windowScrollEventCount should be 0. Was 7.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (271071 => 271072)


--- trunk/Source/WebCore/ChangeLog	2020-12-23 18:51:07 UTC (rev 271071)
+++ trunk/Source/WebCore/ChangeLog	2020-12-23 18:51:36 UTC (rev 271072)
@@ -1,5 +1,23 @@
 2020-12-23  Simon Fraser  <[email protected]>
 
+        REGRESSION: Scroll snapping triggers body scroll
+        https://bugs.webkit.org/show_bug.cgi?id=220056
+        <rdar://problem/72595482>
+
+        Reviewed by Wenson Hsieh.
+
+        ScrollController::handleWheelEvent() needs to return true to indicate that it
+        handled the event when it has been processed for scroll snap. If we don't do this,
+        the latching code thinks that no node handled the event so the latch times out.
+
+        Test: fast/scrolling/latching/scroll-snap-latching.html
+
+        * platform/cocoa/ScrollController.h:
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::handleWheelEvent):
+
+2020-12-23  Simon Fraser  <[email protected]>
+
         Standardize on "allows scrolling" terminology instead of asking about scrollbars
         https://bugs.webkit.org/show_bug.cgi?id=220111
 

Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.h (271071 => 271072)


--- trunk/Source/WebCore/platform/cocoa/ScrollController.h	2020-12-23 18:51:07 UTC (rev 271071)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.h	2020-12-23 18:51:36 UTC (rev 271072)
@@ -139,6 +139,7 @@
     ~ScrollController();
 
 #if PLATFORM(MAC)
+    // Returns true if handled.
     bool handleWheelEvent(const PlatformWheelEvent&);
 #endif
 
@@ -167,6 +168,7 @@
     void updateGestureInProgressState(const PlatformWheelEvent&);
     float adjustScrollDestinationForDirectionalSnapping(ScrollEventAxis, float destination, float velocity, float originalPosition);
 #if PLATFORM(MAC)
+    // Returns true if handled.
     bool processWheelEventForScrollSnap(const PlatformWheelEvent&);
 #endif
 #endif

Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.mm (271071 => 271072)


--- trunk/Source/WebCore/platform/cocoa/ScrollController.mm	2020-12-23 18:51:07 UTC (rev 271071)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.mm	2020-12-23 18:51:36 UTC (rev 271072)
@@ -121,7 +121,7 @@
 {
 #if ENABLE(CSS_SCROLL_SNAP)
     if (processWheelEventForScrollSnap(wheelEvent))
-        return false; // FIXME: Why don't we report that we handled it?
+        return true;
 #endif
     if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Cancelled)
         return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to