[webkit-changes] [WebKit/WebKit] 9b87cf: [iOS] A scrollTo() followed by an animated scroll ...

Simon Fraser noreply at github.com
Sat Oct 28 16:47:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9b87cf844c2f847a8222bab057eac7ba735e605e
      https://github.com/WebKit/WebKit/commit/9b87cf844c2f847a8222bab057eac7ba735e605e
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-10-28 (Sat, 28 Oct 2023)

  Changed paths:
    A LayoutTests/fast/scrolling/ios/smooth-scroll-after-scrollTo-on-overflow-expected.txt
    A LayoutTests/fast/scrolling/ios/smooth-scroll-after-scrollTo-on-overflow.html
    M Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.cpp
    M Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm

  Log Message:
  -----------
  [iOS] A scrollTo() followed by an animated scroll ends at the wrong scroll position
https://bugs.webkit.org/show_bug.cgi?id=263808
rdar://117608836

Reviewed by Richard Robinson.

Programmatic scroll requests (`RequestedScrollData`) are handled in three places:
1. `RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction()` for iOS main frame scrolls
2. `ScrollingTreeScrollingNode::handleScrollPositionRequest()` for non-main-frame iOS scrolls
3. `RemoteScrollingTreeMac::startPendingScrollAnimations()` for all scollers on macOS

The second failed to handle the `requestedDataBeforeAnimatedScroll` data in the request, so
a sequence like `scrollTo(x, y); scrollBy({ top: z, behavior: 'smooth' })` would fail to
accumulate the two deltas.

Fix by having `ScrollingTreeScrollingNode::handleScrollPositionRequest()` process `requestedDataBeforeAnimatedScroll`
like the other call sites. Also reuse the "position or delta" logic in `RequestedScrollData::destinationPosition()`
in all these call sites for clarity.

* LayoutTests/fast/scrolling/ios/smooth-scroll-after-scrollTo-on-overflow-expected.txt: Added.
* LayoutTests/fast/scrolling/ios/smooth-scroll-after-scrollTo-on-overflow.html: Added.
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.cpp:
(WebCore::RequestedScrollData::destinationPosition const):
(WebCore::RequestedScrollData::computeDestinationPosition):
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h:
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm:
(WebKit::RemoteScrollingTreeMac::startPendingScrollAnimations):

Canonical link: https://commits.webkit.org/269897@main




More information about the webkit-changes mailing list