Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c0b5ca70b2e64b6af1313ad0de1329d159f1e7b8
https://github.com/WebKit/WebKit/commit/c0b5ca70b2e64b6af1313ad0de1329d159f1e7b8
Author: Simon Fraser <[email protected]>
Date: 2026-02-08 (Sun, 08 Feb 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/dom/Document.cpp
M Source/WebCore/page/LocalFrameView.cpp
M Source/WebCore/page/LocalFrameView.h
M Source/WebCore/page/scrolling/ScrollAnchoringController.cpp
M Source/WebCore/page/scrolling/ScrollAnchoringController.h
M Source/WebCore/platform/ScrollableArea.cpp
M Source/WebCore/platform/ScrollableArea.h
Log Message:
-----------
[Scroll anchoring] Suppress anchoring during scroll event handling
https://bugs.webkit.org/show_bug.cgi?id=307287
rdar://169929714
Reviewed by Tim Nguyen.
Other browsers suppress scroll anchoring during scroll event handling, although
the spec[1]
does not explicitly state this. However, there are WPT that require it.
Implement by by adding `will`/`didDispatchScrollEvent()` functions on
ScrollableArea,
and plumbing through to ScrollAnchoringController, where they maintain a count
(to handling
nesting). Consult this state during `adjustScrollPositionForAnchoring()`.
`Document::runScrollSteps()` then brackets the call to `dispatchEvent()`. We
use a helper
function on LocalFrameView to get the correct ScrollableArea for the given
node, and
store it in a WeakPtr since script can run and destroy it during the event
handling.
[1] https://drafts.csswg.org/css-scroll-anchoring/
* LayoutTests/TestExpectations:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::runScrollSteps):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::scrollableAreaForNode):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/scrolling/ScrollAnchoringController.cpp:
(WebCore::ScrollAnchoringController::adjustScrollPositionForAnchoring): A bit
of ordering cleanup too.
(WebCore::ScrollAnchoringController::willDispatchScrollEvent):
(WebCore::ScrollAnchoringController::didDispatchScrollEvent):
* Source/WebCore/page/scrolling/ScrollAnchoringController.h:
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::willDispatchScrollEvent):
(WebCore::ScrollableArea::didDispatchScrollEvent):
* Source/WebCore/platform/ScrollableArea.h:
Canonical link: https://commits.webkit.org/307054@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications