Diff
Modified: trunk/LayoutTests/ChangeLog (268855 => 268856)
--- trunk/LayoutTests/ChangeLog 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/ChangeLog 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,23 @@
+2020-10-22 Martin Robinson <[email protected]>
+
+ Scroll snap: don't create implicit snap points at scrollmin/scrollmax
+ https://bugs.webkit.org/show_bug.cgi?id=216882
+ <rdar://problem/69443288>
+
+ Reviewed by Simon Fraser.
+
+ * TestExpectations: Mark some tests as passing.
+ * css3/scroll-snap/nested-elements-expected.txt: Update results to eliminate implicit stops.
+ * css3/scroll-snap/scroll-snap-children-with-padding-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-children-with-transforms-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-elements-container-larger-than-children-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-elements-container-larger-than-children-rtl-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-offsets-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-positions-expected.txt: Ditto.
+ * css3/scroll-snap/scroll-snap-with-scroll-padding-expected.txt: Ditto.
+
2020-10-21 Karl Rackler <[email protected]>
REGRESSION: [ Big Sur ] fast/text/international/complex-character-based-fallback.html is a constant failure
Modified: trunk/LayoutTests/TestExpectations (268855 => 268856)
--- trunk/LayoutTests/TestExpectations 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/TestExpectations 2020-10-22 07:32:40 UTC (rev 268856)
@@ -4509,8 +4509,6 @@
imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/direction-rtl.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-horizontal-tb.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-vertical-lr.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/writing-mode-vertical-rl.html [ ImageOnlyFailure ]
# Cocoa-only
http/tests/media/hls/hls-hdr-switch.html [ Skip ]
Modified: trunk/LayoutTests/css3/scroll-snap/nested-elements-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/nested-elements-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/nested-elements-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,4 +1,4 @@
-Scroll-snap offsets for 'container': vertical = { 0, 100, 215, 330, 445, 560, 675, 790, 905, 1020, 1135, 1250, 1365, 1480, 1595, 1710, 1825, 1940, 2055, 2170, 4900 }
+Scroll-snap offsets for 'container': vertical = { 100, 215, 330, 445, 560, 675, 790, 905, 1020, 1135, 1250, 1365, 1480, 1595, 1710, 1825, 1940, 2055, 2170 }
PASS Scroll-snap offsets for 'invalidContainer': UNDEFINED
PASS successfullyParsed is true
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-padding-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-padding-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-padding-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,2 +1,2 @@
-Scroll-snap offsets are: vertical = { 0, 10, 625, 1240, 1660, 2275, 2890, 2900 }
+Scroll-snap offsets are: vertical = { 10, 625, 1240, 1660, 2275, 2890 }
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,5 +1,5 @@
-Scroll-snap offsets are: vertical = { 0, 700, 1410, 2120, 2830, 3540, 3600 }
-After resizing, the offsets should not have changed: vertical = { 0, 700, 1410, 2120, 2830, 3540, 3600 }
-After deflating scroll-snap-margin by 10px, the offsets are: vertical = { 0, 710, 1420, 2130, 2840, 3550, 3600 }
-After resizing, the offsets should not have changed: vertical = { 0, 710, 1420, 2130, 2840, 3550, 3600 }
+Scroll-snap offsets are: vertical = { 0, 700, 1410, 2120, 2830, 3540 }
+After resizing, the offsets should not have changed: vertical = { 0, 700, 1410, 2120, 2830, 3540 }
+After deflating scroll-snap-margin by 10px, the offsets are: vertical = { 0, 710, 1420, 2130, 2840, 3550 }
+After resizing, the offsets should not have changed: vertical = { 0, 710, 1420, 2130, 2840, 3550 }
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-transforms-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-transforms-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-children-with-transforms-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,5 +1,5 @@
-Scroll-snap offsets are: vertical = { 0, 83, 752, 1457, 2233, 2880, 3673 }
-After resizing, the offsets should not have changed: vertical = { 0, 83, 752, 1457, 2233, 2880, 3673 }
-After changing alignment to `start`, the offsets are: vertical = { 0, 688, 1423, 2087, 2880, 3527, 3673 }
-After resizing, the offsets should not have changed: vertical = { 0, 688, 1423, 2087, 2880, 3527, 3673 }
+Scroll-snap offsets are: vertical = { 83, 752, 1457, 2233, 2880, 3673 }
+After resizing, the offsets should not have changed: vertical = { 83, 752, 1457, 2233, 2880, 3673 }
+After changing alignment to `start`, the offsets are: vertical = { 0, 688, 1423, 2087, 2880, 3527 }
+After resizing, the offsets should not have changed: vertical = { 0, 688, 1423, 2087, 2880, 3527 }
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,4 +1,4 @@
-Scroll-snap offsets: horizontal = { 0, 200, 400, 600, 800, 1000, 1500 }
+Scroll-snap offsets: horizontal = { 0, 200, 400, 600, 800, 1000 }
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-rtl-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-rtl-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-elements-container-larger-than-children-rtl-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,4 +1,4 @@
-Scroll-snap offsets: horizontal = { 0, 100, 300, 500, 700, 900, 1500 }
+Scroll-snap offsets: horizontal = { 0, 100, 300, 500, 700, 900 }
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -3,12 +3,12 @@
Scroll-snap offsets for verticalTarget: vertical = { 0, 30, 60, 90, 120, 150 }
Scroll-snap offsets for horizontalBorderedTarget: horizontal = { 0, 30, 60, 90, 120, 150 }
Scroll-snap offsets for verticalBorderedTarget: vertical = { 0, 30, 60, 90, 120, 150 }
-Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 0, 20, 50, 80, 110, 140 }
-Scroll-snap offsets for verticalPaddedTarget: vertical = { 0, 15, 45, 75, 105, 135, 150 }
-Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 0, 20, 50, 80, 110, 140 }
-Scroll-snap offsets for verticalBorderedPaddedTarget: vertical = { 0, 15, 45, 75, 105, 135, 150 }
-Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 0, 20, 50, 80, 110, 140 }
-Scroll-snap offsets for verticalRotatedTarget: vertical = { 0, 15, 45, 75, 105, 135, 150 }
+Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 20, 50, 80, 110, 140 }
+Scroll-snap offsets for verticalPaddedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
+Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 20, 50, 80, 110, 140 }
+Scroll-snap offsets for verticalBorderedPaddedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
+Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 20, 50, 80, 110, 140 }
+Scroll-snap offsets for verticalRotatedTarget: vertical = { 15, 45, 75, 105, 135, 150 }
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-offsets-rtl-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,9 +1,9 @@
Tests that the scroll-snap feature works properly in overflow regions.
Scroll-snap offsets for horizontalTarget: horizontal = { 0, 100, 200, 300, 400, 500 }
Scroll-snap offsets for horizontalBorderedTarget: horizontal = { 0, 100, 200, 300, 400, 500 }
-Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470, 480 }
-Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470, 480 }
-Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 0, 70, 170, 270, 370, 470, 480 }
+Scroll-snap offsets for horizontalPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
+Scroll-snap offsets for horizontalBorderedPaddedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
+Scroll-snap offsets for horizontalRotatedTarget: horizontal = { 0, 70, 170, 270, 370, 470 }
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-positions-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-positions-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-positions-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,4 +1,4 @@
-Scroll-snap offsets for 'container': vertical = { 0, 73, 100, 330, 445, 560, 675, 763, 790, 993, 1020, 1250, 1310, 1365, 1425, 1480, 4425 }
+Scroll-snap offsets for 'container': vertical = { 73, 100, 330, 445, 560, 675, 763, 790, 993, 1020, 1250, 1310, 1365, 1425, 1480 }
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-with-scroll-padding-expected.txt (268855 => 268856)
--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-with-scroll-padding-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-with-scroll-padding-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,5 +1,5 @@
-Scroll-snap offsets are: vertical = { 0, 670, 1390, 2110, 2830, 3550, 3600 }
-After resizing, the offsets should not have changed: vertical = { 0, 670, 1390, 2110, 2830, 3550, 3600 }
+Scroll-snap offsets are: vertical = { 0, 670, 1390, 2110, 2830, 3550 }
+After resizing, the offsets should not have changed: vertical = { 0, 670, 1390, 2110, 2830, 3550 }
After removing scroll-padding, the offsets are: vertical = { 0, 720, 1440, 2160, 2880, 3600 }
After resizing, the offsets should not have changed: vertical = { 0, 720, 1440, 2160, 2880, 3600 }
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,19 @@
+2020-10-22 Martin Robinson <[email protected]>
+
+ Scroll snap: don't create implicit snap points at scrollmin/scrollmax
+ https://bugs.webkit.org/show_bug.cgi?id=216882
+ <rdar://problem/69443288>
+
+ Reviewed by Simon Fraser.
+
+ Update expectations for these tests.
+
+ * web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps-expected.txt:
+ * web-platform-tests/css/css-scroll-snap/snap-after-relayout/adding-only-snap-area-expected.txt:
+ * web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-expected.txt:
+ * web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt:
+ * web-platform-tests/css/css-scroll-snap/snap-area-capturing-remove-scroll-container-expected.txt:
+
2020-10-21 Alex Christensen <[email protected]>
Update and pass new URL web platform tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps-expected.txt (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/nested-scrollIntoView-snaps-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,3 @@
-FAIL All the scrollers affected by scrollIntoView should land on a snap position if one exists. Otherwise, land according to the specified alignment assert_equals: ScrollIntoView lands on the target's snap position regardless of the specified alignment. expected 615 but got 800
+FAIL All the scrollers affected by scrollIntoView should land on a snap position if one exists. Otherwise, land according to the specified alignment assert_equals: expected 0 but got 615
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/adding-only-snap-area-expected.txt (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/adding-only-snap-area-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/adding-only-snap-area-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,3 @@
-FAIL Adding a new snap area when there are none should make the scroller snap to it. assert_equals: expected 100 but got 0
+PASS Adding a new snap area when there are none should make the scroller snap to it.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-expected.txt (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,6 +1,6 @@
FAIL Changing the current target's snap alignment should make the scroller resnap to it even if another snap position is closer to the current offset assert_equals: expected 100 but got 0
FAIL Removing the current target's snap alignment should make the scroller resnap to a new snap area. assert_equals: expected 100 but got 0
-FAIL Changing an element snap alignment from none to start should make thescroller resnap. assert_equals: expected 100 but got 0
-FAIL Changing an element snap alignment from none to start by adding a class should make the scroller resnap. assert_equals: expected 100 but got 0
+PASS Changing an element snap alignment from none to start should make thescroller resnap.
+PASS Changing an element snap alignment from none to start by adding a class should make the scroller resnap.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-relayout/snap-to-different-targets-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -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_equals: expected 200 but got 0
+FAIL Scroller should snap to at least one of the targets if unable to snap toboth after a layout change. assert_equals: expected 200 but got 400
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-area-capturing-remove-scroll-container-expected.txt (268855 => 268856)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-area-capturing-remove-scroll-container-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-area-capturing-remove-scroll-container-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,3 @@
-FAIL Making a snap container not scrollable should promote the next scrollable ancestor to become a snap container. assert_equals: expected 300 but got 10
+FAIL Making a snap container not scrollable should promote the next scrollable ancestor to become a snap container. assert_equals: expected 300 but got 310
Modified: trunk/LayoutTests/platform/ios/css3/scroll-snap/nested-elements-expected.txt (268855 => 268856)
--- trunk/LayoutTests/platform/ios/css3/scroll-snap/nested-elements-expected.txt 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/LayoutTests/platform/ios/css3/scroll-snap/nested-elements-expected.txt 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,4 +1,4 @@
-Scroll-snap offsets for 'container': vertical = { 0, 100, 215, 330, 445, 560, 675, 790, 905, 1020, 1135, 1250, 1365, 1480, 1595, 1710, 1825, 1940, 2055, 2170, 4885 }
+Scroll-snap offsets for 'container': vertical = { 100, 215, 330, 445, 560, 675, 790, 905, 1020, 1135, 1250, 1365, 1480, 1595, 1710, 1825, 1940, 2055, 2170 }
PASS Scroll-snap offsets for 'invalidContainer': UNDEFINED
PASS successfullyParsed is true
Modified: trunk/Source/WebCore/ChangeLog (268855 => 268856)
--- trunk/Source/WebCore/ChangeLog 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/Source/WebCore/ChangeLog 2020-10-22 07:32:40 UTC (rev 268856)
@@ -1,3 +1,18 @@
+2020-10-22 Martin Robinson <[email protected]>
+
+ Scroll snap: don't create implicit snap points at scrollmin/scrollmax
+ https://bugs.webkit.org/show_bug.cgi?id=216882
+ <rdar://problem/69443288>
+
+ Reviewed by Simon Fraser.
+
+ * page/scrolling/AxisScrollSnapOffsets.cpp:
+ (WebCore::updateSnapOffsetsForScrollableArea): No longer call adjustmentForTextAutosizing and
+ only conditionally adjust the scroll area by the scroll offset, becauase mapping to container
+ coordinates only applies container scroll offsets in the case that the container is not a
+ ScrollView.
+ (WebCore::adjustAxisSnapOffsetsForScrollExtent): Deleted.
+
2020-10-21 Alex Christensen <[email protected]>
Update and pass new URL web platform tests
Modified: trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp (268855 => 268856)
--- trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp 2020-10-22 06:43:54 UTC (rev 268855)
+++ trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp 2020-10-22 07:32:40 UTC (rev 268856)
@@ -136,18 +136,6 @@
}
}
-static void adjustAxisSnapOffsetsForScrollExtent(Vector<LayoutUnit>& snapOffsets, float maxScrollExtent)
-{
- if (snapOffsets.isEmpty())
- return;
-
- std::sort(snapOffsets.begin(), snapOffsets.end());
- if (snapOffsets.last() != maxScrollExtent)
- snapOffsets.append(maxScrollExtent);
- if (snapOffsets.first())
- snapOffsets.insert(0, 0);
-}
-
static void computeAxisProximitySnapOffsetRanges(const Vector<LayoutUnit>& snapOffsets, Vector<ScrollOffsetRange<LayoutUnit>>& offsetRanges, LayoutUnit scrollPortAxisLength)
{
// This is an arbitrary choice for what it means to be "in proximity" of a snap offset. We should play around with
@@ -206,7 +194,12 @@
// The snap area is the bounding box of the child element's border box, after applying transformations.
// FIXME: For now, just consider whether the scroller is RTL. The behavior of LTR boxes inside a RTL scroller is poorly defined: https://github.com/w3c/csswg-drafts/issues/5361.
auto scrollSnapArea = LayoutRect(child->localToContainerQuad(FloatQuad(child->borderBoundingBox()), scrollingElement.renderBox()).boundingBox());
- scrollSnapArea.moveBy(scrollPosition);
+
+ // localToContainerQuad will transform the scroll snap area by the scroll position, except in the case that this position is
+ // coming from a ScrollView. We want the transformed area, but without scroll position taken into account.
+ if (!scrollableArea.isScrollView())
+ scrollSnapArea.moveBy(scrollPosition);
+
scrollSnapArea = computeScrollSnapPortOrAreaRect(scrollSnapArea, child->style().scrollSnapMargin(), InsetOrOutset::Outset);
LOG_WITH_STREAM(ScrollSnap, stream << " Considering scroll snap target area " << scrollSnapArea);
auto alignment = child->style().scrollSnapAlign();
@@ -229,12 +222,13 @@
}
if (!horizontalSnapOffsets.isEmpty()) {
- adjustAxisSnapOffsetsForScrollExtent(horizontalSnapOffsets, maxScrollOffset.x());
- LOG_WITH_STREAM(ScrollSnap, stream << " => Computed horizontal scroll snap offsets: " << horizontalSnapOffsets);
- LOG_WITH_STREAM(ScrollSnap, stream << " => Computed horizontal scroll snap offset ranges: " << horizontalSnapOffsetRanges);
+ std::sort(horizontalSnapOffsets.begin(), horizontalSnapOffsets.end());
if (scrollSnapType.strictness == ScrollSnapStrictness::Proximity)
computeAxisProximitySnapOffsetRanges(horizontalSnapOffsets, horizontalSnapOffsetRanges, scrollSnapPort.width());
+ LOG_WITH_STREAM(ScrollSnap, stream << " => Computed horizontal scroll snap offsets: " << horizontalSnapOffsets);
+ LOG_WITH_STREAM(ScrollSnap, stream << " => Computed horizontal scroll snap offset ranges: " << horizontalSnapOffsetRanges);
+
scrollableArea.setHorizontalSnapOffsets(horizontalSnapOffsets);
scrollableArea.setHorizontalSnapOffsetRanges(horizontalSnapOffsetRanges);
} else
@@ -241,12 +235,13 @@
scrollableArea.clearHorizontalSnapOffsets();
if (!verticalSnapOffsets.isEmpty()) {
- adjustAxisSnapOffsetsForScrollExtent(verticalSnapOffsets, maxScrollOffset.y());
- LOG_WITH_STREAM(ScrollSnap, stream << " => Computed vertical scroll snap offsets: " << verticalSnapOffsets);
- LOG_WITH_STREAM(ScrollSnap, stream << " => Computed vertical scroll snap offset ranges: " << verticalSnapOffsetRanges);
+ std::sort(verticalSnapOffsets.begin(), verticalSnapOffsets.end());
if (scrollSnapType.strictness == ScrollSnapStrictness::Proximity)
computeAxisProximitySnapOffsetRanges(verticalSnapOffsets, verticalSnapOffsetRanges, scrollSnapPort.height());
+ LOG_WITH_STREAM(ScrollSnap, stream << " => Computed vertical scroll snap offsets: " << verticalSnapOffsets);
+ LOG_WITH_STREAM(ScrollSnap, stream << " => Computed vertical scroll snap offset ranges: " << verticalSnapOffsetRanges);
+
scrollableArea.setVerticalSnapOffsets(verticalSnapOffsets);
scrollableArea.setVerticalSnapOffsetRanges(verticalSnapOffsetRanges);
} else