Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c3aca8ab0133d23a5dab22681ac48710c149b947
https://github.com/WebKit/WebKit/commit/c3aca8ab0133d23a5dab22681ac48710c149b947
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-06-13 (Sat, 13 Jun 2026)
Changed paths:
M Source/WebCore/rendering/svg/RenderSVGText.cpp
Log Message:
-----------
[LBSE] Hit-test SVG text per glyph in its SVG coordinate system
https://bugs.webkit.org/show_bug.cgi?id=317072
Reviewed by Rob Buis.
RenderSVGText::nodeAtPoint forwarded locationInContainer and accumulatedOffset
straight to RenderBlock. That works for the hitTestChildrenInDOMOrderForSVG
path, which queries only in the Foreground phase with the point already in
SVG space. But a (force-created) text layer is hit-tested via RenderObject's
hitTest(): the point arrives in the layer's own space with a zero offset, and
the Float and ChildBlockBackgrounds phases run too. Since the
inline text fragments use absolute positions in the element's SVG coordinate
system, the unshifted point missed every glyph -> on-glyph clicks only appeared
to work because those extra phases fell back to RenderBlock and hit the text's
block box, which also wrongly claimed off-glyph points inside the box....
The fix mirrors RenderSVGShape::nodeAtPoint. It bails out unless hitTestAction
is Foreground, so the block-box phases never run, and expresses the query in
the SVG coordinate system by shifting both the location (rect-preserving, so
eventSender rect-based tests keep their tolerance) and the offset by
coordinateSystemOriginTranslation (= nominalSVGLayoutLocation -
adjustedLocation). The forwarded offset becomes nominal - location(), matching
the hitTestChildrenInDOMOrderForSVG path.
Unchanged test results in the conditional layer creation mode (not upstream
yet),
and fixes all svg/hittest/text-* + svg/custom/pointer-events-text-css-transform
when forcing layer creation.
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::nodeAtPoint):
Canonical link: https://commits.webkit.org/315172@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications