Title: [121146] trunk
Revision
121146
Author
[email protected]
Date
2012-06-25 03:31:06 -0700 (Mon, 25 Jun 2012)

Log Message

Fix rewinding of SVG animations
https://bugs.webkit.org/show_bug.cgi?id=89846

Reviewed by Nikolas Zimmermann.

Source/WebCore:

r116451 introduced an optimization to only clear non-freeze animations when
calling setCurrentTime (via reset()). This causes fill=freeze animations to
not clear which breaks rewinding of an animation.

In the presence of multiple animations, we reset the first animation to the
base value and accumulate all results into that; this masked the problem because
2 animations were required to hit the bug (our tests primarily cover just 1).

Test: svg/animations/animate-reset-freeze.html

* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::reset):

LayoutTests:

* svg/animations/animate-reset-freeze-expected.txt: Added.
* svg/animations/animate-reset-freeze.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121145 => 121146)


--- trunk/LayoutTests/ChangeLog	2012-06-25 09:43:07 UTC (rev 121145)
+++ trunk/LayoutTests/ChangeLog	2012-06-25 10:31:06 UTC (rev 121146)
@@ -1,3 +1,13 @@
+2012-06-25  Philip Rogers  <[email protected]>
+
+        Fix rewinding of SVG animations
+        https://bugs.webkit.org/show_bug.cgi?id=89846
+
+        Reviewed by Nikolas Zimmermann.
+
+        * svg/animations/animate-reset-freeze-expected.txt: Added.
+        * svg/animations/animate-reset-freeze.html: Added.
+
 2012-06-25  Kent Tamura  <[email protected]>
 
         Change the serialization format of form control state to make the code simple

Added: trunk/LayoutTests/svg/animations/animate-reset-freeze-expected.txt (0 => 121146)


--- trunk/LayoutTests/svg/animations/animate-reset-freeze-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-reset-freeze-expected.txt	2012-06-25 10:31:06 UTC (rev 121146)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/svg/animations/animate-reset-freeze.html (0 => 121146)


--- trunk/LayoutTests/svg/animations/animate-reset-freeze.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-reset-freeze.html	2012-06-25 10:31:06 UTC (rev 121146)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <!--
+        Test for WK89846: Animations should be rewindable even with existing fill=freeze animations.
+        If this test passes, only the word "PASS" will be visible.
+        -->
+        <script src=""
+    </head>
+    <body>
+        <svg id="svg" width="500" height="500">
+            <rect x="0" y="0" width="100" height="100" fill="red"/>
+            <rect id="rect" x="0" y="0" width="100" height="100" fill="blue">
+                <set attributeName="x" to="100" begin="4s" fill="freeze"></set>
+                <set attributeName="x" to="200" begin="1s" dur="1s" fill="freeze">
+            </rect>
+        </svg>
+        <script>
+            if (window.testRunner) {
+                testRunner.waitUntilDone();
+                testRunner.dumpAsText();
+            }
+
+            var svg = document.getElementById('svg');
+            var rect = document.getElementById('rect');
+            svg.pauseAnimations();
+            svg.setCurrentTime(100);
+
+            setTimeout(function() {
+                svg.setCurrentTime(0);
+                if (rect.x.animVal.value != 0)
+                    document.body.innerHTML = "FAIL: rect.x.animVal.value was " + rect.x.animVal.value + ", expected 0";
+                else
+                    document.body.innerHTML = "PASS";
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 1);
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (121145 => 121146)


--- trunk/Source/WebCore/ChangeLog	2012-06-25 09:43:07 UTC (rev 121145)
+++ trunk/Source/WebCore/ChangeLog	2012-06-25 10:31:06 UTC (rev 121146)
@@ -1,3 +1,23 @@
+2012-06-25  Philip Rogers  <[email protected]>
+
+        Fix rewinding of SVG animations
+        https://bugs.webkit.org/show_bug.cgi?id=89846
+
+        Reviewed by Nikolas Zimmermann.
+
+        r116451 introduced an optimization to only clear non-freeze animations when
+        calling setCurrentTime (via reset()). This causes fill=freeze animations to
+        not clear which breaks rewinding of an animation.
+
+        In the presence of multiple animations, we reset the first animation to the
+        base value and accumulate all results into that; this masked the problem because
+        2 animations were required to hit the bug (our tests primarily cover just 1).
+
+        Test: svg/animations/animate-reset-freeze.html
+
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::reset):
+
 2012-06-25  Kent Tamura  <[email protected]>
 
         Change the serialization format of form control state to make the code simple

Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (121145 => 121146)


--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-06-25 09:43:07 UTC (rev 121145)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-06-25 10:31:06 UTC (rev 121146)
@@ -178,9 +178,7 @@
 
 void SVGSMILElement::reset()
 {
-    // Don't clear the animated type if we're frozen, only take action here if we're active.
-    if (m_activeState == Active)
-        clearAnimatedType(m_targetElement);
+    clearAnimatedType(m_targetElement);
 
     m_activeState = Inactive;
     m_isWaitingForFirstInterval = true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to