Title: [288881] trunk
- Revision
- 288881
- Author
- [email protected]
- Date
- 2022-02-01 08:51:44 -0800 (Tue, 01 Feb 2022)
Log Message
Animation from scale(0) has missing backing store
https://bugs.webkit.org/show_bug.cgi?id=227733
<rdar://problem/80246192>
Reviewed by Simon Fraser.
Source/WebCore:
Use the style recorded before we applied animations to this element the last
time we resolved style for keyframes that don't set a value for the "transform"
property.
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
LayoutTests:
Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
animating to scale(1) as well, and is white, matching the background color.
The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
value.
This test assumes that both animations run at the same time and thus the white square will always cover
the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.
* webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
* webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (288880 => 288881)
--- trunk/LayoutTests/ChangeLog 2022-02-01 16:49:53 UTC (rev 288880)
+++ trunk/LayoutTests/ChangeLog 2022-02-01 16:51:44 UTC (rev 288881)
@@ -1,3 +1,26 @@
+2022-02-01 Antoine Quint <[email protected]>
+
+ Animation from scale(0) has missing backing store
+ https://bugs.webkit.org/show_bug.cgi?id=227733
+ <rdar://problem/80246192>
+
+ Reviewed by Simon Fraser.
+
+ Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
+ that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
+ square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
+ animating to scale(1) as well, and is white, matching the background color.
+
+ The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
+ since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
+ value.
+
+ This test assumes that both animations run at the same time and thus the white square will always cover
+ the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.
+
+ * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
+ * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.
+
2022-02-01 Youenn Fablet <[email protected]>
[BigSur+ wk2 Debug] webrtc/video-mute-vp8.html is a flaky failure
Added: trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html (0 => 288881)
--- trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html 2022-02-01 16:51:44 UTC (rev 288881)
@@ -0,0 +1,14 @@
+<style>
+
+div {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100px;
+ height: 100px;
+ background: white;
+ will-change: transform;
+}
+
+</style>
+<div></div>
\ No newline at end of file
Added: trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html (0 => 288881)
--- trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html 2022-02-01 16:51:44 UTC (rev 288881)
@@ -0,0 +1,52 @@
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+
+@keyframes explicit {
+ from { transform: scale(0) }
+ to { transform: scale(1) }
+}
+
+@keyframes implicit {
+ from { transform: scale(0) }
+}
+
+div {
+ position: absolute;
+ top: 0;
+ left: 0;
+ transform-origin: top left;
+ animation-duration: 1s;
+ animation-timing-function: cubic-bezier(0, 1, 0, 1);
+}
+
+div.explicit {
+ width: 50px;
+ height: 50px;
+ background: black;
+ animation-name: explicit;
+}
+
+div.implicit {
+ width: 100px;
+ height: 100px;
+ background: linear-gradient(white, white);
+ animation-name: implicit;
+}
+
+</style>
+<div class="explicit"></div>
+<div class="implicit"></div>
+
+<script>
+
+(async function () {
+ window.testRunner?.waitUntilDone();
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ window.testRunner?.notifyDone();
+})();
+
+</script>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (288880 => 288881)
--- trunk/Source/WebCore/ChangeLog 2022-02-01 16:49:53 UTC (rev 288880)
+++ trunk/Source/WebCore/ChangeLog 2022-02-01 16:51:44 UTC (rev 288881)
@@ -1,3 +1,18 @@
+2022-02-01 Antoine Quint <[email protected]>
+
+ Animation from scale(0) has missing backing store
+ https://bugs.webkit.org/show_bug.cgi?id=227733
+ <rdar://problem/80246192>
+
+ Reviewed by Simon Fraser.
+
+ Use the style recorded before we applied animations to this element the last
+ time we resolved style for keyframes that don't set a value for the "transform"
+ property.
+
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+
2022-02-01 Oriol Brufau <[email protected]>
[css-cascade] Fix removal of not yet loaded CSS @import
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (288880 => 288881)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-02-01 16:49:53 UTC (rev 288880)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-02-01 16:51:44 UTC (rev 288881)
@@ -1928,6 +1928,14 @@
LayoutRect cumulativeBounds;
+ auto* implicitStyle = [&]() {
+ if (auto target = targetStyleable()) {
+ if (auto* lastStyleChangeEventStyle = target->lastStyleChangeEventStyle())
+ return lastStyleChangeEventStyle;
+ }
+ return &box.style();
+ }();
+
auto addStyleToCumulativeBounds = [&](const RenderStyle* style) -> bool {
auto keyframeBounds = bounds;
@@ -1951,7 +1959,7 @@
if (!keyframe.containsProperty(CSSPropertyTransform)) {
// If the first keyframe is missing transform style, use the current style.
if (!keyframe.key())
- keyframeStyle = &box.style();
+ keyframeStyle = implicitStyle;
else
continue;
}
@@ -1961,7 +1969,7 @@
}
if (m_blendingKeyframes.hasImplicitKeyframes()) {
- if (!addStyleToCumulativeBounds(&box.style()))
+ if (!addStyleToCumulativeBounds(implicitStyle))
return false;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes