Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b04fe9e14617304510fe7674ded5a1b8432751ce
https://github.com/WebKit/WebKit/commit/b04fe9e14617304510fe7674ded5a1b8432751ce
Author: Kiet Ho <[email protected]>
Date: 2026-04-21 (Tue, 21 Apr 2026)
Changed paths:
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderObjectEnums.h
M Source/WebCore/style/AnchorPositionEvaluator.cpp
M Source/WebCore/style/AnchorPositionEvaluator.h
Log Message:
-----------
[css-anchor-position-1] Use localToContainerQuad to compute anchor rect in
container
rdar://175037950
https://bugs.webkit.org/show_bug.cgi?id=312605
Reviewed by Antti Koivisto.
AnchorPositionEvaluator uses offsetFromAncestorContainer (local static) to
compute
the location of a box relative to its ancestor. It is identical to
RenderObject::offsetFromAncestorContainer, just with some anchor positioning
fixups.
It does not take transforms into account though, therefore it'll not work
correctly
with a transformed box. To make anchor positioning work with transformed anchor
boxes,
this patch refactors the function to use RenderObject::localToContainerQuad,
which can be configured to use transforms. For now this is disabled to preserve
old behavior, future patches will enable it to make transformed anchors work
with
anchor positioning.
Refactoring, tested by existing anchor positioning tests.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer const):
- Add MapCoordinatesMode to clamp overscroll; this behavior was in
offsetFromAncestorContainer and is preserved here.
* Source/WebCore/rendering/RenderObjectEnums.h:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::boxBoundingBoxInContainer):
- Renamed from offsetFromAncestorContainer, this function now returns both
the box
location and size (as both can be affected by transforms)
- Switch to using RenderObject::localToContainerQuad.
- Rename arguments name to be shorter.
(WebCore::Style::boundingRectForFragmentedAnchor):
(WebCore::Style::AnchorPositionEvaluator::computeAnchorRectRelativeToContainingBlock):
- Use anchor width/height computed from boxBoundingBoxInContainer instead
of taking
it directly from the renderer.
- Use isFixed() to determine if an anchor/anchor-positioned is fixed
positioned.
(WebCore::Style::computeInsetValue):
(WebCore::Style::AnchorPositionEvaluator::evaluateSize):
(WebCore::Style::offsetFromAncestorContainer): Deleted.
* Source/WebCore/style/AnchorPositionEvaluator.h:
Canonical link: https://commits.webkit.org/311715@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications