Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fe7bcd9ee8c281bba22ebb9f92c3c845339da4ee
https://github.com/WebKit/WebKit/commit/fe7bcd9ee8c281bba22ebb9f92c3c845339da4ee
Author: Elika Etemad <[email protected]>
Date: 2026-06-06 (Sat, 06 Jun 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-001-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-001.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-002-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-002.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-003-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-003.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-001-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-002-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-003-ref.html
M Source/WebCore/style/AnchorPositionEvaluator.cpp
M Source/WebCore/style/AnchorPositionEvaluator.h
Log Message:
-----------
Anchor positioning: abspos elements can anchor to viewport-fixedpos elements
https://bugs.webkit.org/show_bug.cgi?id=307171
rdar://170323196
Reviewed by Kiet Ho.
We didn't account for non-fixed anchor-positioned boxes anchoring to fixed
boxes.
Detect this case and:
a) Calculate the offset in consideration of our scroll position.
b) Create an AnchorScrollAdjuster that compensates correctly.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-001-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-001.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-002-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-002.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-003-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-abspos-to-fixedpos-003.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-001-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-002-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/reference/anchor-abspos-to-fixedpos-003-ref.html:
Added.
Add tests.
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::AnchorScrollAdjuster::addViewportSnapshot):
(WebCore::AnchorScrollAdjuster::adjustmentForViewport const):
Implement parameter to track whether we're inverting the viewport adjustment.
(WebCore::Style::AnchorPositionEvaluator::captureScrollSnapshots):
Detect the case of a non-fixed box attaching to a fixed box, and create an
inverted scroll adjustment for it.
(WebCore::Style::AnchorPositionEvaluator::computeAnchorRectRelativeToContainingBlock):
Detect the case of a non-fixed box attaching to a fixed box, and make sure
to calculate the scroll compensation for it.
* Source/WebCore/style/AnchorPositionEvaluator.h:
(WebCore::AnchorScrollAdjuster::hasViewportSnapshot const):
Add parameter to track whether we're inverting the viewport adjustment.
Canonical link: https://commits.webkit.org/314706@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications