Title: [275388] trunk
Revision
275388
Author
[email protected]
Date
2021-04-01 15:26:48 -0700 (Thu, 01 Apr 2021)

Log Message

Unreviewed, reverting r274381.
https://bugs.webkit.org/show_bug.cgi?id=224080

Caused stuttery select scrolling

Reverted changeset:

"Add basic (non-momentum) wheel event handling for scroll
snap"
https://bugs.webkit.org/show_bug.cgi?id=222594
https://trac.webkit.org/changeset/274381

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275387 => 275388)


--- trunk/LayoutTests/ChangeLog	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/LayoutTests/ChangeLog	2021-04-01 22:26:48 UTC (rev 275388)
@@ -1,3 +1,17 @@
+2021-04-01  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r274381.
+        https://bugs.webkit.org/show_bug.cgi?id=224080
+
+        Caused stuttery select scrolling
+
+        Reverted changeset:
+
+        "Add basic (non-momentum) wheel event handling for scroll
+        snap"
+        https://bugs.webkit.org/show_bug.cgi?id=222594
+        https://trac.webkit.org/changeset/274381
+
 2021-04-01  Chris Gambrell  <[email protected]>
 
         LayoutTests] Convert http/tests/download convert PHP to Python

Deleted: trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event-expected.txt (275387 => 275388)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event-expected.txt	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event-expected.txt	2021-04-01 22:26:48 UTC (rev 275388)
@@ -1,6 +0,0 @@
-PASS horizontal mouse wheel event snapped
-PASS vertical mouse wheel event snapped
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html (275387 => 275388)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-04-01 22:26:48 UTC (rev 275388)
@@ -1,80 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Simple wheel events should trigger scroll snapping</title>
-        <style type="text/css">
-            .container {
-                height: 200px;
-                width: 200px;
-                overflow: auto;
-                scroll-snap-type: both mandatory;
-            }
-
-            .horizontal-drawer {
-                height: 100%;
-                width: 500px;
-            }
-
-            .block {
-                height: 100%;
-                width: 200px;
-                scroll-snap-align: start;
-            }
-        </style>
-        <script src=""
-        <script src=""
-        <script>
-        window.jsTestIsAsync = true;
-
-        async function onLoad()
-        {
-            if (window.eventSender == undefined) {
-                document.getElementById('console').innerText = "Simple wheel events should trigger scroll snapping";
-                return;
-            }
-            try {
-                eventSender.mouseMoveTo(20, 190);
-                eventSender.mouseDown();
-                eventSender.mouseMoveTo(80, 190);
-                eventSender.mouseUp();
-
-                eventSender.mouseScrollBy(-1, 0);
-
-                let horizontalContainer = document.getElementById("horizontal-container");
-                await UIHelper.waitForTargetScrollAnimationToSettle(horizontalContainer);
-                expectTrue(horizontalContainer.scrollLeft == 200, "horizontal mouse wheel event snapped");
-
-                eventSender.mouseMoveTo(190, 220);
-                eventSender.mouseDown();
-                eventSender.mouseMoveTo(190, 270);
-                eventSender.mouseUp();
-
-                eventSender.mouseScrollBy(0, -1);
-
-                let verticalContainer = document.getElementById("vertical-container");
-                await UIHelper.waitForTargetScrollAnimationToSettle(verticalContainer);
-                expectTrue(verticalContainer.scrollTop == 185, "vertical mouse wheel event snapped");
-            } catch (e) {
-                console.log(e);
-            } finally {
-                finishJSTest();
-            }
-        }
-        </script>
-    </head>
-    <body _onload_="onLoad();">
-        <div id="horizontal-container" class="container">
-            <div class="horizontal-drawer">
-                <div class="block" style="float: left; background: #80475E"></div>
-                <div class="block" style="float: left; background: #CC5A71"></div>
-            </div>
-        </div>
-        <div id="vertical-container" class="container">
-            <div class="block" style="background: #80475E"></div>
-            <div class="block" style="background: #CC5A71"></div>
-        </div>
-        <p id="console"></p>
-        <script>
-        </script>
-    </body>
-</html>

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (275387 => 275388)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2021-04-01 22:26:48 UTC (rev 275388)
@@ -137,6 +137,7 @@
 scrollbars/scrollbars-on-positioned-content.html [ Failure ]
 css3/scroll-snap/scroll-padding-mainframe-paging.html [ Failure ]
 css3/scroll-snap/scroll-padding-overflow-paging.html [ Failure ]
+css3/scroll-snap/scroll-snap-click-scrollbar-gutter.html [ Failure ]
 
 # SVG tests that time out (these require EventSender)
 svg/animations/animVal-basics.html
@@ -932,8 +933,6 @@
 editing/selection/select-out-of-floated-non-editable-10.html [ Skip ]
 editing/selection/select-out-of-floated-non-editable-11.html [ Skip ]
 editing/selection/select-out-of-floated-non-editable-12.html [ Skip ]
