Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 625c8663227c385ca6052e537c54ed3dc865f059
https://github.com/WebKit/WebKit/commit/625c8663227c385ca6052e537c54ed3dc865f059
Author: Alan Baradlay <[email protected]>
Date: 2026-04-13 (Mon, 13 Apr 2026)
Changed paths:
A LayoutTests/fast/css/first-letter-client-rects-expected.txt
A LayoutTests/fast/css/first-letter-client-rects.html
M Source/WebCore/rendering/RenderObject.cpp
Log Message:
-----------
Range.getClientRects() returns wrong rect for first-letter styled text
https://bugs.webkit.org/show_bug.cgi?id=219087
<rdar://problem/71546397>
Reviewed by Antti Koivisto.
When a text node has ::first-letter styling, WebKit splits it into two
renderers: one for the first letter, one for the rest. But
Range.getClientRects() only asks the "rest" renderer, passing DOM
offsets that don't match its local offsets.
For example, with "AB" where "A" is the first letter:
1. DOM offset 0 maps to nothing in the remaining fragment (starts at 1)
2. getClientRects(0, 1) returns the rect for "B" instead of "A"
The fix splits the range at the first-letter boundary and queries both
renderers with their respective local offsets.
* LayoutTests/fast/css/first-letter-client-rects-expected.txt: Added.
* LayoutTests/fast/css/first-letter-client-rects.html: Added.
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::absoluteRectsForRangeInText):
Canonical link: https://commits.webkit.org/311085@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications