Accumulation for values-animation is broken
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 May 2012 15:18:09 +0000 (15:18 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 May 2012 15:18:09 +0000 (15:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85158

Reviewed by Darin Adler.

Source/WebCore:

Example:
<rect width="999" height="100" fill="green"/>
    <animate begin="0s" values="0; 30; 20" accumulate="sum" repeatCount="5" dur="2s"/>
</rect>

The rect should animate like this:
0.000s -> 0
0.500s -> 15
1.000s -> 30
1.500s -> 25
1.999s -> 20
2.000s -> 20 (first accumulation, starts accumulating from the last set value, here '20').
2.500s -> 45
3.000s -> 50
3.500s -> 45
3.999s -> 40
4.000s -> 40 (second accumulation)
etc.

This is currently broken for values-animation. The accumulation should happen after a full cycle of the values animation ran (aka. at the end of the duration).
A values animation works like this: iterate over the list of values, and calculate a 'from' and 'to' value for a given time. Example for values="0; 30; 20" dur="2s":
    - 0.0s .. 1.0s -> from=0, to=30
    - 1.0s .. 2.0s -> from=30, to=20

Accumulation currently is taken into account at each interval for a values-animation instead of the end of the cycle. Fix that
by passing an additional 'toAtEndOfDuration' type to calculateAnimatedValue() which is used for accumulation instead of the
current 'to' value.

Test: svg/animations/accumulate-values-width-animation.html

* svg/SVGAnimateElement.cpp:
(WebCore::SVGAnimateElement::calculateAnimatedValue):
* svg/SVGAnimateElement.h:
(SVGAnimateElement):
* svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
* svg/SVGAnimateMotionElement.h:
(SVGAnimateMotionElement):
* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
* svg/SVGAnimatedAngle.h:
(SVGAnimatedAngleAnimator):
* svg/SVGAnimatedBoolean.cpp:
(WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
* svg/SVGAnimatedBoolean.h:
(SVGAnimatedBooleanAnimator):
* svg/SVGAnimatedColor.cpp:
(WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
* svg/SVGAnimatedColor.h:
(SVGAnimatedColorAnimator):
* svg/SVGAnimatedEnumeration.cpp:
(WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
* svg/SVGAnimatedEnumeration.h:
(SVGAnimatedEnumerationAnimator):
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedInteger):
(WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
* svg/SVGAnimatedInteger.h:
(SVGAnimatedIntegerAnimator):
* svg/SVGAnimatedIntegerOptionalInteger.cpp:
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
* svg/SVGAnimatedIntegerOptionalInteger.h:
(SVGAnimatedIntegerOptionalIntegerAnimator):
* svg/SVGAnimatedLength.cpp:
(WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
* svg/SVGAnimatedLength.h:
(SVGAnimatedLengthAnimator):
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
* svg/SVGAnimatedLengthList.h:
(SVGAnimatedLengthListAnimator):
* svg/SVGAnimatedNumber.cpp:
(WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
* svg/SVGAnimatedNumber.h:
(SVGAnimatedNumberAnimator):
* svg/SVGAnimatedNumberList.cpp:
(WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
* svg/SVGAnimatedNumberList.h:
(SVGAnimatedNumberListAnimator):
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
* svg/SVGAnimatedNumberOptionalNumber.h:
(SVGAnimatedNumberOptionalNumberAnimator):
* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPath.h:
(SVGAnimatedPathAnimator):
* svg/SVGAnimatedPointList.cpp:
(WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPointList.h:
(SVGAnimatedPointListAnimator):
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
* svg/SVGAnimatedPreserveAspectRatio.h:
(SVGAnimatedPreserveAspectRatioAnimator):
* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
* svg/SVGAnimatedRect.h:
(SVGAnimatedRectAnimator):
* svg/SVGAnimatedString.cpp:
(WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
* svg/SVGAnimatedString.h:
(SVGAnimatedStringAnimator):
* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
* svg/SVGAnimatedTransformList.h:
(SVGAnimatedTransformListAnimator):
* svg/SVGAnimatedTypeAnimator.h:
(SVGAnimatedTypeAnimator):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
(WebCore::SVGAnimationElement::updateAnimation):
* svg/SVGAnimationElement.h:
(WebCore::SVGAnimationElement::animateAdditiveNumber):
(SVGAnimationElement):

LayoutTests:

* svg/animations/accumulate-values-width-animation-expected.txt: Added.
* svg/animations/accumulate-values-width-animation.html: Added.
* svg/animations/resources/accumulate-values-width-animation.svg: Added.
* svg/animations/script-tests/accumulate-values-width-animation.js: Added.
(sample1):
(sample2):
(sample3):
(sample4):
(sample5):
(sample6):
(sample7):
(sample8):
(sample9):
(sample10):
(sample11):
(executeTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/accumulate-values-width-animation-expected.txt [new file with mode: 0644]
LayoutTests/svg/animations/accumulate-values-width-animation.html [new file with mode: 0644]
LayoutTests/svg/animations/resources/accumulate-values-width-animation.svg [new file with mode: 0644]
LayoutTests/svg/animations/script-tests/accumulate-values-width-animation.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGAnimateElement.cpp
Source/WebCore/svg/SVGAnimateElement.h
Source/WebCore/svg/SVGAnimateMotionElement.cpp
Source/WebCore/svg/SVGAnimateMotionElement.h
Source/WebCore/svg/SVGAnimatedAngle.cpp
Source/WebCore/svg/SVGAnimatedAngle.h
Source/WebCore/svg/SVGAnimatedBoolean.cpp
Source/WebCore/svg/SVGAnimatedBoolean.h
Source/WebCore/svg/SVGAnimatedColor.cpp
Source/WebCore/svg/SVGAnimatedColor.h
Source/WebCore/svg/SVGAnimatedEnumeration.cpp
Source/WebCore/svg/SVGAnimatedEnumeration.h
Source/WebCore/svg/SVGAnimatedInteger.cpp
Source/WebCore/svg/SVGAnimatedInteger.h
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h
Source/WebCore/svg/SVGAnimatedLength.cpp
Source/WebCore/svg/SVGAnimatedLength.h
Source/WebCore/svg/SVGAnimatedLengthList.cpp
Source/WebCore/svg/SVGAnimatedLengthList.h
Source/WebCore/svg/SVGAnimatedNumber.cpp
Source/WebCore/svg/SVGAnimatedNumber.h
Source/WebCore/svg/SVGAnimatedNumberList.cpp
Source/WebCore/svg/SVGAnimatedNumberList.h
Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp
Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.h
Source/WebCore/svg/SVGAnimatedPath.cpp
Source/WebCore/svg/SVGAnimatedPath.h
Source/WebCore/svg/SVGAnimatedPointList.cpp
Source/WebCore/svg/SVGAnimatedPointList.h
Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp
Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h
Source/WebCore/svg/SVGAnimatedRect.cpp
Source/WebCore/svg/SVGAnimatedRect.h
Source/WebCore/svg/SVGAnimatedString.cpp
Source/WebCore/svg/SVGAnimatedString.h
Source/WebCore/svg/SVGAnimatedTransformList.cpp
Source/WebCore/svg/SVGAnimatedTransformList.h
Source/WebCore/svg/SVGAnimatedTypeAnimator.h
Source/WebCore/svg/SVGAnimationElement.cpp
Source/WebCore/svg/SVGAnimationElement.h

index cff5457..893810d 100644 (file)
@@ -1,3 +1,27 @@
+2012-04-29  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Accumulation for values-animation is broken
+        https://bugs.webkit.org/show_bug.cgi?id=85158
+
+        Reviewed by Darin Adler.
+
+        * svg/animations/accumulate-values-width-animation-expected.txt: Added.
+        * svg/animations/accumulate-values-width-animation.html: Added.
+        * svg/animations/resources/accumulate-values-width-animation.svg: Added.
+        * svg/animations/script-tests/accumulate-values-width-animation.js: Added.
+        (sample1):
+        (sample2):
+        (sample3):
+        (sample4):
+        (sample5):
+        (sample6):
+        (sample7):
+        (sample8):
+        (sample9):
+        (sample10):
+        (sample11):
+        (executeTest):
+
 2012-05-01  Ryosuke Niwa  <rniwa@webkit.org>
 
         drag of links with styled text drop as links with plain text
diff --git a/LayoutTests/svg/animations/accumulate-values-width-animation-expected.txt b/LayoutTests/svg/animations/accumulate-values-width-animation-expected.txt
new file mode 100644 (file)
index 0000000..a4fddb6
--- /dev/null
@@ -0,0 +1,48 @@
+SVG 1.1 dynamic animation tests
+
+
+This tests values animation and accumulate='sum'
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.width.animVal.value is 0
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 30
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 20
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 20
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 50
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 40
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 40
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 70
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 60
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 60
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 90
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 80
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 80
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 110
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 100
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 100
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 100
+PASS rect.width.baseVal.value is 20
+PASS rect.width.animVal.value is 100
+PASS rect.width.baseVal.value is 20
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/animations/accumulate-values-width-animation.html b/LayoutTests/svg/animations/accumulate-values-width-animation.html
new file mode 100644 (file)
index 0000000..5db1759
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
+<script src="resources/SVGAnimationTestCase.js"></script>
+</head>
+<body onload="runSMILTest()">
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/accumulate-values-width-animation.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/animations/resources/accumulate-values-width-animation.svg b/LayoutTests/svg/animations/resources/accumulate-values-width-animation.svg
new file mode 100644 (file)
index 0000000..af456b9
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<!-- an1: Change width to 100 in 10s with a wobbling animation -->
+<rect width="20" height="100" fill="green">
+    <animate id="an1" attributeName="width" dur="2s" values="0; 30; 20" accumulate="sum" repeatCount="5" fill="freeze"/>
+</rect>
+
+</svg>
diff --git a/LayoutTests/svg/animations/script-tests/accumulate-values-width-animation.js b/LayoutTests/svg/animations/script-tests/accumulate-values-width-animation.js
new file mode 100644 (file)
index 0000000..1a59fb9
--- /dev/null
@@ -0,0 +1,89 @@
+description("This tests values animation and accumulate='sum'");
+embedSVGTestCase("resources/accumulate-values-width-animation.svg");
+
+// Setup animation test
+function sample1() {
+    shouldBeCloseEnough("rect.width.animVal.value", "0");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample2() {
+    shouldBeCloseEnough("rect.width.animVal.value", "30");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample3() {
+    shouldBeCloseEnough("rect.width.animVal.value", "20");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample4() {
+    shouldBeCloseEnough("rect.width.animVal.value", "50");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample5() {
+    shouldBeCloseEnough("rect.width.animVal.value", "40");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample6() {
+    shouldBeCloseEnough("rect.width.animVal.value", "70");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample7() {
+    shouldBeCloseEnough("rect.width.animVal.value", "60");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample8() {
+    shouldBeCloseEnough("rect.width.animVal.value", "90");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample9() {
+    shouldBeCloseEnough("rect.width.animVal.value", "80");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample10() {
+    shouldBeCloseEnough("rect.width.animVal.value", "110");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function sample11() {
+    shouldBeCloseEnough("rect.width.animVal.value", "100");
+    shouldBe("rect.width.baseVal.value", "20");
+}
+
+function executeTest() {
+    rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
+
+    const expectedValues = [
+        // [animationId, time, sampleCallback]
+        ["an1", 0.0,    sample1],
+        ["an1", 1.0,    sample2],
+        ["an1", 1.999,  sample3],
+        ["an1", 2.001,  sample3],
+        ["an1", 3.0,    sample4],
+        ["an1", 3.999,  sample5],
+        ["an1", 4.001,  sample5],
+        ["an1", 5.0,    sample6],
+        ["an1", 5.999,  sample7],
+        ["an1", 6.001,  sample7],
+        ["an1", 7.0,    sample8],
+        ["an1", 7.999,  sample9],
+        ["an1", 8.001,  sample9],
+        ["an1", 9.0,    sample10],
+        ["an1", 9.999,  sample11],
+        ["an1", 10.001, sample11],
+        ["an1", 11.0,   sample11],
+        ["an1", 60.0,   sample11]
+    ];
+
+    runAnimationTest(expectedValues);
+}
+
+window.animationStartsImmediately = true;
+var successfullyParsed = true;
index 3faadb9..3933aaf 100644 (file)
@@ -1,3 +1,126 @@
+2012-04-29  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Accumulation for values-animation is broken
+        https://bugs.webkit.org/show_bug.cgi?id=85158
+
+        Reviewed by Darin Adler.
+
+        Example:
+        <rect width="999" height="100" fill="green"/>
+            <animate begin="0s" values="0; 30; 20" accumulate="sum" repeatCount="5" dur="2s"/>
+        </rect>
+
+        The rect should animate like this:
+        0.000s -> 0
+        0.500s -> 15
+        1.000s -> 30
+        1.500s -> 25
+        1.999s -> 20
+        2.000s -> 20 (first accumulation, starts accumulating from the last set value, here '20').
+        2.500s -> 45
+        3.000s -> 50
+        3.500s -> 45
+        3.999s -> 40
+        4.000s -> 40 (second accumulation)
+        etc.
+
+        This is currently broken for values-animation. The accumulation should happen after a full cycle of the values animation ran (aka. at the end of the duration).
+        A values animation works like this: iterate over the list of values, and calculate a 'from' and 'to' value for a given time. Example for values="0; 30; 20" dur="2s":
+            - 0.0s .. 1.0s -> from=0, to=30
+            - 1.0s .. 2.0s -> from=30, to=20
+
+        Accumulation currently is taken into account at each interval for a values-animation instead of the end of the cycle. Fix that
+        by passing an additional 'toAtEndOfDuration' type to calculateAnimatedValue() which is used for accumulation instead of the
+        current 'to' value.
+
+        Test: svg/animations/accumulate-values-width-animation.html
+
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::SVGAnimateElement::calculateAnimatedValue):
+        * svg/SVGAnimateElement.h:
+        (SVGAnimateElement):
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
+        * svg/SVGAnimateMotionElement.h:
+        (SVGAnimateMotionElement):
+        * svg/SVGAnimatedAngle.cpp:
+        (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedAngle.h:
+        (SVGAnimatedAngleAnimator):
+        * svg/SVGAnimatedBoolean.cpp:
+        (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedBoolean.h:
+        (SVGAnimatedBooleanAnimator):
+        * svg/SVGAnimatedColor.cpp:
+        (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedColor.h:
+        (SVGAnimatedColorAnimator):
+        * svg/SVGAnimatedEnumeration.cpp:
+        (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedEnumeration.h:
+        (SVGAnimatedEnumerationAnimator):
+        * svg/SVGAnimatedInteger.cpp:
+        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedInteger):
+        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedInteger.h:
+        (SVGAnimatedIntegerAnimator):
+        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedIntegerOptionalInteger.h:
+        (SVGAnimatedIntegerOptionalIntegerAnimator):
+        * svg/SVGAnimatedLength.cpp:
+        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedLength.h:
+        (SVGAnimatedLengthAnimator):
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedLengthList.h:
+        (SVGAnimatedLengthListAnimator):
+        * svg/SVGAnimatedNumber.cpp:
+        (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedNumber.h:
+        (SVGAnimatedNumberAnimator):
+        * svg/SVGAnimatedNumberList.cpp:
+        (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedNumberList.h:
+        (SVGAnimatedNumberListAnimator):
+        * svg/SVGAnimatedNumberOptionalNumber.cpp:
+        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedNumberOptionalNumber.h:
+        (SVGAnimatedNumberOptionalNumberAnimator):
+        * svg/SVGAnimatedPath.cpp:
+        (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedPath.h:
+        (SVGAnimatedPathAnimator):
+        * svg/SVGAnimatedPointList.cpp:
+        (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedPointList.h:
+        (SVGAnimatedPointListAnimator):
+        * svg/SVGAnimatedPreserveAspectRatio.cpp:
+        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedPreserveAspectRatio.h:
+        (SVGAnimatedPreserveAspectRatioAnimator):
+        * svg/SVGAnimatedRect.cpp:
+        (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedRect.h:
+        (SVGAnimatedRectAnimator):
+        * svg/SVGAnimatedString.cpp:
+        (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedString.h:
+        (SVGAnimatedStringAnimator):
+        * svg/SVGAnimatedTransformList.cpp:
+        (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedTransformList.h:
+        (SVGAnimatedTransformListAnimator):
+        * svg/SVGAnimatedTypeAnimator.h:
+        (SVGAnimatedTypeAnimator):
+        * svg/SVGAnimationElement.cpp:
+        (WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
+        (WebCore::SVGAnimationElement::updateAnimation):
+        * svg/SVGAnimationElement.h:
+        (WebCore::SVGAnimationElement::animateAdditiveNumber):
+        (SVGAnimationElement):
+
 2012-05-01  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=85231
index 106986d..119d3be 100644 (file)
@@ -92,7 +92,7 @@ AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement
     return type;
 }
 
-void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement)
+void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeatCount, const String& toAtEndOfDurationString, SVGSMILElement* resultElement)
 {
     ASSERT(resultElement);
     SVGElement* targetElement = this->targetElement();
@@ -131,7 +131,15 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
     // while detaching. This is covered by assertions, moving this down would fire them.
     if (!m_animatedProperties.isEmpty())
         m_animator->animValWillChange(m_animatedProperties);
-    m_animator->calculateAnimatedValue(percentage, repeat, m_fromType, m_toType, resultAnimationElement->m_animatedType);
+
+    if (toAtEndOfDurationString.isEmpty()) {
+        m_animator->calculateAnimatedValue(percentage, repeatCount, m_fromType.get(), m_toType.get(), m_toType.get(), resultAnimationElement->m_animatedType.get());
+        return;
+    }
+
+    // Values-animation accumulates using the last values entry corresponding to the end of duration time.
+    OwnPtr<SVGAnimatedType> toAtEndOfDurationType = m_animator->constructFromString(toAtEndOfDurationString);
+    m_animator->calculateAnimatedValue(percentage, repeatCount, m_fromType.get(), m_toType.get(), toAtEndOfDurationType.get(), resultAnimationElement->m_animatedType.get());
 }
 
 bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const String& toString)
index 65f9c9d..617186e 100644 (file)
@@ -46,7 +46,7 @@ protected:
     virtual void resetToBaseValue();
     virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
     virtual bool calculateFromAndByValues(const String& fromString, const String& byString);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, const String& toAtEndOfDurationString, SVGSMILElement* resultElement);
     virtual void applyResultsToTarget();
     virtual float calculateDistance(const String& fromString, const String& toString);
     virtual bool isAdditive() const OVERRIDE;
index 107d0f9..9cff3c1 100644 (file)
@@ -211,7 +211,7 @@ void SVGAnimateMotionElement::buildTransformForProgress(AffineTransform* transfo
     transform->rotate(angle);
 }
 
-void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*)
+void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, const String& toAtEndOfDurationString, SVGSMILElement*)
 {
     SVGElement* targetElement = this->targetElement();
     if (!targetElement)
@@ -227,11 +227,15 @@ void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned
         transform->makeIdentity();
 
     if (animationMode() != PathAnimation) {
+        FloatPoint toPointAtEndOfDuration = m_toPoint;
+        if (isAccumulated() && repeatCount && !toAtEndOfDurationString.isEmpty())
+            parsePoint(toAtEndOfDurationString, toPointAtEndOfDuration);
+
         float animatedX = 0;
-        animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoint.x(), animatedX);
+        animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoint.x(), toPointAtEndOfDuration.x(), animatedX);
 
         float animatedY = 0;
-        animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoint.y(), animatedY);
+        animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoint.y(), toPointAtEndOfDuration.y(), animatedY);
 
         transform->translate(animatedX, animatedY);
         return;
index 041d89e..71e4de1 100644 (file)
@@ -42,7 +42,7 @@ private:
     virtual void resetToBaseValue();
     virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
     virtual bool calculateFromAndByValues(const String& fromString, const String& byString);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, const String& toAtEndOfDurationString, SVGSMILElement* resultElement);
     virtual void applyResultsToTarget();
     virtual float calculateDistance(const String& fromString, const String& toString);
     virtual Path animationPath() const;
index 8bf74ac..091c3c5 100644 (file)
@@ -94,13 +94,14 @@ void SVGAnimatedAngleAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimat
     toAngle.setValue(toAngle.value() + fromAngle.value());
 }
 
-void SVGAnimatedAngleAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedAngleAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
     
     pair<SVGAngle, unsigned>& fromAngleAndEnumeration = from->angleAndEnumeration();
     pair<SVGAngle, unsigned>& toAngleAndEnumeration = to->angleAndEnumeration();
+    pair<SVGAngle, unsigned>& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
     pair<SVGAngle, unsigned>& animatedAngleAndEnumeration = animated->angleAndEnumeration();
     m_animationElement->adjustFromToValues<pair<SVGAngle, unsigned> >(0, fromAngleAndEnumeration, toAngleAndEnumeration, animatedAngleAndEnumeration, percentage, m_contextElement);
 
@@ -142,8 +143,9 @@ void SVGAnimatedAngleAnimator::calculateAnimatedValue(float percentage, unsigned
     animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
 
     SVGAngle& animatedSVGAngle = animatedAngleAndEnumeration.first;
+    SVGAngle& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
     float animatedAngle = animatedSVGAngle.value();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), animatedAngle);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
     animatedSVGAngle.setValue(animatedAngle);
 }
 
index f6a9e3d..50724b0 100644 (file)
@@ -52,8 +52,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index b0fd9fc..072366b 100644 (file)
@@ -74,7 +74,7 @@ void SVGAnimatedBooleanAnimator::addAnimatedTypes(SVGAnimatedType*, SVGAnimatedT
     ASSERT_NOT_REACHED();
 }
 
-void SVGAnimatedBooleanAnimator::calculateAnimatedValue(float percentage, unsigned, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedBooleanAnimator::calculateAnimatedValue(float percentage, unsigned, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
index 629c408..d6d48fa 100644 (file)
@@ -50,8 +50,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 125774d..7e7cd12 100644 (file)
@@ -63,13 +63,14 @@ static Color parseColorFromString(SVGAnimationElement*, const String& string)
     return SVGColor::colorFromRGBColorString(string);
 }
 
-void SVGAnimatedColorAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedColorAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     Color& fromColor = from->color();
     Color& toColor = to->color();
+    Color& toAtEndOfDurationColor = toAtEndOfDuration->color();
     Color& animatedColor = animated->color();
     m_animationElement->adjustFromToValues<Color>(parseColorFromString, fromColor, toColor, animatedColor, percentage, m_contextElement);
 
@@ -80,16 +81,16 @@ void SVGAnimatedColorAnimator::calculateAnimatedValue(float percentage, unsigned
         adjustForCurrentColor(m_contextElement, toColor);
 
     float animatedRed = animatedColor.red();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.red(), toColor.red(), animatedRed);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.red(), toColor.red(), toAtEndOfDurationColor.red(), animatedRed);
 
     float animatedGreen = animatedColor.green();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.green(), toColor.green(), animatedGreen);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.green(), toColor.green(), toAtEndOfDurationColor.green(), animatedGreen);
 
     float animatedBlue = animatedColor.blue();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.blue(), toColor.blue(), animatedBlue);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.blue(), toColor.blue(), toAtEndOfDurationColor.blue(), animatedBlue);
 
     float animatedAlpha = animatedColor.alpha();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.alpha(), toColor.alpha(), animatedAlpha);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.alpha(), toColor.alpha(), toAtEndOfDurationColor.alpha(), animatedAlpha);
 
     animatedColor = ColorDistance::clampColor(static_cast<int>(roundf(animatedRed)), static_cast<int>(roundf(animatedGreen)), static_cast<int>(roundf(animatedBlue)), static_cast<int>(roundf(animatedAlpha)));
 }
index a50b0b2..bb8b2fd 100644 (file)
@@ -40,8 +40,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&) { }
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 } // namespace WebCore
index 44cc499..c5b6d3f 100644 (file)
@@ -145,7 +145,7 @@ void SVGAnimatedEnumerationAnimator::addAnimatedTypes(SVGAnimatedType*, SVGAnima
     ASSERT_NOT_REACHED();
 }
 
-void SVGAnimatedEnumerationAnimator::calculateAnimatedValue(float percentage, unsigned, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedEnumerationAnimator::calculateAnimatedValue(float percentage, unsigned, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
index 7ea743a..8447602 100644 (file)
@@ -49,8 +49,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 6e13407..cd36b67 100644 (file)
@@ -73,24 +73,25 @@ void SVGAnimatedIntegerAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnim
     to->integer() += from->integer();
 }
 
-void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int& animatedInteger)
+void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int toAtEndOfDurationInteger, int& animatedInteger)
 {
     float animatedNumber = animatedInteger;
-    animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger, toInteger, animatedNumber);
+    animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedNumber);
     animatedInteger = static_cast<int>(roundf(animatedNumber));
 }
 
-void SVGAnimatedIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     int& fromInteger = from->integer();
     int& toInteger = to->integer();
+    int& toAtEndOfDurationInteger = toAtEndOfDuration->integer();
     int& animatedInteger = animated->integer();
     m_animationElement->adjustFromToValues<int>(0, fromInteger, toInteger, animatedInteger, percentage, m_contextElement);
 
-    calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, animatedInteger);
+    calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedInteger);
 }
 
 float SVGAnimatedIntegerAnimator::calculateDistance(const String& fromString, const String& toString)
index 3e8b438..0b55c10 100644 (file)
@@ -46,7 +46,7 @@ public:
     SVGAnimatedIntegerAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedIntegerAnimator() { }
 
-    static void calculateAnimatedInteger(SVGAnimationElement*, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int& animatedInteger);
+    static void calculateAnimatedInteger(SVGAnimationElement*, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int toAtEndOfDurationInteger, int& animatedInteger);
 
     virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
     virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&);
@@ -56,8 +56,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 7d2dfd3..e13b1cf 100644 (file)
@@ -86,18 +86,19 @@ void SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes(SVGAnimatedType
     toIntegerPair.second += fromIntegerPair.second;
 }
 
-void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     pair<int, int>& fromIntegerPair = from->integerOptionalInteger();
     pair<int, int>& toIntegerPair = to->integerOptionalInteger();
+    pair<int, int>& toAtEndOfDurationIntegerPair = toAtEndOfDuration->integerOptionalInteger();
     pair<int, int>& animatedIntegerPair = animated->integerOptionalInteger();
     m_animationElement->adjustFromToValues<pair<int, int> >(0, fromIntegerPair, toIntegerPair, animatedIntegerPair, percentage, m_contextElement);
 
-    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, animatedIntegerPair.first);
-    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, animatedIntegerPair.second);
+    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
+    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
 }
 
 float SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance(const String&, const String&)
index ced4452..d810bd3 100644 (file)
@@ -40,8 +40,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index e34f48c..ca6bae8 100644 (file)
@@ -91,20 +91,21 @@ static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, co
     return sharedSVGLength(SVGLength::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()), string);
 }
 
-void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     SVGLength& fromSVGLength = from->length();
     SVGLength& toSVGLength = to->length();
+    SVGLength& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
     SVGLength& animatedSVGLength = animated->length();
     m_animationElement->adjustFromToValues<SVGLength>(parseLengthFromString, fromSVGLength, toSVGLength, animatedSVGLength, percentage, m_contextElement);
 
     SVGLengthContext lengthContext(m_contextElement);
     float animatedNumber = animatedSVGLength.value(lengthContext);
     SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVGLength.unitType();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext), animatedNumber);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSVGLength.value(lengthContext), animatedNumber);
 
     ExceptionCode ec = 0;
     animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ec);
index 1510829..62a1119 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 
 private:
index ea7c6b8..da96ace 100644 (file)
@@ -92,13 +92,14 @@ static SVGLengthList parseLengthListFromString(SVGAnimationElement* animationEle
     return lengthList;
 }
 
-void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     SVGLengthList& fromLengthList = from->lengthList();
     SVGLengthList& toLengthList = to->lengthList();
