https://bugs.webkit.org/show_bug.cgi?id=227949
<rdar://problem/80895783>
Reviewed by Frédéric Wang.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-scroll-snap/snap-to-visible-areas-both-expected.txt: This bidirectional
scrolling test no longer snaps because we don't have support for choosing between two candidates
properly yet.
* web-platform-tests/css/css-scroll-snap/snap-to-visible-areas-x-axis-expected.txt: Updated to show newly passing test.
* web-platform-tests/css/css-scroll-snap/snap-to-visible-areas-y-axis-expected.txt: Ditto.
Source/WebCore:
No new tests. This is covered by two existing WPT tests.
* page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::componentForAxis): Added this helper.
(WebCore::hasCompatibleSnapArea): Added this helper that checks to see if any of the snap areas
at a given scroll snap position are compatible with the viewport.
(WebCore::adjustPreviousAndNextForOnscreenSnapAreas): Adjusts the selected previous and next snap
positions by looking backward and forward for the first compatible snap position.
(WebCore::closestSnapOffsetWithInfoAndAxis): Use the new helper.
Canonical link: https://commits.webkit.org/240633@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281189 268f45cc-cd09-0410-ab3c-d52691b4dbfc