Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d2bd8b886d3ba2d1b6e559333aa1816c9385f63
      
https://github.com/WebKit/WebKit/commit/0d2bd8b886d3ba2d1b6e559333aa1816c9385f63
  Author: Lily Spiniolas <[email protected]>
  Date:   2026-02-16 (Mon, 16 Feb 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/page/scrolling/ScrollingTree.cpp
    M Source/WebCore/page/scrolling/ScrollingTree.h
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h
    M Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h
    M Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
    A Source/WebCore/platform/RubberbandingState.h
    M Source/WebCore/platform/ScrollAnimation.h
    M Source/WebCore/platform/ScrollingEffectsController.h
    M Source/WebCore/platform/mac/ScrollAnimationRubberBand.h
    M Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm
    M Source/WebCore/platform/mac/ScrollingEffectsController.mm

  Log Message:
  -----------
  Add mechanism for preserving scroll rubber banding across page loads
https://bugs.webkit.org/show_bug.cgi?id=307650
rdar://170208256

Reviewed by Abrar Rahman Protyasha and Simon Fraser.

Add a mechanism for preserving the scroll rubber banding across page loads
by requesting new type `RubberbandingState` from the root scrolling node
of the ScrollingTree before it is replaced with a new one. The ScrollingTree
holds onto this pending state.

In the constructor for `ScrollingTreeScrollingNodeDelegateMac`, we check
if the node is the root scrolling node, and if it is, we take the pending
`RubberbandingState` from the `ScrollingTree` and store it. In
`ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode`, we check to
see if we have a pending state, and if we do, we call
`ScrollingEffectsController::restoreRubberbandingState` which triggers
a ScrollAnimationRubberBand that uses the pending state to determine
where it should continue from, velocity, etc.

Tests will be added in a later patch.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitTreeStateInternal):
(WebCore::ScrollingTree::setPendingMainFrameRubberbandingState):
(WebCore::ScrollingTree::takePendingMainFrameRubberbandingState):
* Source/WebCore/page/scrolling/ScrollingTree.h:
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::captureRubberbandingState const):
(WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h:
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
(WebCore::ScrollingTreeScrollingNodeDelegate::captureRubberbandingState const):
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::ScrollingTreeScrollingNodeDelegateMac):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::captureRubberbandingState 
const):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::rubberBandingStateChanged):
* Source/WebCore/platform/RubberbandingState.h: Added.
* Source/WebCore/platform/ScrollAnimation.h:
(WebCore::ScrollAnimation::startTime const):
* Source/WebCore/platform/ScrollingEffectsController.h:
* Source/WebCore/platform/mac/ScrollAnimationRubberBand.h:
* Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm:
(WebCore::ScrollAnimationRubberBand::startRubberBandAnimationWithElapsedTime):
* Source/WebCore/platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::shouldAttemptRubberbandingRestoration):
(WebCore::ScrollingEffectsController::startRubberBandAnimationWithElapsedTime):
(WebCore::ScrollingEffectsController::captureRubberbandingState const):
(WebCore::ScrollingEffectsController::restoreRubberbandingState):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to