-css3/scroll-snap/scroll-snap-click-scrollbar-gutter.html [ Skip ]
-css3/scroll-snap/scroll-snap-wheel-event.html [ Skip ]
 
 webkit.org/b/192088 media/no-fullscreen-when-hidden.html [ Failure Pass ]
 

Modified: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt (275387 => 275388)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	2021-04-01 22:26:48 UTC (rev 275388)
@@ -4,7 +4,7 @@
 
 
 PASS overflowScrollEventCount > 0 is true
-FAIL windowScrollEventCount should be 0. Was 11.
+FAIL windowScrollEventCount should be 0. Was 7.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (275387 => 275388)


--- trunk/Source/WebCore/ChangeLog	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/Source/WebCore/ChangeLog	2021-04-01 22:26:48 UTC (rev 275388)
@@ -1,3 +1,17 @@
+2021-04-01  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r274381.
+        https://bugs.webkit.org/show_bug.cgi?id=224080
+
+        Caused stuttery select scrolling
+
+        Reverted changeset:
+
+        "Add basic (non-momentum) wheel event handling for scroll
+        snap"
+        https://bugs.webkit.org/show_bug.cgi?id=222594
+        https://trac.webkit.org/changeset/274381
+
 2021-04-01  Rob Buis  <[email protected]>
 
         aspect-ratio not recomputed on hover

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (275387 => 275388)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-04-01 22:26:48 UTC (rev 275388)
@@ -81,19 +81,18 @@
 #endif
 }
 
-bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, OptionSet<ScrollBehavior> behavior)
+bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, ScrollBehavior behavior)
 {
 #if ENABLE(CSS_SCROLL_SNAP)
-    if (behavior.contains(ScrollBehavior::DoDirectionalSnapping)) {
+    if (behavior == ScrollBehavior::DoDirectionalSnapping) {
         auto newOffset = ScrollableArea::scrollOffsetFromPosition(positionFromStep(orientation, step, multiplier), toFloatSize(m_scrollableArea.scrollOrigin()));
         auto currentOffset = m_scrollableArea.scrollOffset();
-        behavior.remove(ScrollBehavior::DoDirectionalSnapping);
         if (orientation == HorizontalScrollbar) {
             newOffset.setX(m_scrollController.adjustScrollDestination(ScrollEventAxis::Horizontal, newOffset.x(), multiplier, currentOffset.x()));
-            return scroll(HorizontalScrollbar, granularity, newOffset.x() - currentOffset.x(), 1.0, behavior);
+            return scroll(HorizontalScrollbar, granularity, newOffset.x() - currentOffset.x(), 1.0);
         }
         newOffset.setY(m_scrollController.adjustScrollDestination(ScrollEventAxis::Vertical, newOffset.y(), multiplier, currentOffset.y()));
-        return scroll(VerticalScrollbar, granularity, newOffset.y() - currentOffset.y(), 1.0, behavior);
+        return scroll(VerticalScrollbar, granularity, newOffset.y() - currentOffset.y(), 1.0);
     }
 #else
     UNUSED_PARAM(granularity);
@@ -101,7 +100,7 @@
 #endif
 
 #if ENABLE(SMOOTH_SCROLLING) && !PLATFORM(IOS_FAMILY)
-    if (m_scrollableArea.scrollAnimatorEnabled() && !behavior.contains(ScrollBehavior::NeverAnimate)) {
+    if (m_scrollableArea.scrollAnimatorEnabled()) {
         m_scrollAnimation->setCurrentPosition(m_currentPosition);
         return m_scrollAnimation->scroll(orientation, granularity, step, multiplier);
     }
@@ -161,6 +160,10 @@
 
 #if ENABLE(CSS_SCROLL_SNAP)
 #if PLATFORM(MAC)
+bool ScrollAnimator::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent)
+{
+    return m_scrollController.processWheelEventForScrollSnap(wheelEvent);
+}
 #endif
 
 bool ScrollAnimator::activeScrollSnapIndexDidChange() const
@@ -176,11 +179,10 @@
 
 bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
 {
-#if ENABLE(CSS_SCROLL_SNAP)
-    if (processWheelEventForScrollSnap(e))
+#if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)
+    if (m_scrollController.processWheelEventForScrollSnap(e))
         return false;
 #endif
-
 #if PLATFORM(COCOA)
     // Events in the PlatformWheelEventPhase::MayBegin phase have no deltas, and therefore never passes through the scroll handling logic below.
     // This causes us to return with an 'unhandled' return state, even though this event was successfully processed.
@@ -201,6 +203,7 @@
 
     bool handled = false;
 
+    ScrollGranularity granularity = ScrollByPixel;
     IntSize maxForwardScrollDelta = m_scrollableArea.maximumScrollPosition() - m_scrollableArea.scrollPosition();
     IntSize maxBackwardScrollDelta = m_scrollableArea.scrollPosition() - m_scrollableArea.minimumScrollPosition();
     if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
@@ -209,10 +212,6 @@
         || (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
         handled = true;
 
-        OptionSet<ScrollBehavior> behavior(ScrollBehavior::DoDirectionalSnapping);
-        if (e.hasPreciseScrollingDeltas())
-            behavior.add(ScrollBehavior::NeverAnimate);
-
         if (deltaY) {
             if (e.granularity() == ScrollByPageWheelEvent) {
                 bool negative = deltaY < 0;
@@ -220,7 +219,10 @@
                 if (negative)
                     deltaY = -deltaY;
             }
-            scroll(VerticalScrollbar, ScrollByPixel, verticalScrollbar->pixelStep(), -deltaY, behavior);
+            if (e.hasPreciseScrollingDeltas())
+                scrollToPositionWithoutAnimation(positionFromStep(VerticalScrollbar, verticalScrollbar->pixelStep(), -deltaY));
+            else
+                scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
         }
 
         if (deltaX) {
@@ -230,7 +232,10 @@
                 if (negative)
                     deltaX = -deltaX;
             }
-            scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX, behavior);
+            if (e.hasPreciseScrollingDeltas())
+                scrollToPositionWithoutAnimation(positionFromStep(HorizontalScrollbar, horizontalScrollbar->pixelStep(), -deltaX));
+            else
+                scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
         }
     }
     return handled;

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (275387 => 275388)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2021-04-01 22:26:48 UTC (rev 275388)
@@ -69,9 +69,8 @@
     virtual ~ScrollAnimator();
 
     enum ScrollBehavior {
-        Default = 0,
-        DoDirectionalSnapping = 1 << 1,
-        NeverAnimate = 1 << 2,
+        Default,
+        DoDirectionalSnapping,
     };
 
     // Computes a scroll destination for the given parameters.  Returns false if
@@ -78,7 +77,7 @@
     // already at the destination.  Otherwise, starts scrolling towards the
     // destination and returns true.  Scrolling may be immediate or animated.
     // The base class implementation always scrolls immediately, never animates.
-    virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, OptionSet<ScrollBehavior>);
+    virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, ScrollBehavior = ScrollBehavior::Default);
 
     bool scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped);
     virtual bool scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping = ScrollClamping::Clamped);
