Title: [278566] trunk
Revision
278566
Author
[email protected]
Date
2021-06-07 12:44:02 -0700 (Mon, 07 Jun 2021)

Log Message

REGRESSION (r272201): iPad render flashing on load
https://bugs.webkit.org/show_bug.cgi?id=226216
<rdar://problem/78466306>

Reviewed by Simon Fraser.

Source/WebCore:

When we switched to wrapping all animations in animation groups for bug 219894, we neglected to update GraphicsLayerCA::moveOrCopyAnimations().
We now iterate over m_animationGroups which contain the animation groups that are current and in the order they were added, and also ensure
we preserve the original begin time for each group.

Test: webanimations/accelerated-animation-tiled-while-running.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation):
(WebCore::GraphicsLayerCA::moveOrCopyAnimations):
* platform/graphics/ca/GraphicsLayerCA.h:

LayoutTests:

Add a test that runs the same accelerated animation on two container elements, stack one above the other.
The bottom container has a red background while the top container has a green background, the whole body
being green. After the animation has started, we set the bottom element to have a very large size such
that its layer becomes tiled. Before this patch the bottom element would stop animation and its red
background would start appearing as the top element would keep animating. After this patch both elements
are animated and no red should appear.

* webanimations/accelerated-animation-tiled-while-running-expected.html: Added.
* webanimations/accelerated-animation-tiled-while-running.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278565 => 278566)


--- trunk/LayoutTests/ChangeLog	2021-06-07 18:53:54 UTC (rev 278565)
+++ trunk/LayoutTests/ChangeLog	2021-06-07 19:44:02 UTC (rev 278566)
@@ -1,3 +1,21 @@
+2021-06-07  Antoine Quint  <[email protected]>
+
+        REGRESSION (r272201): iPad render flashing on load
+        https://bugs.webkit.org/show_bug.cgi?id=226216
+        <rdar://problem/78466306>
+
+        Reviewed by Simon Fraser.
+
+        Add a test that runs the same accelerated animation on two container elements, stack one above the other.
+        The bottom container has a red background while the top container has a green background, the whole body
+        being green. After the animation has started, we set the bottom element to have a very large size such
+        that its layer becomes tiled. Before this patch the bottom element would stop animation and its red
+        background would start appearing as the top element would keep animating. After this patch both elements
+        are animated and no red should appear.
+
+        * webanimations/accelerated-animation-tiled-while-running-expected.html: Added.
+        * webanimations/accelerated-animation-tiled-while-running.html: Added.
+
 2021-06-07  Imanol Fernandez  <[email protected]>
 
         Use 3D points to map the WebXRBoundedReferenceSpace bounds transform

Added: trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running-expected.html (0 => 278566)


--- trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running-expected.html	2021-06-07 19:44:02 UTC (rev 278566)
@@ -0,0 +1 @@
+<style> body { background-color: green } </style>

Added: trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running.html (0 => 278566)


--- trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-tiled-while-running.html	2021-06-07 19:44:02 UTC (rev 278566)
@@ -0,0 +1,67 @@
+<style>
+
+body, div {
+    background-color: green;
+    overflow: hidden;
+}
+
+div {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100px;
+    height: 100px;
+}
+
+.parent {
+    animation: 5s slide;
+}
+
+.cover, .cover > div {
+    left: -1px;
+    width: 102px;
+}
+
+.actual > div {
+    background-color: red;
+}
+
+.tiled {
+    width: 5000px;
+    height: 5000px;
+}
+
+@keyframes slide {
+    from { transform: translateX(0px) }
+    to { transform: translateX(100px) }
+}
+
+</style>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+window._onload_ = async function() {
+    const element = document.body.querySelectorAll(".parent")[0];
+    const animation = element.getAnimations()[0];
+
+    await animation.ready;
+
+    await new Promise(resolve => requestAnimationFrame(resolve));
+    await new Promise(resolve => requestAnimationFrame(resolve));
+
+    // Force tiling in the middle of the animation.
+    element.classList.add("tiled");
+
+    await new Promise(resolve => requestAnimationFrame(resolve));
+    await new Promise(resolve => requestAnimationFrame(resolve));
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+
+<div class="parent actual"><div class="child"></div></div>
+<div class="parent cover"><div class="child"></div></div>

Modified: trunk/Source/WebCore/ChangeLog (278565 => 278566)


--- trunk/Source/WebCore/ChangeLog	2021-06-07 18:53:54 UTC (rev 278565)
+++ trunk/Source/WebCore/ChangeLog	2021-06-07 19:44:02 UTC (rev 278566)
@@ -1,3 +1,22 @@
+2021-06-07  Antoine Quint  <[email protected]>
+
+        REGRESSION (r272201): iPad render flashing on load
+        https://bugs.webkit.org/show_bug.cgi?id=226216
+        <rdar://problem/78466306>
+
+        Reviewed by Simon Fraser.
+
+        When we switched to wrapping all animations in animation groups for bug 219894, we neglected to update GraphicsLayerCA::moveOrCopyAnimations().
+        We now iterate over m_animationGroups which contain the animation groups that are current and in the order they were added, and also ensure
+        we preserve the original begin time for each group.
+
+        Test: webanimations/accelerated-animation-tiled-while-running.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation):
+        (WebCore::GraphicsLayerCA::moveOrCopyAnimations):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+
 2021-06-07  Devin Rousso  <[email protected]>
 
         Convert WebCore::SnapshotOptions into an enum class

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (278565 => 278566)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-06-07 18:53:54 UTC (rev 278565)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-06-07 19:44:02 UTC (rev 278566)
@@ -684,12 +684,15 @@
     noteLayerPropertyChanged(ChildrenTransformChanged);
 }
 
-void GraphicsLayerCA::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer)
+void GraphicsLayerCA::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, std::optional<Seconds> beginTime, PlatformCALayer *fromLayer, PlatformCALayer *toLayer)
 {
     RefPtr<PlatformCAAnimation> anim = fromLayer->animationForKey(animationIdentifier);
     if (!anim)
         return;
 
+    if (beginTime && beginTime->seconds() != anim->beginTime())
+        anim->setBeginTime(beginTime->seconds());
+
     switch (operation) {
     case Move:
         fromLayer->removeAnimationForKey(animationIdentifier);
@@ -704,13 +707,12 @@
 
 void GraphicsLayerCA::moveOrCopyAnimations(MoveOrCopy operation, PlatformCALayer *fromLayer, PlatformCALayer *toLayer)
 {
-    for (auto& animation : m_animations) {
-        if ((animatedPropertyIsTransformOrRelated(animation.m_property)
-            || animation.m_property == AnimatedPropertyOpacity
-            || animation.m_property == AnimatedPropertyBackgroundColor
-            || animation.m_property == AnimatedPropertyFilter)
-            && (animation.m_playState == PlayState::Playing || animation.m_playState == PlayState::Paused))
-            moveOrCopyLayerAnimation(operation, animation.animationIdentifier(), fromLayer, toLayer);
+    for (auto& animationGroup : m_animationGroups) {
+        if ((animatedPropertyIsTransformOrRelated(animationGroup.m_property)
+            || animationGroup.m_property == AnimatedPropertyOpacity
+            || animationGroup.m_property == AnimatedPropertyBackgroundColor
+            || animationGroup.m_property == AnimatedPropertyFilter))
+            moveOrCopyLayerAnimation(operation, animationGroup.animationIdentifier(), animationGroup.computedBeginTime(), fromLayer, toLayer);
     }
 }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (278565 => 278566)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-06-07 18:53:54 UTC (rev 278565)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-06-07 19:44:02 UTC (rev 278566)
@@ -511,7 +511,7 @@
     static void dumpAnimations(WTF::TextStream&, const char* category, const Vector<LayerPropertyAnimation>&);
 
     enum MoveOrCopy { Move, Copy };
-    static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
+    static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, std::optional<Seconds> beginTime, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
     void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer* fromLayer, PlatformCALayer* toLayer);
 
     void moveAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to