Bug 255193
| Summary: | Consider not stopping scroll inertia animations when setting scrollTop, or, recalculate the animation and resume it. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | nick |
| Component: | Scrolling | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | augus.dupin, jarek, nick, richard_robinson2, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Other | ||
| Hardware: | iPhone / iPad | ||
| OS: | All | ||
nick
At the moment, using Webkit (WkWebView) on iOS, when the user sets the `scrollTop` property of a scrollable div, WebKit currently clears all running animations on that ScrollView (Which includes rubber-band / touch inertia animations).
This makes it impossible to create a smoothly scrolling div, that adjusts the scroll position while the user swipes to scroll (The user will snap to the position with all momentum halting abruptly).
It is also worth noting that all stock iOS & macOS native controls allow you to keep the momentum going when adjusting the scroll position.
Chromium on Android preserves the momentum and continues the animation as if it was started from the new scroll position.
It would make sense to preserve this when the user wants inertia / rubber-banding.
The relevant code that is currently stopping the animation is:
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp#L306
Which on iOS, is calling the following API `_stopScrollingAndZoomingAnimations` on the UIScrollView:
https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm#L337
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/107840440>
nick
Is this change something worth investigating? I would contribute the time to fix this if so.
Simon Fraser (smfr)
Yes, I think it is to match other browsers.
Bruno Stasse
I have several use cases that this behavior is preventing, one of them being a lightweight implementation of virtual scrolling. A change would be very much welcome.