Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f0a7b53a2373c20188d6e2572bb7028cbc034a52
https://github.com/WebKit/WebKit/commit/f0a7b53a2373c20188d6e2572bb7028cbc034a52
Author: Kiet Ho <[email protected]>
Date: 2026-04-29 (Wed, 29 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/transform-012-expected.txt
M Source/WebCore/style/AnchorPositionEvaluator.cpp
M Source/WebCore/style/StyleScope.cpp
Log Message:
-----------
[css-anchor-position-1] Position anchor-positioned element relative to
transformed anchor box
rdar://175401339
https://bugs.webkit.org/show_bug.cgi?id=313104
Reviewed by Antti Koivisto.
This patch changes boxBoundingBoxInContainer (in AnchorPositionEvaluator.cpp)
to apply transforms to the computed bounding box. This makes
AnchorPositionEvaluator::computeAnchorRectRelativeToContainingBlock returns
the transformed anchor rect, which allows anchor-positioning features to
position
elements relative to the transformed anchor rect.
Tests:
imported/w3c/web-platform-tests/css/css-anchor-position/transform-001.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-002.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-003.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-004.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-007.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-008.html
imported/w3c/web-platform-tests/css/css-anchor-position/transform-009.html
* LayoutTests/TestExpectations:
- Some anchor position x transform tests are now passing.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/transform-012-expected.txt:
- Rebaseline. This tests anchor position x animated transforms,
which shouldn't pass in the first place.
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::boxBoundingBoxInContainer):
- Apply transforms to the computed bounding box.
(WebCore::Style::boundingRectForFragmentedAnchor):
(WebCore::Style::AnchorPositionEvaluator::evaluateSize):
- Use AnchorPositionEvaluator::computeAnchorRectRelativeToContainingBlock to
compute the anchor bounding box instead of getting it directly from the
anchor renderer. This ensures the resulting size is after transforms, if
any.
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::invalidateForAnchorDependencies):
- Use absoluteBoundingBoxRect() to capture the anchor bounding box rect,
as it includes transforms.
Canonical link: https://commits.webkit.org/312317@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications