Bug 328044

Summary: [SVG] <textPath href> to a basic shape does not follow later changes to the shape
Product: WebKit Reporter: Karl Dubost <karlcow>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: sabouhallawa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: Safari 26   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=15799
https://bugs.webkit.org/show_bug.cgi?id=103811
https://bugs.webkit.org/show_bug.cgi?id=328049
Attachments:
Description Flags
probe-textpath-href-basic-shape-live-update.html none

Karl Dubost
Reported 2026-10-19 02:29:53 PDT
SVG 2 lets a textPath href point at a basic shape as well as a path: "An URL reference to the path element or basic shape element onto which the glyphs will be rendered" (https://w3c.github.io/svgwg/svg2-draft/text.html#TextPathElementHrefAttribute). WebKit lays the text out on the shape the first time. After that, changing the shape does not move the text. A path target does follow. Test case: a text with <textPath href="#s">, where #s is a rect, circle, ellipse, line or polygon. After the first layout, move the shape (for example rect y from 20 to 120), then read getStartPositionOfChar(3). path (control): y 100 -> 150, follows rect, circle, ellipse, line, polygon: unchanged Cause: SVGTextPathElement::buildPendingResource() calls addReferencingElement() only when the target is an SVGPathElement (SVGTextPathElement.cpp:180), and SVGPathElement::invalidatePathDependencies() is what tells the textPath. RenderSVGTextPath::layoutPath() already accepts any SVGGeometryElement. Other engines, same probe: * Firefox 160 follows all six. * Chrome Canary 158 never puts the text on the shape (position (0,0) before any edit): Blink's LayoutSVGTextPath::LayoutPath() only accepts an SVGPathElement. That is a separate gap, not this bug. I will add more WPT. Probe attached.
Attachments
probe-textpath-href-basic-shape-live-update.html (10.12 KB, text/html)
2026-10-19 02:31 PDT, Karl Dubost
no flags
Karl Dubost
Comment 1 2026-10-19 02:31:20 PDT
Created attachment 481890 [details] probe-textpath-href-basic-shape-live-update.html
Karl Dubost
Comment 2 2026-10-19 02:38:17 PDT
I also opened https://github.com/w3c/svgwg/issues/1212 for SVG2 spec part, which lacks clarification.
Radar WebKit Bug Importer
Comment 3 2026-10-26 02:30:13 PDT
Note You need to log in before you can comment on or make changes to this bug.