⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285526 in webkit


Ignore:
Timestamp:
Nov 9, 2021, 1:06:00 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Add runtime flag for momentum scrolling
https://bugs.webkit.org/show_bug.cgi?id=232898
<rdar://problem/85211338>

Reviewed by Simon Fraser.

  • Scripts/Preferences/WebPreferencesInternal.yaml:

Add the preference.

  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):

  • page/scrolling/ScrollingStateFrameScrollingNode.cpp:

(WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
(WebCore::ScrollingStateFrameScrollingNode::applicableProperties const):
(WebCore::ScrollingStateFrameScrollingNode::setMomentumScrollingAnimatorEnabled):

  • page/scrolling/ScrollingStateFrameScrollingNode.h:
  • page/scrolling/ScrollingStateNode.h:
  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::commitTreeState):

  • page/scrolling/ScrollingTree.h:

(WebCore::ScrollingTree::momentumScrollingAnimatorEnabled const):
(WebCore::ScrollingTree::setMomentumScrollingAnimatorEnabled):

  • page/scrolling/ScrollingTreeScrollingNode.cpp:

(WebCore::ScrollingTreeScrollingNode::momentumScrollingAnimatorEnabled const):

  • page/scrolling/ScrollingTreeScrollingNode.h:
  • page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
  • page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:

(WebCore::ScrollingTreeScrollingNodeDelegateMac::momentumScrollingAnimatorEnabled const):

  • platform/ScrollingEffectsController.h:

(WebCore::ScrollingEffectsControllerClient::momentumScrollingAnimatorEnabled const):

  • Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:

(ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
(ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r285521 r285526  
     12021-11-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add runtime flag for momentum scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=232898
     5        <rdar://problem/85211338>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * Scripts/Preferences/WebPreferencesInternal.yaml:
     10        Add the preference.
     11
    1122021-11-09  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml

    r285259 r285526  
    537537      default: false
    538538
     539MomentumScrollingAnimatorEnabled:
     540  type: bool
     541  humanReadableName: "Momentum Scrolling Animator"
     542  humanReadableDescription: "Drive momentum scrolling via an internal animator instead of using momentum events"
     543  defaultValue:
     544    WebKitLegacy:
     545      "PLATFORM(MAC)": true
     546      default: false
     547    WebKit:
     548      "PLATFORM(MAC)": true
     549      default: false
     550    WebCore:
     551      "PLATFORM(MAC)": true
     552      default: false
     553
    539554MouseEventsSimulationEnabled:
    540555  type: bool
  • trunk/Source/WebCore/ChangeLog

    r285524 r285526  
     12021-11-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add runtime flag for momentum scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=232898
     5        <rdar://problem/85211338>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * page/scrolling/AsyncScrollingCoordinator.cpp:
     10        (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
     11        * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
     12        (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
     13        (WebCore::ScrollingStateFrameScrollingNode::applicableProperties const):
     14        (WebCore::ScrollingStateFrameScrollingNode::setMomentumScrollingAnimatorEnabled):
     15        * page/scrolling/ScrollingStateFrameScrollingNode.h:
     16        * page/scrolling/ScrollingStateNode.h:
     17        * page/scrolling/ScrollingTree.cpp:
     18        (WebCore::ScrollingTree::commitTreeState):
     19        * page/scrolling/ScrollingTree.h:
     20        (WebCore::ScrollingTree::momentumScrollingAnimatorEnabled const):
     21        (WebCore::ScrollingTree::setMomentumScrollingAnimatorEnabled):
     22        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     23        (WebCore::ScrollingTreeScrollingNode::momentumScrollingAnimatorEnabled const):
     24        * page/scrolling/ScrollingTreeScrollingNode.h:
     25        * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
     26        * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
     27        (WebCore::ScrollingTreeScrollingNodeDelegateMac::momentumScrollingAnimatorEnabled const):
     28        * platform/ScrollingEffectsController.h:
     29        (WebCore::ScrollingEffectsControllerClient::momentumScrollingAnimatorEnabled const):
     30
    1312021-11-09  Don Olmstead  <don.olmstead@sony.com>
    232
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r285316 r285526  
    747747    frameScrollingNode.setScrollingPerformanceTestingEnabled(settings.scrollingPerformanceTestingEnabled());
    748748    frameScrollingNode.setWheelEventGesturesBecomeNonBlocking(settings.wheelEventGesturesBecomeNonBlocking());
     749    frameScrollingNode.setMomentumScrollingAnimatorEnabled(settings.momentumScrollingAnimatorEnabled());
    749750
    750751    frameScrollingNode.setMinLayoutViewportOrigin(frameView.minStableLayoutViewportOrigin());
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp

    r284534 r285526  
    6262    , m_wheelEventGesturesBecomeNonBlocking(stateNode.wheelEventGesturesBecomeNonBlocking())
    6363    , m_scrollingPerformanceTestingEnabled(stateNode.scrollingPerformanceTestingEnabled())
     64    , m_momentumScrollingAnimatorEnabled(stateNode.momentumScrollingAnimatorEnabled())
    6465{
    6566    if (hasChangedProperty(Property::RootContentsLayer))
     
    113114        Property::MaxLayoutViewportOrigin,
    114115        Property::OverrideVisualViewportSize,
     116        Property::MomentumScrollingAnimatorEnabled,
    115117    };
    116118
     
    308310    m_scrollingPerformanceTestingEnabled = enabled;
    309311    setPropertyChanged(Property::ScrollingPerformanceTestingEnabled);
     312}
     313
     314void ScrollingStateFrameScrollingNode::setMomentumScrollingAnimatorEnabled(bool enabled)
     315{
     316    if (enabled == m_momentumScrollingAnimatorEnabled)
     317        return;
     318   
     319    m_momentumScrollingAnimatorEnabled = enabled;
     320    setPropertyChanged(Property::MomentumScrollingAnimatorEnabled);
    310321}
    311322
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.h

    r284534 r285526  
    118118    WEBCORE_EXPORT void setWheelEventGesturesBecomeNonBlocking(bool);
    119119
     120    bool momentumScrollingAnimatorEnabled() const { return m_momentumScrollingAnimatorEnabled; }
     121    WEBCORE_EXPORT void setMomentumScrollingAnimatorEnabled(bool);
     122
    120123    void dumpProperties(WTF::TextStream&, OptionSet<ScrollingStateTreeAsTextBehavior>) const override;
    121124
     
    150153    bool m_wheelEventGesturesBecomeNonBlocking { false };
    151154    bool m_scrollingPerformanceTestingEnabled { false };
     155    bool m_momentumScrollingAnimatorEnabled { false };
    152156};
    153157
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h

    r284534 r285526  
    256256        VisualViewportIsSmallerThanLayoutViewport   = 1LLU << 32,
    257257        AsyncFrameOrOverflowScrollingEnabled        = 1LLU << 33,
    258         WheelEventGesturesBecomeNonBlocking         = 1LLU << 34,
    259         ScrollingPerformanceTestingEnabled          = 1LLU << 35,
    260         LayoutViewport                              = 1LLU << 36,
    261         MinLayoutViewportOrigin                     = 1LLU << 37,
    262         MaxLayoutViewportOrigin                     = 1LLU << 38,
    263         OverrideVisualViewportSize                  = 1LLU << 39,
     258        MomentumScrollingAnimatorEnabled            = 1LLU << 34,
     259        WheelEventGesturesBecomeNonBlocking         = 1LLU << 35,
     260        ScrollingPerformanceTestingEnabled          = 1LLU << 36,
     261        LayoutViewport                              = 1LLU << 37,
     262        MinLayoutViewportOrigin                     = 1LLU << 38,
     263        MaxLayoutViewportOrigin                     = 1LLU << 39,
     264        OverrideVisualViewportSize                  = 1LLU << 40,
    264265        // ScrollingStatePositionedNode
    265         RelatedOverflowScrollingNodes               = 1LLU << 40,
    266         LayoutConstraintData                        = 1LLU << 41,
     266        RelatedOverflowScrollingNodes               = 1LLU << 41,
     267        LayoutConstraintData                        = 1LLU << 42,
    267268        // ScrollingStateFixedNode, ScrollingStateStickyNode
    268         ViewportConstraints                         = 1LLU << 42,
     269        ViewportConstraints                         = 1LLU << 43,
    269270        // ScrollingStateOverflowScrollProxyNode
    270         OverflowScrollingNode                       = 1LLU << 43,
     271        OverflowScrollingNode                       = 1LLU << 44,
    271272    };
    272273   
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r285094 r285526  
    280280            || rootNode->hasChangedProperty(ScrollingStateNode::Property::WheelEventGesturesBecomeNonBlocking)
    281281            || rootNode->hasChangedProperty(ScrollingStateNode::Property::ScrollingPerformanceTestingEnabled)
    282             || rootNode->hasChangedProperty(ScrollingStateNode::Property::IsMonitoringWheelEvents))) {
     282            || rootNode->hasChangedProperty(ScrollingStateNode::Property::IsMonitoringWheelEvents)
     283            || rootNode->hasChangedProperty(ScrollingStateNode::Property::MomentumScrollingAnimatorEnabled))) {
    283284        Locker locker { m_treeStateLock };
    284285
     
    300301        if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateNode::Property::IsMonitoringWheelEvents))
    301302            m_isMonitoringWheelEvents = scrollingStateTree->rootStateNode()->isMonitoringWheelEvents();
     303
     304        if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateNode::Property::MomentumScrollingAnimatorEnabled))
     305            m_momentumScrollingAnimatorEnabled = scrollingStateTree->rootStateNode()->momentumScrollingAnimatorEnabled();
    302306    }
    303307
     
    321325            node->willBeDestroyed();
    322326    }
     327
     328    if (rootNode && (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateNode::Property::MomentumScrollingAnimatorEnabled)))
     329        RELEASE_LOG(Scrolling, "ScrollingTree momentum scrolling animator enabled: %d", rootNode->momentumScrollingAnimatorEnabled());
    323330   
    324331    didCommitTree();
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r285094 r285526  
    101101    void setScrollingPerformanceTestingEnabled(bool value) { m_scrollingPerformanceTestingEnabled = value; }
    102102
     103    bool momentumScrollingAnimatorEnabled() const { return m_momentumScrollingAnimatorEnabled; }
     104    void setMomentumScrollingAnimatorEnabled(bool value) { m_momentumScrollingAnimatorEnabled = value; }
     105
    103106    WEBCORE_EXPORT OptionSet<WheelEventProcessingSteps> determineWheelEventProcessing(const PlatformWheelEvent&);
    104107    WEBCORE_EXPORT virtual WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps> = { });
     
    332335    bool m_asyncFrameOrOverflowScrollingEnabled { false };
    333336    bool m_wheelEventGesturesBecomeNonBlocking { false };
     337    bool m_momentumScrollingAnimatorEnabled { false };
    334338    bool m_needsApplyLayerPositionsAfterCommit { false };
    335339    bool m_inCommitTreeState { false };
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp

    r285094 r285526  
    226226}
    227227
     228bool ScrollingTreeScrollingNode::momentumScrollingAnimatorEnabled() const
     229{
     230    return scrollingTree().momentumScrollingAnimatorEnabled();
     231}
     232
    228233void ScrollingTreeScrollingNode::willStartAnimatedScroll()
    229234{
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r285357 r285526  
    133133    void willStartAnimatedScroll();
    134134    void didStopAnimatedScroll();
     135
     136    bool momentumScrollingAnimatorEnabled() const;
    135137   
    136138    void setScrollAnimationInProgress(bool);
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h

    r285094 r285526  
    9494    void adjustScrollPositionToBoundsIfNecessary() final;
    9595
     96    bool momentumScrollingAnimatorEnabled() const final;
     97
    9698    bool scrollPositionIsNotRubberbandingEdge(const FloatPoint&) const;
    9799
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm

    r285347 r285526  
    443443}
    444444
     445bool ScrollingTreeScrollingNodeDelegateMac::momentumScrollingAnimatorEnabled() const
     446{
     447    return scrollingNode().momentumScrollingAnimatorEnabled();
     448}
     449
    445450} // namespace WebCore
    446451
  • trunk/Source/WebCore/platform/ScrollingEffectsController.h

    r285387 r285526  
    121121    virtual ScrollExtents scrollExtents() const = 0;
    122122    virtual bool scrollAnimationEnabled() const { return true; }
     123
     124    virtual bool momentumScrollingAnimatorEnabled() const { return false; }
    123125};
    124126
  • trunk/Source/WebKit/ChangeLog

    r285521 r285526  
     12021-11-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add runtime flag for momentum scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=232898
     5        <rdar://problem/85211338>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
     10        (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
     11        (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
     12
    1132021-11-09  Devin Rousso  <drousso@apple.com>
    214
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp

    r283911 r285526  
    150150        WebCore::ScrollingStateNode::Property::VisualViewportIsSmallerThanLayoutViewport,
    151151        WebCore::ScrollingStateNode::Property::AsyncFrameOrOverflowScrollingEnabled,
     152        WebCore::ScrollingStateNode::Property::MomentumScrollingAnimatorEnabled,
    152153        WebCore::ScrollingStateNode::Property::WheelEventGesturesBecomeNonBlocking,
    153154        WebCore::ScrollingStateNode::Property::ScrollingPerformanceTestingEnabled,
     
    252253    SCROLLING_NODE_ENCODE(ScrollingStateNode::Property::MaxLayoutViewportOrigin, maxLayoutViewportOrigin)
    253254    SCROLLING_NODE_ENCODE(ScrollingStateNode::Property::OverrideVisualViewportSize, overrideVisualViewportSize)
     255    // MomentumScrollingAnimatorEnabled is not relevant for UI-side compositing.
    254256
    255257    if (node.hasChangedProperty(ScrollingStateNode::Property::CounterScrollingLayer))
     
    366368    SCROLLING_NODE_DECODE(ScrollingStateNode::Property::MaxLayoutViewportOrigin, FloatPoint, setMaxLayoutViewportOrigin)
    367369    SCROLLING_NODE_DECODE(ScrollingStateNode::Property::OverrideVisualViewportSize, std::optional<FloatSize>, setOverrideVisualViewportSize)
     370    // MomentumScrollingAnimatorEnabled is not encoded.
    368371
    369372    if (node.hasChangedProperty(ScrollingStateNode::Property::CounterScrollingLayer)) {
Note: See TracChangeset for help on using the changeset viewer.