Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit c338818

Browse files
[Web Animations] DocumentTimeline shouldn't suspend itself if hiddenPageCSSAnimationSuspensionEnabled is disabled
https://bugs.webkit.org/show_bug.cgi?id=207014 <rdar://problem/58815952> Reviewed by Antti Koivisto. We suspend a timeline upon consutrction if we know that the page is not visible because, unlike CSSAnimationController, the DocumentTimeline is not guaranteed to be created by the time the Page sets the initial visibility state. This is because DocumentTimeline is created as needed when there are CSS Animations or CSS Transitions created for the page, or if the content uses any of the Web Animations APIs. However, the Page::setIsVisibleInternal() function that would call DocumentTimeline::resumeAnimations() at a later time checks whether the hiddenPageCSSAnimationSuspensionEnabled setting is enabled. So we must respect that setting also when suspending animations in the first place or we risk ending up in a state where we suspend animations because the page is not visible upon timeline creation, but never resuming animations later due to the hiddenPageCSSAnimationSuspensionEnabled setting being false. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@255489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent f110fdb commit c338818

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

Source/WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2020-01-30 Antoine Quint <[email protected]>
2+
3+
[Web Animations] DocumentTimeline shouldn't suspend itself if hiddenPageCSSAnimationSuspensionEnabled is disabled
4+
https://bugs.webkit.org/show_bug.cgi?id=207014
5+
<rdar://problem/58815952>
6+
7+
Reviewed by Antti Koivisto.
8+
9+
We suspend a timeline upon consutrction if we know that the page is not visible because, unlike CSSAnimationController, the DocumentTimeline is not guaranteed
10+
to be created by the time the Page sets the initial visibility state. This is because DocumentTimeline is created as needed when there are CSS Animations or CSS
11+
Transitions created for the page, or if the content uses any of the Web Animations APIs.
12+
13+
However, the Page::setIsVisibleInternal() function that would call DocumentTimeline::resumeAnimations() at a later time checks whether the hiddenPageCSSAnimationSuspensionEnabled
14+
setting is enabled. So we must respect that setting also when suspending animations in the first place or we risk ending up in a state where we suspend animations
15+
because the page is not visible upon timeline creation, but never resuming animations later due to the hiddenPageCSSAnimationSuspensionEnabled setting being false.
16+
17+
* animation/DocumentTimeline.cpp:
18+
(WebCore::DocumentTimeline::DocumentTimeline):
19+
120
2020-01-31 Jiewen Tan <[email protected]>
221

322
REGRESSION: [iOS release] http/tests/security/window-named-proto.html is a flaky timing out

Source/WebCore/animation/DocumentTimeline.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "RenderElement.h"
4444
#include "RenderLayer.h"
4545
#include "RenderLayerBacking.h"
46+
#include "Settings.h"
4647
#include <JavaScriptCore/VM.h>
4748

4849
namespace WebCore {
@@ -63,10 +64,13 @@ DocumentTimeline::DocumentTimeline(Document& document, Seconds originTime)
6364
, m_document(&document)
6465
, m_originTime(originTime)
6566
{
66-
if (m_document)
67+
if (m_document) {
6768
m_document->addTimeline(*this);
68-
if (m_document && m_document->page() && !m_document->page()->isVisible())
69-
suspendAnimations();
69+
if (auto* page = m_document->page()) {
70+
if (page->settings().hiddenPageCSSAnimationSuspensionEnabled() && !page->isVisible())
71+
suspendAnimations();
72+
}
73+
}
7074
}
7175

7276
DocumentTimeline::~DocumentTimeline()

0 commit comments

Comments
 (0)