+    SVGLengthList& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
     SVGLengthList& animatedLengthList = animated->lengthList();
     if (!m_animationElement->adjustFromToListValues<SVGLengthList>(parseLengthListFromString, fromLengthList, toLengthList, animatedLengthList, percentage, m_contextElement))
         return;
@@ -118,7 +119,7 @@ void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, uns
             effectiveFrom = fromLengthList[i].value(lengthContext);
         }
 
-        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), animatedNumber);
+        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), toAtEndOfDurationLengthList[i].value(lengthContext), animatedNumber);
         animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ec);
         ASSERT(!ec);
     }
index 2f174ac..86ffafe 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
     
 private:
index fbe5706..c775a44 100644 (file)
@@ -83,17 +83,18 @@ static float parseNumberFromString(SVGAnimationElement*, const String& string)
     return number;
 }
 
-void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     float& fromNumber = from->number();
     float& toNumber = to->number();
+    float& toAtEndOfDurationNumber = toAtEndOfDuration->number();
     float& animatedNumber = animated->number();
     m_animationElement->adjustFromToValues<float>(parseNumberFromString, fromNumber, toNumber, animatedNumber, percentage, m_contextElement);
 
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber, toNumber, animatedNumber);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber, toNumber, toAtEndOfDurationNumber, animatedNumber);
 }
 
 float SVGAnimatedNumberAnimator::calculateDistance(const String& fromString, const String& toString)
