Title: [90345] trunk
Revision
90345
Author
k...@webkit.org
Date
2011-07-03 13:22:22 -0700 (Sun, 03 Jul 2011)

Log Message

2011-07-03  Dirk Schulze  <k...@webkit.org>

        SVGAnimateTransform accumulate=sum restarts on every repeat
        https://bugs.webkit.org/show_bug.cgi?id=63876

        Reviewed by Nikolas Zimmermann.
        
        Test accumulate=sum on SVGAnimateTransform. The animation shouldn't start with initial value
        on every repeat for accumulation.

        * svg/animations/script-tests/svgtransform-animation-1.js: Added.
        (sample1):
        (sample2):
        (sample3):
        (executeTest):
        * svg/animations/svgtransform-animation-1-expected.txt: Added.
        * svg/animations/svgtransform-animation-1.html: Added.
2011-07-03  Dirk Schulze  <k...@webkit.org>

        SVGAnimateTransform accumulate=sum restarts on every repeat
        https://bugs.webkit.org/show_bug.cgi?id=63876

        Reviewed by Nikolas Zimmermann.
        
        We applied transforms from previous animation repeats to a transform list. The problem is, that we calculated the current
        transform based on the percentage of the current repeat count. This causes an animation starting from scale level 0
        on every repeat. Now I add the repeat count to the current percentage, so that the distance calculation starts from 100% on
        the first repeat, from 200% on the second and so on.

        Test: svg/animations/svgtransform-animation-1.html

        * svg/SVGAnimateTransformElement.cpp:
        (WebCore::SVGAnimateTransformElement::calculateAnimatedValue):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90344 => 90345)


--- trunk/LayoutTests/ChangeLog	2011-07-03 18:29:08 UTC (rev 90344)
+++ trunk/LayoutTests/ChangeLog	2011-07-03 20:22:22 UTC (rev 90345)
@@ -1,3 +1,21 @@
+2011-07-03  Dirk Schulze  <k...@webkit.org>
+
+        SVGAnimateTransform accumulate=sum restarts on every repeat
+        https://bugs.webkit.org/show_bug.cgi?id=63876
+
+        Reviewed by Nikolas Zimmermann.
+        
+        Test accumulate=sum on SVGAnimateTransform. The animation shouldn't start with initial value
+        on every repeat for accumulation.
+
+        * svg/animations/script-tests/svgtransform-animation-1.js: Added.
+        (sample1):
+        (sample2):
+        (sample3):
+        (executeTest):
+        * svg/animations/svgtransform-animation-1-expected.txt: Added.
+        * svg/animations/svgtransform-animation-1.html: Added.
+
 2011-07-03  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r90342.

Modified: trunk/LayoutTests/platform/wk2/Skipped (90344 => 90345)


--- trunk/LayoutTests/platform/wk2/Skipped	2011-07-03 18:29:08 UTC (rev 90344)
+++ trunk/LayoutTests/platform/wk2/Skipped	2011-07-03 20:22:22 UTC (rev 90345)
@@ -493,6 +493,7 @@
 svg/animations/svgPreserveAspectRatio-animation-1.html
 svg/animations/svgrect-animation-1.html
 svg/animations/svgrect-animation-2.html
+svg/animations/svgtransform-animation-1.html
 svg/animations/svgstring-animation-fallback-to-discrete.html
 svg/custom/absolute-sized-content-with-resources.xhtml
 svg/custom/circle-move-invalidation.svg

Added: trunk/LayoutTests/svg/animations/script-tests/svgtransform-animation-1.js (0 => 90345)


