Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[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
- Loading branch information
Showing
10 changed files
with
95 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Resnap to focused element after relayout assert_equals: After resize, should snap to row 4. expected 4 but got 3 | ||
PASS Resnap to focused element after relayout | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Scroller should snap to at least one of the targets if unable to snap toboth after a layout change. assert_true: expected true got false | ||
PASS Scroller should snap to at least one of the targets if unable to snap toboth after a layout change. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters