Title: [287397] trunk
Revision
287397
Author
simon.fra...@apple.com
Date
2021-12-23 09:19:48 -0800 (Thu, 23 Dec 2021)

Log Message

Share macOS code between ScrollAnimator::handleWheelEvent() and ScrollingEffectsController::handleWheelEvent()
https://bugs.webkit.org/show_bug.cgi?id=231238

Reviewed by Wenson Hsieh.

Source/WebCore:

ScrollAnimator::handleWheelEvent() had some macOS-only code (despite having a
ScrollAnimatorMac subclass) whose purpose was unclear. It turns out the code runs in two
scenarios: for select lists, which always scroll on the main thread, and in some main thread
scrolling cases when responding to non-gesture events (i.e. those from old-style clicky
scroll wheels).

Clean this by making that code clearly specific to "stepped scrolling", via the
virtual ScrollableArea::hasSteppedScrolling(). Call it in cross-platform code in
ScrollAnimator::handleWheelEvent().

The ScrollAnimatorMac::handleWheelEvent() override now simply calls into the base class,
after doing some macOS-specific stuff for phase handling (which is related to scrollbar flashing).

rubberBandingEnabledForSystem() is no longer consulted; this never worked for threaded scrolling.
If we need it, we can bring it back. We no longer need the shouldForwardWheelEventsToParent()
and its misleading comment.

Now that stateless wheel events go through ScrollingEffectsController::handleWheelEvent(),
we have to avoid doing axis snapping for them.

css3/scroll-snap/scroll-snap-wheel-event.html reveals a behavior progression: previously
stateless, main thread scroll snap scrolls would use the code now in
handleSteppedScrolling() and a single small delta would pick the snap point in that
direction. This differed from scrolling thread scrolls, where stateless scrolls animate to
the nearest snap pointer after a timer fire. Now, this same behavior applies to main thread
stateless scrolls.

* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::isGestureEvent const):
(WebCore::PlatformWheelEvent::isNonGestureEvent const):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleWheelEvent):
(WebCore::ScrollAnimator::handleSteppedScrolling):
* platform/ScrollAnimator.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::hasSteppedScrolling const):
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::rubberBandingEnabledForSystem): Deleted.
(WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent const): Deleted.
* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::handleWheelEvent):
* rendering/RenderListBox.h:

LayoutTests:

* css3/scroll-snap/scroll-snap-wheel-event.html: We need to scroll 3 clicks to get closer to the target snap point.
* platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt: Rebase already-failing
result (because ScrollingEffectsController::handleWheelEvent() doesn't scroll on the "begin" event).
* platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto.
* platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt: Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287396 => 287397)


--- trunk/LayoutTests/ChangeLog	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/LayoutTests/ChangeLog	2021-12-23 17:19:48 UTC (rev 287397)
@@ -1,3 +1,16 @@
+2021-12-22  Simon Fraser  <simon.fra...@apple.com>
+
+        Share macOS code between ScrollAnimator::handleWheelEvent() and ScrollingEffectsController::handleWheelEvent()
+        https://bugs.webkit.org/show_bug.cgi?id=231238
+
+        Reviewed by Wenson Hsieh.
+
+        * css3/scroll-snap/scroll-snap-wheel-event.html: We need to scroll 3 clicks to get closer to the target snap point.
+        * platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt: Rebase already-failing
+        result (because ScrollingEffectsController::handleWheelEvent() doesn't scroll on the "begin" event).
+        * platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt: Ditto.
+        * platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt: Ditto.
+
 2021-12-23  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] test fast/mediastream/get-display-media-settings.html fails

Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html (287396 => 287397)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-12-23 17:19:48 UTC (rev 287397)
@@ -38,7 +38,7 @@
                 eventSender.mouseMoveTo(80, 190);
                 eventSender.mouseUp();
 
-                await UIHelper.statelessMouseWheelScrollAt(80, 190, -1, 0);
+                await UIHelper.statelessMouseWheelScrollAt(80, 190, -3, 0);
 
                 let horizontalContainer = document.getElementById("horizontal-container");
                 expectTrue(horizontalContainer.scrollLeft == 200, "horizontal mouse wheel event snapped");
@@ -48,7 +48,7 @@
                 eventSender.mouseMoveTo(190, 270);
                 eventSender.mouseUp();
 
-                await UIHelper.statelessMouseWheelScrollAt(190, 270, 0, -1);
+                await UIHelper.statelessMouseWheelScrollAt(190, 270, 0, -3);
 
                 let verticalContainer = document.getElementById("vertical-container");
                 expectTrue(verticalContainer.scrollTop == 185, "vertical mouse wheel event snapped");

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


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/latching-and-wheel-events-expected.txt	2021-12-23 17:19:48 UTC (rev 287397)
@@ -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 210.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
 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 (287396 => 287397)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/overflow-in-iframe-latching-expected.txt	2021-12-23 17:19:48 UTC (rev 287397)
