Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 69754ad4ec2983bea7ab83b921b74f55979ec578
https://github.com/WebKit/WebKit/commit/69754ad4ec2983bea7ab83b921b74f55979ec578
Author: Ahmad Saleem <[email protected]>
Date: 2026-02-14 (Sat, 14 Feb 2026)
Changed paths:
M LayoutTests/svg/custom/invalid-length-units-expected.txt
M LayoutTests/svg/parser/whitespace-length-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:
-----------
Fix SVG length attributes to reset to defaults when removed
https://bugs.webkit.org/show_bug.cgi?id=307876
rdar://170360351
Reviewed by Brent Fulgham.
When removeAttribute() is called on SVG width/height attributes, Safari
was trying to parse an empty string instead of restoring the default
values (300 for width, 150 for height), causing an "Invalid value" error.
This occurred because SVGLengthValue::construct() only checked for null
strings, not empty strings. When an attribute is removed, an empty string
is passed, which should be treated the same as null, both indicate the
attribute should use its default value.
This patch fixes it by checking isEmpty() and using the fallback value
without attempting to parse, matching Firefox and Chrome behavior.
It is covered by existing tests, where earlier, we were throwing error
message incorrectly.
* Source/WebCore/svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::construct):
> Rebaselines:
* LayoutTests/svg/custom/invalid-length-units-expected.txt:
* LayoutTests/svg/parser/whitespace-length-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/307585@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications