Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 61b6b90764790d3bbe166e2cba379e396e455d7f
https://github.com/WebKit/WebKit/commit/61b6b90764790d3bbe166e2cba379e396e455d7f
Author: Simon Fraser <[email protected]>
Date: 2026-07-24 (Fri, 24 Jul 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element-expected.txt
M Source/WebCore/platform/ScrollSnapAnimatorState.cpp
M Source/WebCore/platform/ScrollSnapAnimatorState.h
Log Message:
-----------
[Scroll snap] Fix
css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element.html
https://bugs.webkit.org/show_bug.cgi?id=320197
rdar://183146768
Reviewed by Abrar Rahman Protyasha.
The test exercises the "resnap after layout" logic[1], testing that a focused
node only becomes the snap
candidate if it's newly focused; the existing code would aways prefer a focused
candidate.
Fix by computing whether focus or target node changed on each axis, and having
the `targetForAxis`
lambda check this.
Start migrating from "box" to "node" terminology for things referenced by
NodeIdentifier.
[1] https://drafts.csswg.org/css-scroll-snap/
*
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/prefer-focused-element-expected.txt:
* Source/WebCore/platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::snapOffsetIndexForNode const):
(WebCore::ScrollSnapAnimatorState::preserveCurrentTargetForAxis):
(WebCore::ScrollSnapAnimatorState::focusedOrTargetedNodeForAxis const):
(WebCore::ScrollSnapAnimatorState::currentlySnappedOffsetsForAxis const):
(WebCore::ScrollSnapAnimatorState::currentlySnappedBoxes const):
(WebCore::ScrollSnapAnimatorState::resnapAfterLayout):
* Source/WebCore/platform/ScrollSnapAnimatorState.h:
Canonical link: https://commits.webkit.org/317892@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications