Modified: trunk/LayoutTests/ChangeLog (283545 => 283546)
--- trunk/LayoutTests/ChangeLog 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/LayoutTests/ChangeLog 2021-10-05 12:10:00 UTC (rev 283546)
@@ -1,3 +1,12 @@
+2021-10-05 Martin Robinson <[email protected]>
+
+ [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
+ https://bugs.webkit.org/show_bug.cgi?id=230689
+
+ Reviewed by Simon Fraser.
+
+ * platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Removed.
+
2021-10-05 Youenn Fablet <[email protected]>
Removing no longer needed flaky expectations from WebRTC tests
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283545 => 283546)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-05 12:10:00 UTC (rev 283546)
@@ -1,3 +1,13 @@
+2021-10-05 Martin Robinson <[email protected]>
+
+ [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
+ https://bugs.webkit.org/show_bug.cgi?id=230689
+
+ Reviewed by Simon Fraser.
+
+ * web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt: Update results to show newly
+ passing test.
+
2021-10-05 Myles C. Maxfield <[email protected]>
Test a font palette identifier of just "--"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt (283545 => 283546)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt 2021-10-05 12:10:00 UTC (rev 283546)
@@ -5,5 +5,5 @@
Title 3
-FAIL scrolling a sticky element into view should use its unshifted position assert_approx_equals: expected 1122 +/- 1 but got 561
+PASS scrolling a sticky element into view should use its unshifted position
Deleted: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt (283545 => 283546)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-scrollIntoView-expected.txt 2021-10-05 12:10:00 UTC (rev 283546)
@@ -1,9 +0,0 @@
-Title 1
-
-Title 2
-
-Title 3
-
-
-FAIL scrolling a sticky element into view should use its unshifted position assert_approx_equals: expected 1120 +/- 1 but got 560
-
Modified: trunk/Source/WebCore/ChangeLog (283545 => 283546)
--- trunk/Source/WebCore/ChangeLog 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/Source/WebCore/ChangeLog 2021-10-05 12:10:00 UTC (rev 283546)
@@ -1,3 +1,21 @@
+2021-10-05 Martin Robinson <[email protected]>
+
+ [css-position-sticky] scrollIntoView should not take into account sticky positioning offsets
+ https://bugs.webkit.org/show_bug.cgi?id=230689
+
+ Reviewed by Simon Fraser.
+
+ When calculating the location for absolute anchors rectangles,
+ do not take into account sticky offsets. This means that when
+ scrolling to elements that are stickily positioned, their static
+ positions will be targeted.
+
+ No new tests. This is covered by an existing WPT test.
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::getLeadingCorner const): Do not take into account sticky position when calculating this point.
+ (WebCore::RenderElement::getTrailingCorner const): Ditto.
+
2021-10-05 Tim Nguyen <[email protected]>
Replace document.topDocument().securityOrigin() with document.topOrigin()
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (283545 => 283546)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-10-05 11:48:34 UTC (rev 283545)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-10-05 12:10:00 UTC (rev 283546)
@@ -1613,8 +1613,12 @@
bool RenderElement::getLeadingCorner(FloatPoint& point, bool& insideFixed) const
{
+ // When scrolling elements into view, ignore sticky offsets and scroll to the static
+ // position of the element. See: https://drafts.csswg.org/css-position/#stickypos-scroll.
+ OptionSet<MapCoordinatesMode> localToAbsoluteMode { UseTransforms, IgnoreStickyOffsets };
+
if (!isInline() || isReplaced()) {
- point = localToAbsolute(FloatPoint(), UseTransforms, &insideFixed);
+ point = localToAbsolute(FloatPoint(), localToAbsoluteMode, &insideFixed);
return true;
}
@@ -1640,7 +1644,7 @@
ASSERT(o);
if (!o->isInline() || o->isReplaced()) {
- point = o->localToAbsolute(FloatPoint(), UseTransforms, &insideFixed);
+ point = o->localToAbsolute(FloatPoint(), localToAbsoluteMode, &insideFixed);
return true;
}
@@ -1654,7 +1658,7 @@
point.move(textRenderer.linesBoundingBox().x(), run->line()->top());
} else if (is<RenderBox>(*o))
point.moveBy(downcast<RenderBox>(*o).location());
- point = o->container()->localToAbsolute(point, UseTransforms, &insideFixed);
+ point = o->container()->localToAbsolute(point, localToAbsoluteMode, &insideFixed);
return true;
}
}
@@ -1670,8 +1674,12 @@
bool RenderElement::getTrailingCorner(FloatPoint& point, bool& insideFixed) const
{
+ // When scrolling elements into view, ignore sticky offsets and scroll to the static
+ // position of the element. See: https://drafts.csswg.org/css-position/#stickypos-scroll.
+ OptionSet<MapCoordinatesMode> localToAbsoluteMode { UseTransforms, IgnoreStickyOffsets };
+
if (!isInline() || isReplaced()) {
- point = localToAbsolute(LayoutPoint(downcast<RenderBox>(*this).size()), UseTransforms, &insideFixed);
+ point = localToAbsolute(LayoutPoint(downcast<RenderBox>(*this).size()), localToAbsoluteMode, &insideFixed);
return true;
}
@@ -1702,7 +1710,7 @@
point.moveBy(linesBox.maxXMaxYCorner());
} else
point.moveBy(downcast<RenderBox>(*o).frameRect().maxXMaxYCorner());
- point = o->container()->localToAbsolute(point, UseTransforms, &insideFixed);
+ point = o->container()->localToAbsolute(point, localToAbsoluteMode, &insideFixed);
return true;
}
}