index 89ae9a7..942d641 100644 (file)
@@ -54,8 +54,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index fa231bd..2f3e3ac 100644 (file)
@@ -80,13 +80,14 @@ void SVGAnimatedNumberListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGA
         toNumberList[i] += fromNumberList[i];
 }
 
-void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     SVGNumberList& fromNumberList = from->numberList();
     SVGNumberList& toNumberList = to->numberList();
+    SVGNumberList& toAtEndOfDurationNumberList = toAtEndOfDuration->numberList();
     SVGNumberList& animatedNumberList = animated->numberList();
     if (!m_animationElement->adjustFromToListValues<SVGNumberList>(0, fromNumberList, toNumberList, animatedNumberList, percentage, m_contextElement))
         return;
@@ -96,7 +97,7 @@ void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, uns
 
     for (unsigned i = 0; i < toNumberListSize; ++i) {
         float effectiveFrom = fromNumberListSize ? fromNumberList[i] : 0;
-        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList[i], animatedNumberList[i]);
+        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList[i], toAtEndOfDurationNumberList[i], animatedNumberList[i]);
     }
 }
 
index 27a4b65..b644599 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index c0b5d7b..f34d763 100644 (file)
@@ -83,18 +83,19 @@ void SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes(SVGAnimatedType*
     toNumberPair.second += fromNumberPair.second;
 }
 
