Changeset 291497 in webkit


Ignore:
Timestamp:
Mar 18, 2022 2:59:15 PM (4 months ago)
Author:
Nikos Mouchtaris
Message:

Allow history swipe in scroller with overscroll-behavior
https://bugs.webkit.org/show_bug.cgi?id=235851

Reviewed by Simon Fraser.

Source/WebCore:

Re-add code to allow history swipe. Does so by returning unhandled if a horizontal
swipe is used. Also add test to make sure history swipes are allowed in scrolling nodes
with overscroll-behavior.

Test: scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::handleWheelEventWithNode):

  • page/scrolling/ScrollingTreeScrollingNode.cpp:

(WebCore::ScrollingTreeScrollingNode::shouldRubberBand const):
(WebCore::ScrollingTreeScrollingNode::computeScrollPropagation const):
(WebCore::ScrollingTreeScrollingNode::shouldBlockScrollPropagation const): Deleted.

  • page/scrolling/ScrollingTreeScrollingNode.h:

LayoutTests:

  • scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt: Added.
  • scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r291493 r291497  
     12022-03-18  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        Allow history swipe in scroller with overscroll-behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=235851
     5
     6        Reviewed by Simon Fraser.
     7
     8        * scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt: Added.
     9        * scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html: Added.
     10
    1112022-03-18  Simon Fraser  <simon.fraser@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r291496 r291497  
     12022-03-18  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        Allow history swipe in scroller with overscroll-behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=235851
     5
     6        Reviewed by Simon Fraser.
     7
     8        Re-add code to allow history swipe. Does so by returning unhandled if a horizontal
     9        swipe is used. Also add test to make sure history swipes are allowed in scrolling nodes
     10        with overscroll-behavior.
     11
     12        Test: scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html
     13
     14        * page/scrolling/ScrollingTree.cpp:
     15        (WebCore::ScrollingTree::handleWheelEventWithNode):
     16        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     17        (WebCore::ScrollingTreeScrollingNode::shouldRubberBand const):
     18        (WebCore::ScrollingTreeScrollingNode::computeScrollPropagation const):
     19        (WebCore::ScrollingTreeScrollingNode::shouldBlockScrollPropagation const): Deleted.
     20        * page/scrolling/ScrollingTreeScrollingNode.h:
     21
    1222022-03-18  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r290575 r291497  
    218218                return result;
    219219           
    220             if (scrollingNode.shouldBlockScrollPropagation(adjustedWheelEvent.delta())) {
     220            auto scrollPropagationInfo = scrollingNode.computeScrollPropagation(adjustedWheelEvent.delta());
     221            if (scrollPropagationInfo.shouldBlockScrollPropagation) {
     222                if (!scrollPropagationInfo.isHandled)
     223                    return WheelEventHandlingResult::unhandled();
    221224                m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, adjustedWheelEvent, m_allowLatching);
    222225                m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), adjustedWheelEvent);
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp

    r289074 r291497  
    129129    // Also rubberband when we should block scroll propagation
    130130    // at this node, which has overscroll behavior that is not none.
    131     return (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()) || (shouldBlockScrollPropagation(wheelEvent.delta()) && overscrollBehaviorAllowsRubberBand()));
     131    auto scrollPropagationInfo = computeScrollPropagation(wheelEvent.delta());
     132    return (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()) || ( scrollPropagationInfo.shouldBlockScrollPropagation && scrollPropagationInfo.isHandled && overscrollBehaviorAllowsRubberBand()));
    132133}
    133134
     
    419420}
    420421
    421 bool ScrollingTreeScrollingNode::shouldBlockScrollPropagation(const FloatSize& delta) const
    422 {
    423     return ((horizontalOverscrollBehaviorPreventsPropagation() || verticalOverscrollBehaviorPreventsPropagation()) && ((horizontalOverscrollBehaviorPreventsPropagation() && verticalOverscrollBehaviorPreventsPropagation()) || (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height()) || (verticalOverscrollBehaviorPreventsPropagation() && !delta.width())));
     422ScrollPropagationInfo ScrollingTreeScrollingNode::computeScrollPropagation(const FloatSize& delta) const
     423{
     424    ScrollPropagationInfo propagation;
     425    if (!horizontalOverscrollBehaviorPreventsPropagation() && !verticalOverscrollBehaviorPreventsPropagation())
     426        return propagation;
     427   
     428    // History swipe case
     429    if (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height() && delta.width()) {
     430        propagation.shouldBlockScrollPropagation = true;
     431        propagation.isHandled = false;
     432        return propagation;
     433    }
     434
     435    if ((horizontalOverscrollBehaviorPreventsPropagation() && verticalOverscrollBehaviorPreventsPropagation())
     436        || (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height())
     437        || (verticalOverscrollBehaviorPreventsPropagation() && !delta.width())) {
     438        propagation.shouldBlockScrollPropagation = true;
     439        propagation.isHandled = true;
     440    }
     441    return propagation;
    424442}
    425443
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r291198 r291497  
    4040struct WheelEventHandlingResult;
    4141
     42struct ScrollPropagationInfo {
     43    bool shouldBlockScrollPropagation { false };
     44    bool isHandled { false };
     45};
     46
    4247class WEBCORE_EXPORT ScrollingTreeScrollingNode : public ScrollingTreeNode {
    4348    friend class ScrollingTreeScrollingNodeDelegate;
     
    166171    bool verticalOverscrollBehaviorPreventsPropagation() const { return m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::Auto; }
    167172    PlatformWheelEvent eventForPropagation(const PlatformWheelEvent&) const;
    168     bool shouldBlockScrollPropagation(const FloatSize&) const;
     173    ScrollPropagationInfo computeScrollPropagation(const FloatSize&) const;
    169174    bool overscrollBehaviorAllowsRubberBand() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior != OverscrollBehavior::None ||  m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::None; }
    170175    bool shouldRubberBand(const PlatformWheelEvent&, EventTargeting) const;
Note: See TracChangeset for help on using the changeset viewer.