@@ -150,7 +149,9 @@
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    virtual bool processWheelEventForScrollSnap(const PlatformWheelEvent&) { return false; }
+#if PLATFORM(MAC)
+    bool processWheelEventForScrollSnap(const PlatformWheelEvent&);
+#endif
     void updateScrollSnapState();
     bool activeScrollSnapIndexDidChange() const;
     unsigned activeScrollSnapIndexForAxis(ScrollEventAxis) const;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (275387 => 275388)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-04-01 22:26:48 UTC (rev 275388)
@@ -79,7 +79,7 @@
     Timer m_sendContentAreaScrolledTimer;
     FloatSize m_contentAreaScrolledTimerScrollDelta;
 
-    bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, OptionSet<ScrollBehavior>) override;
+    bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, ScrollBehavior) override;
     bool scrollToPositionWithAnimation(const FloatPoint&) override;
     bool scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping = ScrollClamping::Clamped) override;
 
@@ -140,8 +140,6 @@
     String horizontalScrollbarStateForTesting() const final;
     String verticalScrollbarStateForTesting() const final;
 
-    bool processWheelEventForScrollSnap(const PlatformWheelEvent&) override;
-
     // ScrollControllerClient.
 #if ENABLE(RUBBER_BANDING)
     IntSize stretchAmount() const final;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (275387 => 275388)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-04-01 22:19:59 UTC (rev 275387)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-04-01 22:26:48 UTC (rev 275388)
@@ -751,17 +751,16 @@
 }
 #endif
 
-bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, OptionSet<ScrollBehavior> behavior)
+bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, ScrollBehavior behavior)
 {
     m_haveScrolledSincePageLoad = true;
 
     // This method doesn't do directional snapping, but our base class does. It will call into
     // ScrollAnimatorMac::scroll again with the snapped positions and ScrollBehavior::Default.
-    if (behavior.contains(ScrollBehavior::DoDirectionalSnapping))
+    if (behavior == ScrollBehavior::DoDirectionalSnapping)
         return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior);
 
-    bool shouldAnimate = scrollAnimationEnabledForSystem() && m_scrollableArea.scrollAnimatorEnabled() && granularity != ScrollByPixel
-        && !behavior.contains(ScrollBehavior::NeverAnimate);
+    bool shouldAnimate = scrollAnimationEnabledForSystem() && m_scrollableArea.scrollAnimatorEnabled() && granularity != ScrollByPixel;
     FloatPoint newPosition = positionFromStep(orientation, step, multiplier);
     newPosition = newPosition.constrainedBetween(scrollableArea().minimumScrollPosition(), scrollableArea().maximumScrollPosition());
 
@@ -1501,11 +1500,6 @@
     m_visibleScrollerThumbRect = rectInViewCoordinates;
 }
 
-bool ScrollAnimatorMac::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent)
-{
-    return m_scrollController.processWheelEventForScrollSnap(wheelEvent);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SMOOTH_SCROLLING)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to