-void SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     pair<float, float>& fromNumberPair = from->numberOptionalNumber();
     pair<float, float>& toNumberPair = to->numberOptionalNumber();
+    pair<float, float>& toAtEndOfDurationNumberPair = toAtEndOfDuration->numberOptionalNumber();
     pair<float, float>& animatedNumberPair = animated->numberOptionalNumber();
     m_animationElement->adjustFromToValues<pair<float, float> >(0, fromNumberPair, toNumberPair, animatedNumberPair, percentage, m_contextElement);
 
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, animatedNumberPair.first);
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, animatedNumberPair.second);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
 }
 
 float SVGAnimatedNumberOptionalNumberAnimator::calculateDistance(const String&, const String&)
index adb4e34..64734bc 100644 (file)
@@ -40,8 +40,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 026b52a..1c1865a 100644 (file)
@@ -102,19 +102,15 @@ void SVGAnimatedPathAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimate
     addToSVGPathByteStream(toPath, fromPath);
 }
 
-void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     SVGPathByteStream* fromPath = from->path();
-    ASSERT(fromPath);
-
     SVGPathByteStream* toPath = to->path();
-    ASSERT(toPath);
-
+    SVGPathByteStream* toAtEndOfDurationPath = toAtEndOfDuration->path();
     SVGPathByteStream* animatedPath = animated->path();
