Skip to content
  • zimmermann@webkit.org's avatar
    SVGAnimateColorElement doesn't support by/to animations properly · 90f2ace1
    zimmermann@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=36704
    
    Reviewed by Antti Koivisto.
    
    Source/WebCore:
    
    Switch AnimatedColorAnimator to use the standard animateAdditiveNumber() method, taking progress & repeatCount into account.
    This gives us accumulation/repeatCount support for free.
    
    We just animate the four color components on their own now and clamp once at the end after addition/accumulation finished.
    Import <animateColor> tests from Dr. Olaf Hoffmanns SVG Animation test suite, which all pass now.
    
    While I was at it, remove the includeSMILProperties boolean from computeCSSPropertyValue - we always use the computed style
    without SMIL effects included, whenever we want to retrieve the "base value", or handle "inherit/currentColor".
    
    Tests: svg/animations/animateColor-additive-2a-expected.svg
           svg/animations/animateColor-additive-2a.svg
           svg/animations/animateColor-additive-2b-expected.svg
           svg/animations/animateColor-additive-2b.svg
           svg/animations/animateColor-additive-2c-expected.svg
           svg/animations/animateColor-additive-2c.svg
           svg/animations/animateColor-additive-2d-expected.svg
           svg/animations/animateColor-additive-2d.svg
    
    * svg/ColorDistance.cpp:
    (WebCore::ColorDistance::clampColor):
    (WebCore::ColorDistance::addColors):
    (WebCore::ColorDistance::addToColor):
    * svg/ColorDistance.h:
    (ColorDistance):
    * svg/SVGAnimateElement.cpp:
    (WebCore::SVGAnimateElement::resetToBaseValue):
    * svg/SVGAnimatedColor.cpp:
    (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
    (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
    * svg/SVGAnimationElement.cpp:
    (WebCore::SVGAnimationElement::computeCSSPropertyValue):
    (WebCore::SVGAnimationElement::adjustForInheritance):
    * svg/SVGAnimationElement.h:
    (SVGAnimationElement):
    
    LayoutTests:
    
    * svg/animations/animateColor-additive-2a-expected.svg: Added.
    * svg/animations/animateColor-additive-2a.svg: Added.
    * svg/animations/animateColor-additive-2b-expected.svg: Added.
    * svg/animations/animateColor-additive-2b.svg: Added.
    * svg/animations/animateColor-additive-2c-expected.svg: Added.
    * svg/animations/animateColor-additive-2c.svg: Added.
    * svg/animations/animateColor-additive-2d-expected.svg: Added.
    * svg/animations/animateColor-additive-2d.svg: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@115564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    90f2ace1