Title: [255489] trunk/Source/WebCore
Revision
255489
Author
grao...@webkit.org
Date
2020-01-31 02:20:12 -0800 (Fri, 31 Jan 2020)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (255488 => 255489)


--- trunk/Source/WebCore/ChangeLog	2020-01-31 09:54:14 UTC (rev 255488)
+++ trunk/Source/WebCore/ChangeLog	2020-01-31 10:20:12 UTC (rev 255489)
@@ -1,3 +1,22 @@
+2020-01-30  Antoine Quint  <grao...@apple.com>
+
+        [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):
+
 2020-01-31  Jiewen Tan  <jiewen_...@apple.com>
 
         REGRESSION: [iOS release] http/tests/security/window-named-proto.html is a flaky timing out

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (255488 => 255489)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-01-31 09:54:14 UTC (rev 255488)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-01-31 10:20:12 UTC (rev 255489)
@@ -43,6 +43,7 @@
 #include "RenderElement.h"
 #include "RenderLayer.h"
 #include "RenderLayerBacking.h"
+#include "Settings.h"
 #include <_javascript_Core/VM.h>
 
 namespace WebCore {
@@ -63,10 +64,13 @@
     , m_document(&document)
     , m_originTime(originTime)
 {
-    if (m_document)
+    if (m_document) {
         m_document->addTimeline(*this);
-    if (m_document && m_document->page() && !m_document->page()->isVisible())
-        suspendAnimations();
+        if (auto* page = m_document->page()) {
+            if (page->settings().hiddenPageCSSAnimationSuspensionEnabled() && !page->isVisible())
+                suspendAnimations();
+        }
+    }
 }
 
 DocumentTimeline::~DocumentTimeline()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to