Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c6c7a784d24f4c65ba587b2aeecb5353521ec063
https://github.com/WebKit/WebKit/commit/c6c7a784d24f4c65ba587b2aeecb5353521ec063
Author: Ahmad Saleem <[email protected]>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgcolor-animation-invalid-value-1-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-1-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-2-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-3-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-4-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-5-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-6-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-9-expected.txt
M Source/WebCore/svg/SVGAnimateElementBase.cpp
M Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h
Log Message:
-----------
SVG SMIL animations should not apply when from/to/by values fail to parse
https://bugs.webkit.org/show_bug.cgi?id=264537
rdar://118537155
Reviewed by Said Abou-Hallawa.
Per the SMIL Animation specification [1]:
"If any values (i.e., the argument-values for from, to, by or
values attributes) are not legal, the animation will have no
effect."
WebKit was proceeding with invalid values (transparent black for
colors, zero for lengths), producing incorrect results.
The bool-returning plumbing through SVGAnimationFunction,
SVGAttributeAnimator and the animator wrappers, which lets a parse
failure propagate up to SVGAnimationElement::m_animationValid and drop
the animation, landed in 315549@main (bug 311817). That change updated
SVGAnimateElementBase::setFromAndByValues() and setToAtEndOfDurationValue()
but left setFromAndToValues() unconditionally returning true, since list
animators clear their list on a parse failure and thus animate to a
no-op. Scalar color/length values have no such fallback (an invalid
length is coerced to zero and animated), so this commit:
- Propagates the animator result through
SVGAnimateElementBase::setFromAndToValues().
- Implements value validity for SVGAnimationColorFunction (rejects an
invalid 'to', or a non-empty invalid 'from').
- Implements value validity for SVGAnimationLengthFunction by parsing
via SVGLengthValue::setValueAsString() and rejecting lengths that
fail to parse (e.g. a leading space or other malformed syntax),
instead of silently coercing them to zero.
Empty 'from' strings are still accepted for to-animation mode, since
those derive the start value at runtime.
[1] https://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
* Source/WebCore/svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::setFromAndToValues):
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationColorFunction::setFromAndToValues):
(WebCore::SVGAnimationLengthFunction::setFromAndToValues):
(WebCore::SVGAnimationLengthFunction::setToAtEndOfDurationValue):
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgcolor-animation-invalid-value-1-expected.txt:
Progression
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-1-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-2-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-3-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-4-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-5-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-6-expected.txt:
Ditto
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglength-animation-invalid-value-9-expected.txt:
Ditto
Canonical link: https://commits.webkit.org/315949@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications