Title: [214327] trunk
- Revision
- 214327
- Author
- cdu...@apple.com
- Date
- 2017-03-23 16:51:20 -0700 (Thu, 23 Mar 2017)
Log Message
SVG animations are not paused when their <svg> element is removed from the document
https://bugs.webkit.org/show_bug.cgi?id=170030
<rdar://problem/31230252>
Reviewed by Dean Jackson.
Source/WebCore:
SVG animations were not paused when their <svg> element was removed from the document.
This patch fixes the issue.
Test: svg/animations/animations-paused-when-removed-from-document.html
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::insertedInto):
(WebCore::SVGSVGElement::removedFrom):
LayoutTests:
Add layout test coverage.
* svg/animations/animations-paused-when-removed-from-document-expected.txt: Added.
* svg/animations/animations-paused-when-removed-from-document.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (214326 => 214327)
--- trunk/LayoutTests/ChangeLog 2017-03-23 23:42:41 UTC (rev 214326)
+++ trunk/LayoutTests/ChangeLog 2017-03-23 23:51:20 UTC (rev 214327)
@@ -1,3 +1,16 @@
+2017-03-23 Chris Dumez <cdu...@apple.com>
+
+ SVG animations are not paused when their <svg> element is removed from the document
+ https://bugs.webkit.org/show_bug.cgi?id=170030
+ <rdar://problem/31230252>
+
+ Reviewed by Dean Jackson.
+
+ Add layout test coverage.
+
+ * svg/animations/animations-paused-when-removed-from-document-expected.txt: Added.
+ * svg/animations/animations-paused-when-removed-from-document.html: Added.
+
2017-03-22 Myles C. Maxfield <mmaxfi...@apple.com>
font shorthand should accept variation values
Added: trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document-expected.txt (0 => 214327)
--- trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document-expected.txt 2017-03-23 23:51:20 UTC (rev 214327)
@@ -0,0 +1,16 @@
+Tests that SVG animations are properly paused when removed from the document.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.areSVGAnimationsPaused is false
+PASS svgElement.animationsPaused() is false
+Removing SVG element from the document
+PASS svgElement.animationsPaused() is true
+Adding SVG element back into the document
+PASS internals.areSVGAnimationsPaused is false
+PASS svgElement.animationsPaused() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document.html (0 => 214327)
--- trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document.html (rev 0)
+++ trunk/LayoutTests/svg/animations/animations-paused-when-removed-from-document.html 2017-03-23 23:51:20 UTC (rev 214327)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that SVG animations are properly paused when removed from the document.");
+jsTestIsAsync = true;
+
+window._onload_ = function() {
+ testDiv = document.getElementById("testDiv");
+ svgElement = document.querySelector("svg");
+ shouldBeFalse("internals.areSVGAnimationsPaused");
+ shouldBeFalse("svgElement.animationsPaused()");
+
+ debug("Removing SVG element from the document");
+ testDiv.remove();
+
+ setTimeout(function() {
+ shouldBeTrue("svgElement.animationsPaused()");
+
+ debug("Adding SVG element back into the document");
+ document.body.appendChild(testDiv);
+
+ setTimeout(function() {
+ shouldBeFalse("internals.areSVGAnimationsPaused");
+ shouldBeFalse("svgElement.animationsPaused()");
+ finishJSTest();
+ }, 0);
+ }, 0);
+}
+</script>
+<div id="testDiv">
+<svg width="300px" height="100px">
+ <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" />
+ <circle cx="0" cy="50" r="15" fill="blue" stroke="black" stroke-width="1">
+ <animate attributeName="cx" from="0" to="100" dur="5s" repeatCount="indefinite" />
+ </circle>
+</svg>
+</div>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (214326 => 214327)
--- trunk/Source/WebCore/ChangeLog 2017-03-23 23:42:41 UTC (rev 214326)
+++ trunk/Source/WebCore/ChangeLog 2017-03-23 23:51:20 UTC (rev 214327)
@@ -1,3 +1,20 @@
+2017-03-23 Chris Dumez <cdu...@apple.com>
+
+ SVG animations are not paused when their <svg> element is removed from the document
+ https://bugs.webkit.org/show_bug.cgi?id=170030
+ <rdar://problem/31230252>
+
+ Reviewed by Dean Jackson.
+
+ SVG animations were not paused when their <svg> element was removed from the document.
+ This patch fixes the issue.
+
+ Test: svg/animations/animations-paused-when-removed-from-document.html
+
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::insertedInto):
+ (WebCore::SVGSVGElement::removedFrom):
+
2017-03-22 Myles C. Maxfield <mmaxfi...@apple.com>
font shorthand should accept variation values
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (214326 => 214327)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2017-03-23 23:42:41 UTC (rev 214326)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2017-03-23 23:51:20 UTC (rev 214327)
@@ -469,6 +469,8 @@
{
if (rootParent.isConnected()) {
document().accessSVGExtensions().addTimeContainer(this);
+ if (!document().accessSVGExtensions().areAnimationsPaused())
+ unpauseAnimations();
// Animations are started at the end of document parsing and after firing the load event,
// but if we miss that train (deferred programmatic element insertion for example) we need
@@ -481,8 +483,10 @@
void SVGSVGElement::removedFrom(ContainerNode& rootParent)
{
- if (rootParent.isConnected())
+ if (rootParent.isConnected()) {
document().accessSVGExtensions().removeTimeContainer(this);
+ pauseAnimations();
+ }
SVGGraphicsElement::removedFrom(rootParent);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes