SVGAnimateColorElement doesn't support by/to animations properly
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Apr 2012 11:03:11 +0000 (11:03 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Apr 2012 11:03:11 +0000 (11:03 +0000)
commit90f2ace163e8664ea2c014d3b12c66ef9071a370
treef8ef228529188e4640304953a97eb83daa3c5321
parent8cd26947a8090e0fb768ba59223968956251e1db
SVGAnimateColorElement doesn't support by/to animations properly
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
16 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/animateColor-additive-2a-expected.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2a.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2b-expected.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2b.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2c-expected.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2c.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2d-expected.svg [new file with mode: 0644]
LayoutTests/svg/animations/animateColor-additive-2d.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/ColorDistance.cpp
Source/WebCore/svg/ColorDistance.h
Source/WebCore/svg/SVGAnimateElement.cpp
Source/WebCore/svg/SVGAnimatedColor.cpp
Source/WebCore/svg/SVGAnimationElement.cpp
Source/WebCore/svg/SVGAnimationElement.h