@@ -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 210.
+FAIL overflowInIframeElement.scrollTop should be 0. Was 200.
 PASS window.pageYOffset is 20
 PASS successfullyParsed is true
 

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


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/latching/scroll-snap-latching-expected.txt	2021-12-23 17:19:48 UTC (rev 287397)
@@ -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 (287396 => 287397)


--- trunk/Source/WebCore/ChangeLog	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/ChangeLog	2021-12-23 17:19:48 UTC (rev 287397)
@@ -1,3 +1,55 @@
+2021-12-22  Simon Fraser  <simon.fra...@apple.com>
+
+        Share macOS code between ScrollAnimator::handleWheelEvent() and ScrollingEffectsController::handleWheelEvent()
+        https://bugs.webkit.org/show_bug.cgi?id=231238
+
+        Reviewed by Wenson Hsieh.
+
+        ScrollAnimator::handleWheelEvent() had some macOS-only code (despite having a
+        ScrollAnimatorMac subclass) whose purpose was unclear. It turns out the code runs in two
+        scenarios: for select lists, which always scroll on the main thread, and in some main thread
+        scrolling cases when responding to non-gesture events (i.e. those from old-style clicky
+        scroll wheels).
+
+        Clean this by making that code clearly specific to "stepped scrolling", via the
+        virtual ScrollableArea::hasSteppedScrolling(). Call it in cross-platform code in
+        ScrollAnimator::handleWheelEvent().
+        
+        The ScrollAnimatorMac::handleWheelEvent() override now simply calls into the base class,
+        after doing some macOS-specific stuff for phase handling (which is related to scrollbar flashing).
+
+        rubberBandingEnabledForSystem() is no longer consulted; this never worked for threaded scrolling.
+        If we need it, we can bring it back. We no longer need the shouldForwardWheelEventsToParent()
+        and its misleading comment.
+
+        Now that stateless wheel events go through ScrollingEffectsController::handleWheelEvent(),
+        we have to avoid doing axis snapping for them.
+        
+        css3/scroll-snap/scroll-snap-wheel-event.html reveals a behavior progression: previously
+        stateless, main thread scroll snap scrolls would use the code now in
+        handleSteppedScrolling() and a single small delta would pick the snap point in that
+        direction. This differed from scrolling thread scrolls, where stateless scrolls animate to
+        the nearest snap pointer after a timer fire. Now, this same behavior applies to main thread
+        stateless scrolls.
+
+        * platform/PlatformWheelEvent.h:
+        (WebCore::PlatformWheelEvent::isGestureEvent const):
+        (WebCore::PlatformWheelEvent::isNonGestureEvent const):
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::handleWheelEvent):
+        (WebCore::ScrollAnimator::handleSteppedScrolling):
+        * platform/ScrollAnimator.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::hasSteppedScrolling const):
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::handleWheelEvent):
+        (WebCore::rubberBandingEnabledForSystem): Deleted.
+        (WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent const): Deleted.
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::handleWheelEvent):
+        * rendering/RenderListBox.h:
+
 2021-12-23  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Do not try to bidi reorder empty content

Modified: trunk/Source/WebCore/platform/PlatformWheelEvent.h (287396 => 287397)


--- trunk/Source/WebCore/platform/PlatformWheelEvent.h	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/PlatformWheelEvent.h	2021-12-23 17:19:48 UTC (rev 287397)
@@ -168,7 +168,6 @@
     bool useLatchedEventElement() const;
     bool isGestureContinuation() const; // The fingers-down part of the gesture excluding momentum.
     bool shouldResetLatching() const;
-    bool isNonGestureEvent() const;
     bool isEndOfMomentumScroll() const;
 #else
     bool useLatchedEventElement() const { return false; }
@@ -181,6 +180,9 @@
     bool isGestureStart() const;
     bool isGestureCancel() const;
 
+    bool isGestureEvent() const;
+    bool isNonGestureEvent() const;
+
     bool isEndOfNonMomentumScroll() const;
     bool isTransitioningToMomentumScroll() const;
     FloatSize swipeVelocity() const;
@@ -240,11 +242,6 @@
     return m_phase == PlatformWheelEventPhase::Cancelled || m_phase == PlatformWheelEventPhase::MayBegin || (m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::None) || isEndOfMomentumScroll();
 }
 
