[webkit-changes] [WebKit/WebKit] 5ed2b1: [css-scroll-snap] make resnap follow scroll snap t...
Nikos Mouchtaris
noreply at github.com
Thu Sep 22 18:28:20 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5ed2b1dffea4b8da9c99f3e9eee1e792b66f37ef
https://github.com/WebKit/WebKit/commit/5ed2b1dffea4b8da9c99f3e9eee1e792b66f37ef
Author: Nikolaos Mouchtaris <nmouchtaris at apple.com>
Date: 2022-09-22 (Thu, 22 Sep 2022)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/resnap-to-focused-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt
M Source/WebCore/page/FrameView.cpp
M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp
M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.h
M Source/WebCore/platform/ScrollSnapAnimatorState.cpp
M Source/WebCore/platform/ScrollSnapAnimatorState.h
M Source/WebCore/platform/ScrollableArea.cpp
M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
M Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
Log Message:
-----------
[css-scroll-snap] make resnap follow scroll snap target if necessary
https://bugs.webkit.org/show_bug.cgi?id=244745
<rdar://99557242>
Reviewed by Martin Robinson.
CSS scroll snap spec (https://www.w3.org/TR/css-scroll-snap-1/#re-snap): "If multiple boxes were snapped
before and their snap positions no longer coincide, then if one of them is focused or targeted, the scroll
container must re-snap to that one and otherwise which one to re-snap to is UA-defined." To acheive this,
we add an id to scroll offset which represents the associated element to that scroll offset. We also add a bool which
represents wether the associated element is focused. The id of the currently snapped element is added
to ScrollSnapAnimatorState and for each relayout, check if it is necessary to preserve the currently
snapped element.
* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/resnap-to-focused-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt:
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::updateSnapOffsets):
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::updateSnapOffsetsForScrollableArea):
(WebCore::convertOffsetInfo):
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.h:
(WebCore::operator<<):
* Source/WebCore/platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::setFocusedElementForAxis):
(WebCore::ScrollSnapAnimatorState::preserveCurrentTargetForAxis):
(WebCore::ScrollSnapAnimatorState::resnapAfterLayout):
* Source/WebCore/platform/ScrollSnapAnimatorState.h:
(WebCore::ScrollSnapAnimatorState::activeSnapIDForAxis const):
(WebCore::ScrollSnapAnimatorState::setActiveSnapIndexIDForAxis):
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::resnapAfterLayout):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::updateSnapOffsets):
* Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<SnapOffset<float>>::encode):
(ArgumentCoder<SnapOffset<float>>::decode):
Canonical link: https://commits.webkit.org/254773@main
More information about the webkit-changes
mailing list