Bug 311469
| Summary: | SVGPointList should truncate on odd coordinate count instead of clearing the entire list | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | SVG | Assignee: | Ahmad Saleem <ahmad.saleem792> |
| Status: | RESOLVED FIXED | ||
| 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=309219 https://github.com/web-platform-tests/wpt/pull/59084 |
||
Ahmad Saleem
Hi Team,
Found recently progressed and now with missing coverage failing test, so this is to fix it.
Per SVG 2 spec [1], when a polyline/polygon points attribute contains an odd number of coordinates (e.g. "0,0 100,0 20" where the trailing y value is missing), the successfully parsed coordinate pairs should be retained. Currently WebKit rejects the entire list and returns 0 items, instead of keeping the 2 valid pairs.
This is covered by the WPT test svg/types/scripted/SVGList-parse-invalid-clears-items.html, subtest "SVGPointList truncates items when y attribute value is missing".
The fix changes SVGPointList::parse() to break out of the parse loop when x succeeds but y is missing at end-of-string, retaining already-parsed pairs. Invalid tokens (e.g. "INVALID") at any position still correctly clear the entire list.
[1] https://svgwg.org/svg2-draft/shapes.html#PolylineElement — "If an odd number of coordinates is provided, then the element is in error, with the same user agent behavior as occurs with an incorrectly specified 'path' element."
Thanks!
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/174069252>
Ahmad Saleem
Pull request: https://github.com/WebKit/WebKit/pull/62027
EWS
Committed 310798@main (31e8f16d17b1): <https://commits.webkit.org/310798@main>
Reviewed commits have been landed. Closing PR #62027 and removing active labels.