| Summary: | Reconsider ScrollAnimator/ScrollController split | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Martin Robinson <mrobinson> |
| Component: | Scrolling | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | alex, cathiechen, fred.wang, rwlbuis, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=217709 | ||
|
Description
Martin Robinson
2020-10-28 03:25:33 PDT
So my spitball proposal for this is: 1. Move state common to both rubber banding and scroll snap into ScrollAnimator. 2. Split ScrollController into ScrollSnapController and RubberBandingController or ScrollSnapAnimator/RubberBandingAnimator. 3. Try to push as much Mac-specific code as possible into ScrollAnimatorMac and ScrollSnapControllerMac/RubberBandingControllerMac. There are probably other ways to do this and I'm definitely happy to hear them. Yes, I'd love to redo this code. It's very confusing. Another thing to consider here is that scroll snap is a CSS feature and should be supported on all platforms. Perhaps we should move all scroll snap code into ScrollAnimator and rename ScrollController to RubberBandingController. I definitely think that RubberBandingController is a good name (with platform-specific implementations). Maybe we should have a ScrollSnapController. It feels like we need a "coordination" class that can allow various delegates to affect the scroll, like rubber banding and scroll snap, but how those delegates interact will be hard to define. Maybe: ScrollAnimationController, which has as member variables ScrollSnapController RubberBandingController ScrollAnimationController knows how to do an animated scroll to a position, via ScrollingMomentumCalculator. ScrollAnimationController resolves conflicts between concurrent rubberbands/animated scrolls (if that happens). Maybe ScrollAnimationController has a delegate that allows it to delegate smooth scrolls to the platform (UIScrollView) via ScrollingTreeScrollingNodeDelegateIOS |