Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a88e27a8c6a35e444d9908c3bd7d7f3914125f86
https://github.com/WebKit/WebKit/commit/a88e27a8c6a35e444d9908c3bd7d7f3914125f86
Author: Ahmad Saleem <[email protected]>
Date: 2025-11-27 (Thu, 27 Nov 2025)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-expected.txt
M LayoutTests/svg/custom/invalid-length-units-expected.txt
M LayoutTests/svg/dom/valueAsString-null-expected.txt
M LayoutTests/svg/parser/whitespace-length-invalid-1-expected.txt
M LayoutTests/svg/parser/whitespace-length-invalid-2-expected.txt
M LayoutTests/svg/parser/whitespace-length-invalid-3-expected.txt
M LayoutTests/svg/parser/whitespace-length-invalid-4-expected.txt
M Source/WebCore/svg/SVGLengthValue.cpp
Log Message:
-----------
SVGLength.valueAsString should throw SyntaxError for empty strings
https://bugs.webkit.org/show_bug.cgi?id=303125
rdar://165429393
Reviewed by Anne van Kesteren.
The SVGLength.valueAsString setter was incorrectly accepting empty
strings and returning success, when it should throw a SyntaxError
according to the SVG specification [1]. An empty string fails to parse
as [ <number> | <length> | <percentage> ], so per the spec's step 4
("If parsing failed, then throw a SyntaxError"), an exception must
be thrown.
This change makes SVGLengthValue::setValueAsString() throw a
SyntaxError when given an empty string, aligning with the expected
behavior and matching other browsers engines (Blink / Chromium and
Gecko / Firefox).
[1] https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__valueAsString
* Source/WebCore/svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::setValueAsString):
> Progressions:
* LayoutTests/svg/dom/valueAsString-null-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-expected.txt:
> Rebaselines:
* LayoutTests/svg/custom/invalid-length-units-expected.txt:
* LayoutTests/svg/parser/whitespace-length-invalid-1-expected.txt:
* LayoutTests/svg/parser/whitespace-length-invalid-2-expected.txt:
* LayoutTests/svg/parser/whitespace-length-invalid-3-expected.txt:
* LayoutTests/svg/parser/whitespace-length-invalid-4-expected.txt:
Canonical link: https://commits.webkit.org/303594@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications