Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 905ad39d3aae96e94dd2b07a27a8f26aab5d0bdd
https://github.com/WebKit/WebKit/commit/905ad39d3aae96e94dd2b07a27a8f26aab5d0bdd
Author: Ahmad Saleem <[email protected]>
Date: 2026-06-16 (Tue, 16 Jun 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-nested-expected.txt
M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp
M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.h
M Source/WebCore/platform/ScrollableArea.cpp
Log Message:
-----------
Re-snapping after layout moves away from a valid scroll position when the
snap area is larger than the snapport
https://bugs.webkit.org/show_bug.cgi?id=317067
rdar://179553122
Reviewed by Simon Fraser.
ScrollableArea::resnapAfterLayout() always corrected the scroll offset to the
active snap offset's specified alignment. Per the snap-overflow spec
(https://drafts.csswg.org/css-scroll-snap-1/#snap-overflow), when a snap area is
larger than the snapport in an axis, any scroll position in which the area
covers
the snapport is a valid snap position in that axis. So a current offset that
already covers the snapport is already snapped and should be preserved rather
than moved to the alignment offset.
Add ScrollSnapOffsetsInfo::snapOffsetCoversSnapport() to express this covering
test in one place, shared by the wheel/fling snap path (which uses it to compute
landedInsideSnapAreaThatConsumesViewport in searchForPotentialSnapPoints()) and
the post-layout resnap path. resnapAfterLayout() now skips the correction for an
axis when the active snap offset covers the snapport at the current offset.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-nested-expected.txt:
Progression
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::RectType>::snapOffsetCoversSnapport const):
(WebCore::searchForPotentialSnapPoints):
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.h:
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::resnapAfterLayout):
Canonical link: https://commits.webkit.org/315291@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications