Title: [278610] trunk
Revision
278610
Author
grao...@webkit.org
Date
2021-06-08 09:27:50 -0700 (Tue, 08 Jun 2021)

Log Message

REGRESSION (r256095): Adding a border-radius, border, or box-shadow breaks animations from scale(0)
https://bugs.webkit.org/show_bug.cgi?id=218371
<rdar://problem/70906316>

Reviewed by Simon Fraser.

Source/WebCore:

When computing an animation's transform extent, we must account for implicit keyframes.

Test: webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):

LayoutTests:

Add a test where we have an animation on an element with a a border and a transform animation to scale(0) where the
first keyframe is implicit. This test would fail prior to this patch.

* webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe-expected.html: Added.
* webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278609 => 278610)


--- trunk/LayoutTests/ChangeLog	2021-06-08 16:14:14 UTC (rev 278609)
+++ trunk/LayoutTests/ChangeLog	2021-06-08 16:27:50 UTC (rev 278610)
@@ -1,3 +1,17 @@
+2021-06-08  Antoine Quint  <grao...@webkit.org>
+
+        REGRESSION (r256095): Adding a border-radius, border, or box-shadow breaks animations from scale(0)
+        https://bugs.webkit.org/show_bug.cgi?id=218371
+        <rdar://problem/70906316>
+
+        Reviewed by Simon Fraser.
+
+        Add a test where we have an animation on an element with a a border and a transform animation to scale(0) where the
+        first keyframe is implicit. This test would fail prior to this patch.
+
+        * webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe-expected.html: Added.
+        * webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html: Added.
+
 2021-06-08  Youenn Fablet  <you...@apple.com>
 
         Update libwebrtc to M92

Added: trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe-expected.html (0 => 278610)


--- trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe-expected.html	2021-06-08 16:27:50 UTC (rev 278610)
@@ -0,0 +1,12 @@
+<style>
+
+div {
+  width: 100px;
+  height: 100px;
+  margin-bottom: 2rem;
+  border: 10px solid green;
+  background-color: green;
+}
+
+</style>
+<div></div>
\ No newline at end of file

Added: trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html (0 => 278610)


--- trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html	2021-06-08 16:27:50 UTC (rev 278610)
@@ -0,0 +1,18 @@
+<body>
+<style>
+
+div {
+  width: 100px;
+  height: 100px;
+  margin-bottom: 2rem;
+  border: 10px solid green;
+  background-color: green;
+}
+
+</style>
+<script>
+
+document.body.appendChild(document.createElement("div")).animate({ transform: "scale(0)" }, 1000 * 60 * 60 * 24);
+
+</script>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (278609 => 278610)


--- trunk/Source/WebCore/ChangeLog	2021-06-08 16:14:14 UTC (rev 278609)
+++ trunk/Source/WebCore/ChangeLog	2021-06-08 16:27:50 UTC (rev 278610)
@@ -1,3 +1,18 @@
+2021-06-08  Antoine Quint  <grao...@webkit.org>
+
+        REGRESSION (r256095): Adding a border-radius, border, or box-shadow breaks animations from scale(0)
+        https://bugs.webkit.org/show_bug.cgi?id=218371
+        <rdar://problem/70906316>
+
+        Reviewed by Simon Fraser.
+
+        When computing an animation's transform extent, we must account for implicit keyframes.
+
+        Test: webanimations/accelerated-transform-animation-to-scale-zero-with-implicit-from-keyframe.html
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+
 2021-06-08  Youenn Fablet  <you...@apple.com> and Victor M. Jaquez L. <vjaq...@igalia.com>
 
         Update libwebrtc to M92

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (278609 => 278610)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2021-06-08 16:14:14 UTC (rev 278609)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2021-06-08 16:27:50 UTC (rev 278610)
@@ -1895,6 +1895,22 @@
 
     LayoutRect cumulativeBounds;
 
+    auto addStyleToCumulativeBounds = [&](const RenderStyle* style) -> bool {
+        auto keyframeBounds = bounds;
+
+        bool canCompute;
+        if (transformFunctionListsMatch())
+            canCompute = computeTransformedExtentViaTransformList(rendererBox, *style, keyframeBounds);
+        else
+            canCompute = computeTransformedExtentViaMatrix(rendererBox, *style, keyframeBounds);
+
+        if (!canCompute)
+            return false;
+
+        cumulativeBounds.unite(keyframeBounds);
+        return true;
+    };
+
     for (const auto& keyframe : m_blendingKeyframes.keyframes()) {
         const auto* keyframeStyle = keyframe.style();
 
@@ -1907,18 +1923,13 @@
                 continue;
         }
 
-        auto keyframeBounds = bounds;
+        if (!addStyleToCumulativeBounds(keyframeStyle))
+            return false;
+    }
 
-        bool canCompute;
-        if (transformFunctionListsMatch())
-            canCompute = computeTransformedExtentViaTransformList(rendererBox, *keyframeStyle, keyframeBounds);
-        else
-            canCompute = computeTransformedExtentViaMatrix(rendererBox, *keyframeStyle, keyframeBounds);
-
-        if (!canCompute)
+    if (m_blendingKeyframes.hasImplicitKeyframes()) {
+        if (!addStyleToCumulativeBounds(&box.style()))
             return false;
-
-        cumulativeBounds.unite(keyframeBounds);
     }
 
     bounds = cumulativeBounds;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to