[Webkit-unassigned] [Bug 230310] Unify the code paths for smooth scrolling, and scrolling to snap points

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 16 03:10:02 PDT 2021


Martin Robinson <mrobinson at webkit.org> changed:

           What    |Removed                     |Added
                 CC|                            |mrobinson at webkit.org

--- Comment #3 from Martin Robinson <mrobinson at webkit.org> ---
I've done a quick inventory of all of the scroll animation classes and here's a summary:

ScrollAnimator: WebProcess-only class providing operations that can scroll from one point to another and manages scroll snap / rubber banding via ScollingEffectsController. This is only used by ScrollableArea. I think it exists to avoid a layering violation, since it depends on platform-specific behavior.
  * ScrollAnimatorMac uses NSScrollAnimationHelper (private API) to scroll WebProcess-side scroll areas with animations.
  * ScrollAnimationSmooth: Generic implementation of smooth scrolling animation. This is used by ScrollAnimator for operations like "scroll to point with animation" on non-Mac platforms. On Mac this is used for CSSOM smooth scrolling (fixed by https://bugs.webkit.org/show_bug.cgi?id=218857). In addition, it's used in the UIProcess by the Nicosia scrolling tree.

ScrollingEffectsCoordinator: Manages rubber banding and scroll snapping in both the WebProcess and UIProcess (scrolling tree).
  * ScrollSnapAnimatorState: Manages state for scroll snapping. Only used by ScrollingEffectsCoordinator.
    * ScrollingMomentumCalculator - Abstract base class that calculates movement for animations involving scrolling momentum. ScrollSnapAnimatorState uses this when ScrollingEffectsCoordinater sets up a momentum animation based on kinetic scrolling / scroll snap. Only Mac does this currently.
   * ScrollingMomentumCalculatorMac: Mac implementation of ScrollingMomentumCalculator which uses NSScrollingMomentumCalculatorSPI to calculate the momentum values.
   * BasicScrollingMomentumCalculator: Platform-independent implementation of ScrollingMomentumCalculator. I think this is unused, but could one day be used for kinetic scrolling on other ports.

* ScrollAnimationKinetic: Kinetic scroll animation class that's only used for Nicosia Scrolling Tree kinetic animations. I'm unsure how much of this could be replaced by ScrollingEffectsCoordinator and BasicScrollingMomentumCalculator.

I think there's lots of opportunities for simplification here. In particular it seems like ScrollingEffectsCoordinator / ScrollSnapAnimatorState / ScrollingMomentumCalculator could be collapsed down into a single class and greatly simplified. 

Another thing that could happen is that a lot of ScrollAnimator could move into ScrollableArea and the platform-dependent parts could be implemented as a delegate that only does the actual animation.

These are just some initial ideas, but there's lots of room for improvement. The code is a bit convoluted, because we have to send information down to all of these helpers whenever scroll snap points change.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210916/aed72307/attachment-0001.htm>

More information about the webkit-unassigned mailing list