-    ASSERT(animatedPath);
 
     // Pass false to 'resizeAnimatedListIfNeeded' here, as the path animation is not a regular Vector<SVGXXX> type, but a SVGPathByteStream, that works differently.
     if (!m_animationElement->adjustFromToListValues<SVGPathByteStream>(0, *fromPath, *toPath, *animatedPath, percentage, m_contextElement, false))
@@ -133,7 +129,7 @@ void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned
 
     // Handle accumulate='sum'.
     if (m_animationElement->isAccumulated() && repeatCount)
-        addToSVGPathByteStream(animatedPath, toPath, repeatCount);
+        addToSVGPathByteStream(animatedPath, toAtEndOfDurationPath, repeatCount);
 }
    
 float SVGAnimatedPathAnimator::calculateDistance(const String&, const String&)
index 474c1ef..ac779da 100644 (file)
@@ -40,8 +40,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 57757b1..c2649fc 100644 (file)
@@ -81,13 +81,14 @@ void SVGAnimatedPointListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAn
         toPointList[i] += fromPointList[i];
 }
 
-void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     SVGPointList& fromPointList = from->pointList();
     SVGPointList& toPointList = to->pointList();
+    SVGPointList& toAtEndOfDurationPointList = toAtEndOfDuration->pointList();
     SVGPointList& animatedPointList = animated->pointList();
     if (!m_animationElement->adjustFromToListValues<SVGPointList>(0, fromPointList, toPointList, animatedPointList, percentage, m_contextElement))
         return;
