Title: [121246] trunk
Revision
121246
Author
[email protected]
Date
2012-06-26 03:06:34 -0700 (Tue, 26 Jun 2012)

Log Message

Fix setCurrentTime for paused animations
https://bugs.webkit.org/show_bug.cgi?id=81350

Reviewed by Nikolas Zimmermann.

Source/WebCore:

SMILTimeContainer::setElapsed was not resetting the pause time, breaking
setCurrentTime if the animation was paused.

Test: svg/custom/animate-pause-resume.html

* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::setElapsed):

LayoutTests:

This test does not use the SVG animation test framework because the framework
works by pausing animations and testing animated values at fixed times
(through calling setCurrentTime). Testing this patch requires that we run
the animation and cannot be tested with the animation test framework.

* svg/custom/animate-pause-resume-expected.txt: Added.
* svg/custom/animate-pause-resume.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121245 => 121246)


--- trunk/LayoutTests/ChangeLog	2012-06-26 10:04:40 UTC (rev 121245)
+++ trunk/LayoutTests/ChangeLog	2012-06-26 10:06:34 UTC (rev 121246)
@@ -1,3 +1,18 @@
+2012-06-26  Philip Rogers  <[email protected]>
+
+        Fix setCurrentTime for paused animations
+        https://bugs.webkit.org/show_bug.cgi?id=81350
+
+        Reviewed by Nikolas Zimmermann.
+
+        This test does not use the SVG animation test framework because the framework
+        works by pausing animations and testing animated values at fixed times
+        (through calling setCurrentTime). Testing this patch requires that we run
+        the animation and cannot be tested with the animation test framework.
+
+        * svg/custom/animate-pause-resume-expected.txt: Added.
+        * svg/custom/animate-pause-resume.html: Added.
+
 2012-06-26  Tony Chang  <[email protected]>
 
         [Qt] Enable grid layout LayoutTests

Added: trunk/LayoutTests/svg/custom/animate-pause-resume-expected.txt (0 => 121246)


--- trunk/LayoutTests/svg/custom/animate-pause-resume-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/animate-pause-resume-expected.txt	2012-06-26 10:06:34 UTC (rev 121246)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/svg/custom/animate-pause-resume.html (0 => 121246)


--- trunk/LayoutTests/svg/custom/animate-pause-resume.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/animate-pause-resume.html	2012-06-26 10:06:34 UTC (rev 121246)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+    Test for WK81350: setCurrentTime() should work when animation is paused.
+-->
+<body>
+    <svg id="svg" width="400" height="400">
+        <rect id="rect" x="0" y="0" width="100" height="100" fill="green">
+            <animate attributeName="x" from="200" to="400" begin="0s" dur="4s" />
+        </rect>
+    </svg>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+        }
+
+        var svg = document.getElementById("svg");
+        var rect = document.getElementById("rect");
+
+        svg.pauseAnimations();
+        setTimeout(function() {
+            svg.setCurrentTime(4);
+            svg.unpauseAnimations();
+            setTimeout(function() {
+                if (rect.x.animVal.value == 0)
+                    document.body.innerHTML = "PASS";
+                else
+                    document.body.innerHTML = "FAIL : rect.x.animVal.value was " + rect.x.animVal.value + " but we expected 0.";
+
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 1);
+        }, 50);
+    </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (121245 => 121246)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 10:04:40 UTC (rev 121245)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 10:06:34 UTC (rev 121246)
@@ -1,3 +1,18 @@
+2012-06-26  Philip Rogers  <[email protected]>
+
+        Fix setCurrentTime for paused animations
+        https://bugs.webkit.org/show_bug.cgi?id=81350
+
+        Reviewed by Nikolas Zimmermann.
+
+        SMILTimeContainer::setElapsed was not resetting the pause time, breaking
+        setCurrentTime if the animation was paused.
+
+        Test: svg/custom/animate-pause-resume.html
+
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::setElapsed):
+
 2012-06-26  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed typo fix after r121144.

Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (121245 => 121246)


--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2012-06-26 10:04:40 UTC (rev 121245)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2012-06-26 10:06:34 UTC (rev 121246)
@@ -131,8 +131,12 @@
     if (m_beginTime)
         m_timer.stop();
 
-    m_beginTime = currentTime() - time.value();
+    double now = currentTime();
+    m_beginTime = now - time.value();
+
     m_accumulatedPauseTime = 0;
+    if (m_pauseTime)
+        m_pauseTime = now;
 
     Vector<SVGSMILElement*> toReset;
     copyToVector(m_scheduledAnimations, toReset);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to