--- trunk/LayoutTests/svg/animations/script-tests/svgtransform-animation-1.js	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/svgtransform-animation-1.js	2011-07-03 20:22:22 UTC (rev 90345)
@@ -0,0 +1,63 @@
+description("Test accumulate=sum animation on SVGAnimateTransform.");
+createSVGTestCase();
+// FIXME: We should move to animatePathSegList, once it is implemented.
+
+// Setup test document
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("width", "100");
+rect.setAttribute("height", "100");
+rect.setAttribute("fill", "green");
+rect.setAttribute("onclick", "executeTest()");
+
+var animate = createSVGElement("animateTransform");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "transform");
+animate.setAttribute("type", "scale");
+animate.setAttribute("from", "0,0");
+animate.setAttribute("to", "2,2");
+animate.setAttribute("type", "scale");
+animate.setAttribute("accumulate", "sum");
+animate.setAttribute("repeatCount", "2");
+animate.setAttribute("additive", "sum");
+animate.setAttribute("dur", "4s");
+rect.appendChild(animate);
+rootSVGElement.appendChild(rect);
+
+// Setup animation test
+function sample1() {
+    // Check initial/end conditions
+    shouldBe("rect.transform.animVal.numberOfItems", "1");
+    shouldBe("rect.transform.animVal.getItem(0).type", "SVGTransform.SVG_TRANSFORM_SCALE");
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.a", "0.01", 0.01);
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.d", "0.01", 0.01);
+}
+
+function sample2() {
+    shouldBe("rect.transform.animVal.numberOfItems", "1");
+    shouldBe("rect.transform.animVal.getItem(0).type", "SVGTransform.SVG_TRANSFORM_SCALE");
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.a", "1", 0.01);
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.d", "1", 0.01);
+}
+
+function sample3() {
+    shouldBe("rect.transform.animVal.numberOfItems", "1");
+    shouldBe("rect.transform.animVal.getItem(0).type", "SVGTransform.SVG_TRANSFORM_SCALE");
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.a", "2", 0.01);
+    shouldBeCloseEnough("rect.transform.animVal.getItem(0).matrix.d", "2", 0.01);
+}
+
+function executeTest() {
+    const expectedValues = [
+        // [animationId, time, elementId, sampleCallback]
+        ["animation", 0.0,    "rect", sample1],
+        ["animation", 2.0,    "rect", sample2],
+        ["animation", 3.9999, "rect", sample3]
+    ];
+
+    runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(50, 50)", 0);
+var successfullyParsed = true;

Added: trunk/LayoutTests/svg/animations/svgtransform-animation-1-expected.txt (0 => 90345)


--- trunk/LayoutTests/svg/animations/svgtransform-animation-1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/svgtransform-animation-1-expected.txt	2011-07-03 20:22:22 UTC (rev 90345)
@@ -0,0 +1,23 @@
+SVG 1.1 dynamic animation tests
+
+Test accumulate=sum animation on SVGAnimateTransform.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.transform.animVal.numberOfItems is 1
+PASS rect.transform.animVal.getItem(0).type is SVGTransform.SVG_TRANSFORM_SCALE
+PASS rect.transform.animVal.getItem(0).matrix.a is 0.01
+PASS rect.transform.animVal.getItem(0).matrix.d is 0.01
+PASS rect.transform.animVal.numberOfItems is 1
+PASS rect.transform.animVal.getItem(0).type is SVGTransform.SVG_TRANSFORM_SCALE
+PASS rect.transform.animVal.getItem(0).matrix.a is 1
+PASS rect.transform.animVal.getItem(0).matrix.d is 1
+PASS rect.transform.animVal.numberOfItems is 1
+PASS rect.transform.animVal.getItem(0).type is SVGTransform.SVG_TRANSFORM_SCALE
+PASS rect.transform.animVal.getItem(0).matrix.a is 2
+PASS rect.transform.animVal.getItem(0).matrix.d is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/animations/svgtransform-animation-1.html (0 => 90345)


--- trunk/LayoutTests/svg/animations/svgtransform-animation-1.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/svgtransform-animation-1.html	2011-07-03 20:22:22 UTC (rev 90345)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (90344 => 90345)


--- trunk/Source/WebCore/ChangeLog	2011-07-03 18:29:08 UTC (rev 90344)
+++ trunk/Source/WebCore/ChangeLog	2011-07-03 20:22:22 UTC (rev 90345)
@@ -1,3 +1,20 @@
+2011-07-03  Dirk Schulze  <k...@webkit.org>
+
+        SVGAnimateTransform accumulate=sum restarts on every repeat
+        https://bugs.webkit.org/show_bug.cgi?id=63876
+
+        Reviewed by Nikolas Zimmermann.
+        
+        We applied transforms from previous animation repeats to a transform list. The problem is, that we calculated the current
+        transform based on the percentage of the current repeat count. This causes an animation starting from scale level 0
+        on every repeat. Now I add the repeat count to the current percentage, so that the distance calculation starts from 100% on
+        the first repeat, from 200% on the second and so on.
+
+        Test: svg/animations/svgtransform-animation-1.html
+
+        * svg/SVGAnimateTransformElement.cpp:
+        (WebCore::SVGAnimateTransformElement::calculateAnimatedValue):
+
 2011-07-03  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r90342.

Modified: trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp (90344 => 90345)


--- trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp	2011-07-03 18:29:08 UTC (rev 90344)
+++ trunk/Source/WebCore/svg/SVGAnimateTransformElement.cpp	2011-07-03 20:22:22 UTC (rev 90345)
@@ -161,10 +161,8 @@
 
     if (!isAdditive())
         transformList->clear();
-    if (isAccumulated() && repeat) {
-        SVGTransform accumulatedTransform = SVGTransformDistance(m_fromTransform, m_toTransform).scaledDistance(repeat).addToSVGTransform(SVGTransform());
-        transformList->append(accumulatedTransform);
-    }
+    if (isAccumulated() && repeat)
+        percentage += repeat;
     SVGTransform transform = SVGTransformDistance(m_fromTransform, m_toTransform).scaledDistance(percentage).addToSVGTransform(m_fromTransform);
     transformList->append(transform);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to