Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 618e0c9aab19d67ea3a915dd3fbaa62617004e88
      
https://github.com/WebKit/WebKit/commit/618e0c9aab19d67ea3a915dd3fbaa62617004e88
  Author: Simon Fraser <[email protected]>
  Date:   2025-02-03 (Mon, 03 Feb 2025)

  Changed paths:
    A 
LayoutTests/fast/scrolling/mac/unscrollable-root-overflow-hidden-on-one-axis-expected.txt
    A 
LayoutTests/fast/scrolling/mac/unscrollable-root-overflow-hidden-on-one-axis.html
    M Source/WebCore/page/WheelEventTestMonitor.cpp
    M Source/WebCore/page/WheelEventTestMonitor.h
    M Source/WebCore/page/scrolling/ScrollingTree.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
    M Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
    M Source/WebCore/platform/ScrollingEffectsController.h
    M Source/WebCore/platform/graphics/ca/TileController.cpp
    M Source/WebCore/platform/mac/ScrollingEffectsController.mm
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in

  Log Message:
  -----------
  A page with `overflow-y: hidden` can sometimes still be scrolled
https://bugs.webkit.org/show_bug.cgi?id=286554
rdar://143660753

Reviewed by Matt Woodrow.

A page with `body { overflow-y: hidden; }` can still be partially scrolled 
(without
momentum). This happens because the `shouldRubberBand()` logic says that we can 
rubberband
vertically, so we allow the event through and apply the scroll delta.

The bug falls out of some complexity around when we actually allow 
rubberbanding on the
root, which has some surprising behaviors. We allow rubberbanding on an 
unscrollable root
to give the user a feeling of responsiveness, but only "unscrollable" in the 
sense of "not
enough content to scroll", not "scrolling disallowed by the web content (i.e. 
`overflow:
hidden`). The bug was that we didn't strictly evaluate this per axis, so if the 
horizontal
axis allowed rubberbanding, we'd also allow it on the vertical axis.

Fix by expanding out the logic in 
`ScrollingTreeScrollingNode::shouldRubberBand()` to
check each axis independently. Also have
`ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandOnSide()` share the 
same code.

Fixing `shouldRubberBand()` is not strictly enough though; there are cases 
where a
rubberband can be started on the horizontal axis, then, with a circular gesture 
on the
trackpad, the vertical axis can be stretched. This PR partially fixes this with 
the
changes in ScrollingEffectsController, but a full fix for this rare edge case 
requires
more work.

Because `ScrollingTree::handleWheelEventWithNode()` now more accurately 
predicts whether
an event will trigger any event handling, some tests[1] timed out because 
`WheelEventTestMonitor`
never received any deferral reasons. Rather than require tests to know if an 
event will
cause any scrolling, introduce a "None" deferral reason purely to allow a test 
that uses
`eventSender.monitorWheelEvents()` to not time out when an event simply doesn't 
trigger any
scrolling, for example because of `overscroll-behavior: none`.

[1] 
imported/w3c/web-platform-tests/css/css-overscroll-behavior/overscroll-behavior.html

* 
LayoutTests/fast/scrolling/mac/unscrollable-root-overflow-hidden-on-one-axis-expected.txt:
 Added.
* 
LayoutTests/fast/scrolling/mac/unscrollable-root-overflow-hidden-on-one-axis.html:
 Added.
* Source/WebCore/page/WheelEventTestMonitor.cpp:
(WebCore::operator<<):
* Source/WebCore/page/WheelEventTestMonitor.h:
* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::determineWheelEventProcessing):
(WebCore::ScrollingTree::handleWheelEvent):
(WebCore::ScrollingTree::handleWheelEventWithNode):
* Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp:
(WebCore::ScrollingTreeGestureState::nodeDidHandleEvent):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::shouldRubberBandOnSide const):
(WebCore::ScrollingTreeScrollingNode::shouldRubberBand const):
(WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h:
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandOnSide const):
* Source/WebCore/platform/ScrollingEffectsController.h:
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::computeTileSize):
* Source/WebCore/platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::clampDeltaForAllowedAxes):
(WebCore::ScrollingEffectsController::modifyScrollDeltaForStretching):
(WebCore::ScrollingEffectsController::applyScrollDeltaWithStretching):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Canonical link: https://commits.webkit.org/289750@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to