Title: [143640] trunk
Revision
143640
Author
[email protected]
Date
2013-02-21 12:37:25 -0800 (Thu, 21 Feb 2013)

Log Message

Stop starting animations when leaving a page
https://bugs.webkit.org/show_bug.cgi?id=110257

Reviewed by Stephen Chenney.

Source/WebCore:

SVGImage::resetAnimation() incorrectly started animations which could cause a crash
when leaving the page. This patch fixes resetAnimation to only stop the animation,
similar to BitmapImage::resetAnimation().

Additionally, this patch removes an unneeded call to Document::updateStyleForAllDocuments()
that was present in the animation loop. This makes the animation code more resistant to
similar bugs in the future.

Both of these changes are functionally covered with existing tests.

Test: svg/animations/reset-animation-crash.html

* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::updateAnimations):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::resetAnimation):

LayoutTests:

* svg/animations/reset-animation-crash-expected.html: Added.
* svg/animations/reset-animation-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143639 => 143640)


--- trunk/LayoutTests/ChangeLog	2013-02-21 20:33:11 UTC (rev 143639)
+++ trunk/LayoutTests/ChangeLog	2013-02-21 20:37:25 UTC (rev 143640)
@@ -1,3 +1,13 @@
+2013-02-21  Philip Rogers  <[email protected]>
+
+        Stop starting animations when leaving a page
+        https://bugs.webkit.org/show_bug.cgi?id=110257
+
+        Reviewed by Stephen Chenney.
+
+        * svg/animations/reset-animation-crash-expected.html: Added.
+        * svg/animations/reset-animation-crash.html: Added.
+
 2013-02-21  Nate Chapin  <[email protected]>
 
         REGRESSION: Crash in MainResourceLoader::setDataBufferingPolicy when sharing an html5 video via email

Added: trunk/LayoutTests/svg/animations/reset-animation-crash-expected.html (0 => 143640)


--- trunk/LayoutTests/svg/animations/reset-animation-crash-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/reset-animation-crash-expected.html	2013-02-21 20:37:25 UTC (rev 143640)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+  Test for WK110257: This test passes if it does not crash.
+</body>
+</html>
+

Added: trunk/LayoutTests/svg/animations/reset-animation-crash.html (0 => 143640)


--- trunk/LayoutTests/svg/animations/reset-animation-crash.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/reset-animation-crash.html	2013-02-21 20:37:25 UTC (rev 143640)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style id='style'>
+  #div {
+    -webkit-mask-image: url('resources/remove-animation-element-while-animation-is-running.svg');
+  }
+</style>
+<script>
+  if (window.testRunner)
+    testRunner.waitUntilDone();
+
+  function setupCrash() {
+    setTimeout("crash()", 1);
+  }
+
+  function crash() {
+    var styleEl = document.getElementById('style');
+    styleEl.parentNode.removeChild(styleEl);
+    var divEl = document.getElementById('div');
+    document.adoptNode(divEl);
+    if (window.testRunner)
+      testRunner.notifyDone();
+  }
+</script>
+</head>
+<body _onload_="setupCrash()">
+  Test for WK110257: This test passes if it does not crash.
+  <div id='div'></div>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (143639 => 143640)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 20:33:11 UTC (rev 143639)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 20:37:25 UTC (rev 143640)
@@ -1,3 +1,27 @@
+2013-02-21  Philip Rogers  <[email protected]>
+
+        Stop starting animations when leaving a page
+        https://bugs.webkit.org/show_bug.cgi?id=110257
+
+        Reviewed by Stephen Chenney.
+
+        SVGImage::resetAnimation() incorrectly started animations which could cause a crash
+        when leaving the page. This patch fixes resetAnimation to only stop the animation,
+        similar to BitmapImage::resetAnimation().
+
+        Additionally, this patch removes an unneeded call to Document::updateStyleForAllDocuments()
+        that was present in the animation loop. This makes the animation code more resistant to
+        similar bugs in the future.
+
+        Both of these changes are functionally covered with existing tests.
+
+        Test: svg/animations/reset-animation-crash.html
+
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::updateAnimations):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::resetAnimation):
+
 2013-02-19  Mark Hahnenberg  <[email protected]>
 
         Objective-C API: Need a way to use the Objective-C _javascript_ API with WebKit

Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (143639 => 143640)


--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2013-02-21 20:33:11 UTC (rev 143639)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2013-02-21 20:37:25 UTC (rev 143640)
@@ -323,7 +323,6 @@
 #endif
 
     startTimer(earliestFireTime, animationFrameDelay);
-    Document::updateStyleForAllDocuments();
 }
 
 }

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (143639 => 143640)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2013-02-21 20:33:11 UTC (rev 143639)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2013-02-21 20:37:25 UTC (rev 143640)
@@ -295,7 +295,6 @@
 void SVGImage::resetAnimation()
 {
     stopAnimation();
-    startAnimation();
 }
 
 bool SVGImage::dataChanged(bool allDataReceived)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to