SVG animations are not paused when inserted into a hidden page
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Mar 2017 22:40:50 +0000 (22:40 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Mar 2017 22:40:50 +0000 (22:40 +0000)
commit62599cb801b20321f9fef163e9387e94ee1ba880
treee99c641decc2e801ceb12c8e584b7234869ca628
parenteb5d6d9df5b5115a0540b28c48f0164e295d4192
SVG animations are not paused when inserted into a hidden page
https://bugs.webkit.org/show_bug.cgi?id=170026
<rdar://problem/31228704>

Reviewed by Andreas Kling.

Source/WebCore:

SVG animations were not paused when inserted into a hidden page. We would pause
animations in a page when the page becomes hidden. However, new animations
inserted in the page after this point would start, despite the page being
hidden.

Tests:
- svg/animations/animations-paused-when-inserted-in-hidden-document.html
- svg/animations/animations-paused-when-inserted-in-hidden-document2.html

* dom/Document.cpp:
(WebCore::Document::accessSVGExtensions):
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::SVGDocumentExtensions):
(WebCore::SVGDocumentExtensions::addTimeContainer):
(WebCore::reportMessage):
* svg/SVGDocumentExtensions.h:
* testing/Internals.cpp:
(WebCore::Internals::areSVGAnimationsPaused):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Add layout test coverage.

* svg/animations/animations-paused-when-inserted-in-hidden-document-expected.txt: Added.
* svg/animations/animations-paused-when-inserted-in-hidden-document.html: Added.
* svg/animations/animations-paused-when-inserted-in-hidden-document2-expected.txt: Added.
* svg/animations/animations-paused-when-inserted-in-hidden-document2.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@214322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/animations-paused-when-inserted-in-hidden-document-expected.txt [new file with mode: 0644]
LayoutTests/svg/animations/animations-paused-when-inserted-in-hidden-document.html [new file with mode: 0644]
LayoutTests/svg/animations/animations-paused-when-inserted-in-hidden-document2-expected.txt [new file with mode: 0644]
LayoutTests/svg/animations/animations-paused-when-inserted-in-hidden-document2.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebCore/svg/SVGDocumentExtensions.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl