[Web Animations] Do not create a DocumentTimeline to suspend or resume animations
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 19:06:49 +0000 (19:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 19:06:49 +0000 (19:06 +0000)
commit2a97f7becacf930c14491de19c128a58d2f10dec
tree1d6f18e33373f1d69b81440b175352db0e209fe6
parent56b0faadc1f072a8420f53795ecfd6af595143b9
[Web Animations] Do not create a DocumentTimeline to suspend or resume animations
https://bugs.webkit.org/show_bug.cgi?id=190660

Patch by Antoine Quint <graouts@apple.com> on 2018-10-17
Reviewed by Dean Jackson.

We check that there is an existing timeline before trying to suspend or resume its animations, otherwise
we're creating a DocumentTimeline when nothing requires for it to exist. We also have to check that we
suspend animations when a DocumentTimeline is created while the page is not visible.

No new tests as there is no change in behavior here.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::DocumentTimeline):
* dom/Document.cpp:
(WebCore::Document::didBecomeCurrentDocumentInFrame):
(WebCore::Document::resume):
* page/Frame.cpp:
(WebCore::Frame::clearTimers):
* page/Page.cpp:
(WebCore::Page::setIsVisibleInternal):
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Page.cpp