-inline bool PlatformWheelEvent::isNonGestureEvent() const
-{
-    return m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::None;
-}
-
 inline bool PlatformWheelEvent::isEndOfMomentumScroll() const
 {
     return m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::Ended;
@@ -254,6 +251,16 @@
 
 #if ENABLE(KINETIC_SCROLLING)
 
+inline bool PlatformWheelEvent::isGestureEvent() const
+{
+    return m_phase != PlatformWheelEventPhase::None || m_momentumPhase != PlatformWheelEventPhase::None;
+}
+
+inline bool PlatformWheelEvent::isNonGestureEvent() const
+{
+    return !isGestureEvent();
+}
+
 inline bool PlatformWheelEvent::isGestureStart() const
 {
     return m_phase == PlatformWheelEventPhase::Began || m_phase == PlatformWheelEventPhase::MayBegin;

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (287396 => 287397)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-23 17:19:48 UTC (rev 287397)
@@ -158,30 +158,27 @@
     m_scrollController.resnapAfterLayout();
 }
 
-bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
+bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
 {
-    if (processWheelEventForScrollSnap(e))
+    if (processWheelEventForScrollSnap(wheelEvent))
         return false;
 
-#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.
-    //
-    // We receive at least one PlatformWheelEventPhase::MayBegin when starting main-thread scrolling (see FrameView::wheelEvent), which can
-    // fool the scrolling thread into attempting to handle the scroll, unless we treat the event as handled here.
-    if (e.phase() == PlatformWheelEventPhase::MayBegin)
-        return true;
-#endif
+    if (m_scrollableArea.hasSteppedScrolling())
+        return handleSteppedScrolling(wheelEvent);
 
-#if PLATFORM(MAC)
-    // FIXME: We should be able to remove this code, but Mac's handleWheelEvent relies on this somehow.
-    Scrollbar* horizontalScrollbar = m_scrollableArea.horizontalScrollbar();
-    Scrollbar* verticalScrollbar = m_scrollableArea.verticalScrollbar();
+    return m_scrollController.handleWheelEvent(wheelEvent);
+}
 
+// "Stepped scrolling" is only used by RenderListBox. It's special in that it has no rubberbanding, and scroll deltas respect Scrollbar::pixelStep().
+bool ScrollAnimator::handleSteppedScrolling(const PlatformWheelEvent& wheelEvent)
+{
+    auto* horizontalScrollbar = m_scrollableArea.horizontalScrollbar();
+    auto* verticalScrollbar = m_scrollableArea.verticalScrollbar();
+
     // Accept the event if we have a scrollbar in that direction and can still
     // scroll any further.
-    float deltaX = horizontalScrollbar ? e.deltaX() : 0;
-    float deltaY = verticalScrollbar ? e.deltaY() : 0;
+    float deltaX = horizontalScrollbar ? wheelEvent.deltaX() : 0;
+    float deltaY = verticalScrollbar ? wheelEvent.deltaY() : 0;
 
     bool handled = false;
 
@@ -194,11 +191,11 @@
         handled = true;
 
         OptionSet<ScrollBehavior> behavior = { ScrollBehavior::RespectScrollSnap };
-        if (e.hasPreciseScrollingDeltas())
+        if (wheelEvent.hasPreciseScrollingDeltas())
             behavior.add(ScrollBehavior::NeverAnimate);
 
         if (deltaY) {
-            if (e.granularity() == ScrollByPageWheelEvent)
+            if (wheelEvent.granularity() == ScrollByPageWheelEvent)
                 deltaY = std::copysign(Scrollbar::pageStepDelta(m_scrollableArea.visibleHeight()), deltaY);
 
             auto scrollDelta = verticalScrollbar->pixelStep() * -deltaY; // Wheel deltas are reversed from scrolling direction.
@@ -206,7 +203,7 @@
         }
 
         if (deltaX) {
-            if (e.granularity() == ScrollByPageWheelEvent)
+            if (wheelEvent.granularity() == ScrollByPageWheelEvent)
                 deltaX = std::copysign(Scrollbar::pageStepDelta(m_scrollableArea.visibleWidth()), deltaX);
 
             auto scrollDelta = horizontalScrollbar->pixelStep() * -deltaX; // Wheel deltas are reversed from scrolling direction.
@@ -214,9 +211,6 @@
         }
     }
     return handled;
-#else
-    return m_scrollController.handleWheelEvent(e);
-#endif
 }
 
 void ScrollAnimator::stopKeyboardScrollAnimation()

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (287396 => 287397)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-23 17:19:48 UTC (rev 287397)
@@ -124,6 +124,9 @@
 
     ScrollAnimationStatus serviceScrollAnimation(MonotonicTime);
 
+protected:
+    bool handleSteppedScrolling(const PlatformWheelEvent&);
+
 private:
     void notifyPositionChanged(const FloatSize& delta);
 

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (287396 => 287397)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2021-12-23 17:19:48 UTC (rev 287397)
@@ -111,6 +111,9 @@
     virtual void didEndScroll() { }
     virtual void didUpdateScroll() { }
 #endif
+    
+    // "Stepped scrolling" is used by RenderListBox; it implies that scrollbar->pixelStep() is not 1 and never has rubberbanding.
+    virtual bool hasSteppedScrolling() const { return false; }
 
     ScrollClamping scrollClamping() const { return m_scrollClamping; }
     void setScrollClamping(ScrollClamping clamping) { m_scrollClamping = clamping; }

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (287396 => 287397)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-12-23 17:19:48 UTC (rev 287397)
@@ -43,7 +43,6 @@
     virtual ~ScrollAnimatorMac();
 
 private:
-    bool shouldForwardWheelEventsToParent(const PlatformWheelEvent&) const;
     bool handleWheelEvent(const PlatformWheelEvent&) final;
 
     void handleWheelEventPhase(PlatformWheelEventPhase) final;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (287396 => 287397)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-12-23 17:19:48 UTC (rev 287397)
@@ -51,22 +51,6 @@
 
 ScrollAnimatorMac::~ScrollAnimatorMac() = default;
 
-static bool rubberBandingEnabledForSystem()
-{
-    static bool initialized = false;
-    static bool enabled = true;
-    // Caches the result, which is consistent with other apps like the Finder, which all
-    // require a restart after changing this default.
-    if (!initialized) {
-        // Uses -objectForKey: and not -boolForKey: in order to default to true if the value wasn't set.
-        id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrollViewRubberbanding"];
-        if ([value isKindOfClass:[NSNumber class]])
-            enabled = [value boolValue];
-        initialized = true;
-    }
-    return enabled;
-}
-
 bool ScrollAnimatorMac::isRubberBandInProgress() const
 {
     return m_scrollController.isRubberBandInProgress();
@@ -85,37 +69,21 @@
         m_scrollableArea.scrollbarsController().mayBeginScrollGesture();
 }
 
-bool ScrollAnimatorMac::shouldForwardWheelEventsToParent(const PlatformWheelEvent& wheelEvent) const
-{
-    if (std::abs(wheelEvent.deltaY()) >= std::abs(wheelEvent.deltaX()))
-        return !allowsVerticalStretching(wheelEvent);
-
-    return !allowsHorizontalStretching(wheelEvent);
-}
-    
 bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
 {
     m_scrollableArea.scrollbarsController().setScrollbarAnimationsUnsuspendedByUserInteraction(true);
-
-    if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSystem())
-        return ScrollAnimator::handleWheelEvent(wheelEvent);
-
     m_scrollController.updateGestureInProgressState(wheelEvent);
 
-    // FIXME: This is somewhat roundabout hack to allow forwarding wheel events
-    // up to the parent scrollable area. It takes advantage of the fact that
-    // the base class implementation of handleWheelEvent will not accept the
-    // wheel event if there is nowhere to scroll.
-    if (shouldForwardWheelEventsToParent(wheelEvent)) {
-        bool didHandleEvent = ScrollAnimator::handleWheelEvent(wheelEvent);
-        if (didHandleEvent || (!wheelEvent.deltaX() && !wheelEvent.deltaY()))
-            handleWheelEventPhase(wheelEvent.phase());
-        return didHandleEvent;
-    }
+    // 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.
+    //
+    // We receive at least one PlatformWheelEventPhase::MayBegin when starting main-thread scrolling (see FrameView::wheelEvent), which can
+    // fool the scrolling thread into attempting to handle the scroll, unless we treat the event as handled here.
+    if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin)
+        return true;
 
-    bool didHandleEvent = m_scrollController.handleWheelEvent(wheelEvent);
-
-    if (didHandleEvent)
+    bool didHandleEvent = ScrollAnimator::handleWheelEvent(wheelEvent);
+    if (didHandleEvent || wheelEvent.delta().isZero())
         handleWheelEventPhase(wheelEvent.phase());
 
     return didHandleEvent;

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (287396 => 287397)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-23 17:19:48 UTC (rev 287397)
@@ -174,9 +174,12 @@
     // 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);
 
+    if (wheelEvent.isGestureEvent()) {
+        // 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 (momentumPhase == PlatformWheelEventPhase::Began)

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (287396 => 287397)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2021-12-23 16:53:42 UTC (rev 287396)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2021-12-23 17:19:48 UTC (rev 287397)
@@ -111,6 +111,8 @@
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
 
     // ScrollableArea interface.
+    bool hasSteppedScrolling() const final { return true; }
+
     void setScrollOffset(const ScrollOffset&) final;
 
     ScrollPosition scrollPosition() const final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to