@@ -102,8 +103,8 @@ void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsi
 
         float animatedX = animatedPointList[i].x();
         float animatedY = animatedPointList[i].y();
-        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList[i].x(), animatedX);
-        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList[i].y(), animatedY);
+        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList[i].x(), toAtEndOfDurationPointList[i].x(), animatedX);
+        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList[i].y(), toAtEndOfDurationPointList[i].y(), animatedY);
         animatedPointList[i] = FloatPoint(animatedX, animatedY);
     }
 }
index 90692f1..4c8b185 100644 (file)
@@ -44,8 +44,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 4f5bb19..73a7f27 100644 (file)
@@ -68,7 +68,7 @@ void SVGAnimatedPreserveAspectRatioAnimator::addAnimatedTypes(SVGAnimatedType*,
     ASSERT_NOT_REACHED();
 }
 
-void SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue(float percentage, unsigned, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue(float percentage, unsigned, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
index b34f1b5..5c9b75e 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index 86434e3..ad4286d 100644 (file)
@@ -72,13 +72,14 @@ void SVGAnimatedRectAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimate
     to->rect() += from->rect();
 }
 
-void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
 
     FloatRect& fromRect = from->rect();
     FloatRect& toRect = to->rect();
+    FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
     FloatRect& animatedRect = animated->rect();
     m_animationElement->adjustFromToValues<FloatRect>(0, fromRect, toRect, animatedRect, percentage, m_contextElement);
 
@@ -86,10 +87,10 @@ void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned
     float animatedY = animatedRect.y();
     float animatedWidth = animatedRect.width();
     float animatedHeight = animatedRect.height();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.x(), toRect.x(), animatedX);
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.y(), toRect.y(), animatedY);
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.width(), toRect.width(), animatedWidth);
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.height(), toRect.height(), animatedHeight);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.x(), toRect.x(), toAtEndOfDurationRect.x(), animatedX);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.y(), toRect.y(), toAtEndOfDurationRect.y(), animatedY);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.width(), toRect.width(), toAtEndOfDurationRect.width(), animatedWidth);
+    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromRect.height(), toRect.height(), toAtEndOfDurationRect.height(), animatedHeight);
 
     animatedRect = FloatRect(animatedX, animatedY, animatedWidth, animatedHeight);
 }
index a27d915..51b947a 100644 (file)
@@ -52,8 +52,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 
     static bool parseSVGRect(const String&, FloatRect&);
index 19fcc30..ab9110b 100644 (file)
@@ -73,7 +73,7 @@ static String parseStringFromString(SVGAnimationElement*, const String& string)
     return string;
 }
 
-void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedStringAnimator::calculateAnimatedValue(float percentage, unsigned, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType*, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
     ASSERT(m_contextElement);
index f82ed5f..89c86a0 100644 (file)
@@ -51,8 +51,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 };
 
index ec8d9a6..50d2d57 100644 (file)
@@ -93,7 +93,7 @@ void SVGAnimatedTransformListAnimator::addAnimatedTypes(SVGAnimatedType* from, S
     toTransform = SVGTransformDistance::addSVGTransforms(fromTransform, toTransform);
 }
 
-void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
 {
     ASSERT(m_animationElement);
 
@@ -103,6 +103,7 @@ void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage,
     // FIXME: This is not taken into account yet.
     SVGTransformList& fromTransformList = from->transformList();
     SVGTransformList& toTransformList = to->transformList();
+    SVGTransformList& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
     SVGTransformList& animatedTransformList = animated->transformList();
 
     // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-multiplication behavior of <animateTransform> needs to be respected below.
@@ -117,9 +118,10 @@ void SVGAnimatedTransformListAnimator::calculateAnimatedValue(float percentage,
     SVGTransform& toTransform = toTransformList[0];
     SVGTransform effectiveFrom = fromTransformListSize ? fromTransformList[0] : SVGTransform(toTransform.type(), SVGTransform::ConstructZeroTransform);
     SVGTransform currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
-    if (m_animationElement->isAccumulated() && repeatCount)
-        animatedTransformList.append(SVGTransformDistance::addSVGTransforms(currentTransform, toTransform, repeatCount));
-    else
+    if (m_animationElement->isAccumulated() && repeatCount) {
+        SVGTransform& toAtEndOfDurationTransform = toAtEndOfDurationTransformList[0];
+        animatedTransformList.append(SVGTransformDistance::addSVGTransforms(currentTransform, toAtEndOfDurationTransform, repeatCount));
+    } else
         animatedTransformList.append(currentTransform);
 }
 
index 26a7983..a2bb473 100644 (file)
@@ -50,8 +50,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&);
 
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*);
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*);
     virtual float calculateDistance(const String& fromString, const String& toString);
 
 private:
index c4e050e..aaa03c3 100644 (file)
@@ -59,8 +59,7 @@ public:
     virtual void animValDidChange(const SVGElementAnimatedPropertyList&) = 0;
     virtual void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) = 0;
 
-    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
-                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue) = 0;
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) = 0;
     virtual float calculateDistance(const String& fromString, const String& toString) = 0;
 
     void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
index 128274f..4c6b427 100644 (file)
@@ -493,12 +493,13 @@ void SVGAnimationElement::currentValuesFromKeyPoints(float percent, float& effec
     to = m_values[index + 1];
 }
     
-void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to)
+void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to, String& toAtEndOfDuration)
 {
     unsigned valuesCount = m_values.size();
     ASSERT(m_animationValid);
     ASSERT(valuesCount >= 1);
 
+    toAtEndOfDuration = m_values.last();
     if (percent == 1 || valuesCount == 1) {
         from = m_values[valuesCount - 1];
         to = m_values[valuesCount - 1];
@@ -540,7 +541,7 @@ void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float&
         fromPercent = m_keyTimes[index];
         toPercent = m_keyTimes[index + 1];
     } else {        
-        index = static_cast<unsigned>(percent * (valuesCount - 1));
+        index = static_cast<unsigned>(floorf(percent * (valuesCount - 1)));
         fromPercent =  static_cast<float>(index) / (valuesCount - 1);
         toPercent =  static_cast<float>(index + 1) / (valuesCount - 1);
     }
@@ -551,7 +552,7 @@ void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float&
     to = m_values[index + 1];
     ASSERT(toPercent > fromPercent);
     effectivePercent = (percent - fromPercent) / (toPercent - fromPercent);
-    
+
     if (calcMode == CalcModeSpline) {
         ASSERT(m_keySplines.size() == m_values.size() - 1);
         effectivePercent = calculatePercentForSpline(effectivePercent, index);
@@ -606,17 +607,18 @@ void SVGAnimationElement::startedActiveInterval()
         m_animationValid = calcMode == CalcModePaced || !fastHasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
 }
 
-void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement)
+void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount, SVGSMILElement* resultElement)
 {    
     if (!m_animationValid)
         return;
-    
+
+    String toAtEndOfDuration;
     float effectivePercent;
     CalcMode mode = calcMode();
     if (animationMode() == ValuesAnimation) {
         String from;
         String to;
-        currentValuesForValuesAnimation(percent, effectivePercent, from, to);
+        currentValuesForValuesAnimation(percent, effectivePercent, from, to, toAtEndOfDuration);
         if (from != m_lastValuesAnimationFrom || to != m_lastValuesAnimationTo) {
             m_animationValid = calculateFromAndToValues(from, to);
             if (!m_animationValid)
@@ -633,7 +635,7 @@ void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMI
     else
         effectivePercent = percent;
 
-    calculateAnimatedValue(effectivePercent, repeat, resultElement);
+    calculateAnimatedValue(effectivePercent, repeatCount, toAtEndOfDuration, resultElement);
 }
 
 void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& value)
index 5725e47..fc74ebb 100644 (file)
@@ -171,7 +171,7 @@ public:
         animatedType = AnimatedType(fromType);
     }
 
-    void animateAdditiveNumber(float percentage, unsigned repeatCount, float fromNumber, float toNumber, float& animatedNumber)
+    void animateAdditiveNumber(float percentage, unsigned repeatCount, float fromNumber, float toNumber, float toAtEndOfDurationNumber, float& animatedNumber)
     {
         float number;
         if (calcMode() == CalcModeDiscrete)
@@ -179,11 +179,8 @@ public:
         else
             number = (toNumber - fromNumber) * percentage + fromNumber;
 
-        // FIXME: This is not correct for values animation. Right now we transform values-animation to multiple from-to-animations and
-        // accumulate every single value to the previous one. But accumulation should just take into account after a complete cycle
-        // of values-animaiton. See example at: http://www.w3.org/TR/2001/REC-smil-animation-20010904/#RepeatingAnim
         if (isAccumulated() && repeatCount)
-            number += toNumber * repeatCount;
+            number += toAtEndOfDurationNumber * repeatCount;
 
         if (isAdditive() && animationMode() != ToAnimation)
             animatedNumber += number;
@@ -227,11 +224,11 @@ private:
 
     virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
     virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
-    virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement) = 0;
+    virtual void calculateAnimatedValue(float percent, unsigned repeatCount, const String& toAtEndOfDurationString, SVGSMILElement* resultElement) = 0;
     virtual float calculateDistance(const String& /*fromString*/, const String& /*toString*/) { return -1.f; }
     virtual Path animationPath() const { return Path(); }
 
-    void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to);
+    void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to, String& toAtEndOfDuration);
     void calculateKeyTimesForCalcModePaced();
     float calculatePercentFromKeyPoints(float percent) const;
     void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const;