Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d104e1e1f738efacc87036848494568fe29ceab1
https://github.com/WebKit/WebKit/commit/d104e1e1f738efacc87036848494568fe29ceab1
Author: Alan Baradlay <[email protected]>
Date: 2026-08-17 (Mon, 17 Aug 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-inline-box-vrl-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-inline-box-vrl.html
M Source/WebCore/style/AnchorPositionEvaluator.cpp
Log Message:
-----------
anchor(right) does not resolve to an inline anchor's right edge in vertical-rl
https://bugs.webkit.org/show_bug.cgi?id=321879
Reviewed by Antti Koivisto.
boxBoundingBoxInContainer maps the anchor's box into the containing block with
localToContainerQuad. For a
RenderInline, borderBoundingBox() is a rect at the origin carrying only the
size (see RenderInline.h), so
what gets mapped has no position, and the position was added afterwards from
linesBoundingBox().location().
That composes in an unflipped writing mode but not in a flipped one, where
mapping through a box flips
against that box's own size: the flip lands on a rect sitting at the origin.
Map the line boxes' rect
instead, which carries the position through the flip.
Measured for a 200px wide containing block in vertical-rl, with the anchor one
Ahem glyph on the second line:
anchor(right) is 180 and the anchored element's left edge came out at 220. The
error is the anchor's block
axis offset doubled, so it grows per line: 40 with one line break, 80 with two.
The inline needs a non-zero block axis offset, which is why the last case in
the test passes without this
change. Anonymous block generation hides the other cases where the anchor's
inline content sits in an
anonymous block of its own, because that block's block axis extent equals the
inline's and flipping inside
it is a no-op.
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::boxBoundingBoxInContainer):
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-inline-box-vrl.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-inline-box-vrl-expected.txt:
Added.
Canonical link: https://commits.webkit.org/319286@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications