Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 17c96be1faad0998f6b6acac840ad7f39637d9f1
      
https://github.com/WebKit/WebKit/commit/17c96be1faad0998f6b6acac840ad7f39637d9f1
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-03 (Fri, 03 Jul 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-2-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-2.html
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-2-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-2.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-to-animation-valid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-to-animation-valid-value-1.html
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-2-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-2.html
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-2-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-2.html
    M Source/WebCore/svg/SVGPathByteStream.h
    M Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h
    M Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h
    M Source/WebCore/svg/properties/SVGPropertyTraits.h

  Log Message:
  -----------
  SVG SMIL number, integer-optional-integer, number-optional-number and path 
animations should not apply when from/to/by values fail to parse
https://bugs.webkit.org/show_bug.cgi?id=318066

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."

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), and rejection of
invalid scalar color/length values followed for SVGAnimateElementBase::
setFromAndToValues(). The remaining scalar animators still coerced an
invalid value to zero (or an empty path) and animated to it, instead of
leaving the underlying value untouched.

This propagates parse validity for the rest of the scalar value
functions, routing the parsing through the property traits and a new
SVGPathByteStream factory so the fallible parse lives in one place:

  - SVGPropertyTraits<float>, SVGPropertyTraits<std::pair<int, int>> and
    SVGPropertyTraits<std::pair<float, float>> gain a parse() overload
    that returns std::nullopt on failure; fromString() is now a thin
    wrapper over parse(). SVGAnimationNumberFunction,
    SVGAnimatedIntegerPairAnimator and SVGAnimatedNumberPairAnimator call
    parse() and reject a 'from'/'to'/'by'/toAtEndOfDuration that fails.
  - SVGPathByteStream::create() builds a byte stream and returns
    std::nullopt for a malformed path; SVGAnimationPathSegListFunction
    uses it and rejects a malformed 'from'/'to'/toAtEndOfDuration.

An empty string is not handled inside parse()/create(): it is a legal
value in some contexts but not others, so each caller decides. An empty
'from' is accepted for to-animation mode (the start value is resolved at
runtime); a number/integer 'to' or 'by' must parse, so an empty value is
rejected there because "" is not a legal number. An empty path, by
contrast, is a legal (empty) path, so buildSVGPathByteStreamFromString()
accepting it is correct and the path animator does not reject it; empty
'd' animation behaviour is tracked separately by the tentative
animate-path-*-empty-* tests.

[1] https://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues

* Source/WebCore/svg/SVGPathByteStream.h:
* Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
* Source/WebCore/svg/properties/SVGPropertyTraits.h:
(WebCore::SVGPropertyTraits<float>::parse):

* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-1-expected.txt:
 Progression
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-1-expected.txt:
 Ditto
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-1-expected.txt:
 Ditto
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-1-expected.txt:
 Ditto

* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-2.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-animation-invalid-value-2-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-2.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberoptionalnumber-animation-invalid-value-2-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-2.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgintegeroptionalinteger-animation-invalid-value-2-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-2.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpath-animation-invalid-value-2-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-to-animation-valid-value-1.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumber-to-animation-valid-value-1-expected.txt:
 Added.

Canonical link: https://commits.webkit.org/316468@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to