Bug 264876

Summary: [SVG2] getPointAtLength should throw exception when not in Active Document for SVGPathElement
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: REOPENED ---    
Severity: Normal CC: sabouhallawa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=269647

Description Ahmad Saleem 2023-11-15 08:12:43 PST
Hi Team,

While looking through SVG2 Web-spec (around IDL interfaces), I noticed that we need to through exception when 'getPointAtLength' is not in renderable document.

SVG Web-Spec: https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement

"The getPointAtLength method is used to return the point at a given distance along the path. When getPointAtLength(distance) is called, the following steps are run:

If current element is a non-rendered element, and the UA is not able to compute the total length of the path, then throw an InvalidStateError.'

So I think we need to update our both 'Legacy' and 'LBSE' RenderShape call sites for 'getPointAtLength' to be 'ExceptionOr<>' and throw an error.

WebKit Source: https://searchfox.org/wubkat/rev/7753b1fdea4b4605b4851dec61966b8b7247302a/Source/WebCore/rendering/svg/RenderSVGShape.cpp#312

Just wanted to raise so we can track and fix it.

Thanks!
Comment 1 Ahmad Saleem 2023-11-15 08:15:52 PST
It might progress this failing WPT test case:

https://wpt.fyi/results/svg/types/scripted/SVGGeometryElement.getPointAtLength-03.svg?label=master&label=experimental&aligned=&q=getpointatlength

"When SVGGeometryElement.getPointAtLength is called with an element that is not in the document, either succeed or throw exception with SVGPathElement"
Comment 2 Radar WebKit Bug Importer 2023-11-22 08:13:14 PST
<rdar://problem/118720630>
Comment 3 EWS 2024-02-08 13:20:21 PST
Committed 274308@main (9f2facf9ef6d): <https://commits.webkit.org/274308@main>

Reviewed commits have been landed. Closing PR #23699 and removing active labels.
Comment 4 Ahmad Saleem 2024-02-17 14:28:03 PST
Reverted 274929@main