[composite-bgcolor-animation] Add more layout test for repaint
This CL adds more layout tests to ensure repaint. It includes:
1. A test that has implicit keyframe --> explicit keyframes.
2. A test from 1 delayed animation --> 2 running animations, and ensure
that the color is correct when the delayed animation is not started.
3. A test from 1 delayed animation --> 2 running animations, and ensure
that the color is correct when the delayed animation is started.
Bug: 1184832
Change-Id: Iced439bc3bda9822b19d9074b4af51c5b1286f7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2792168
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#867633}
diff --git a/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent-ref.html b/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent-ref.html
new file mode 100644
index 0000000..7a0046f
--- /dev/null
+++ b/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<body>
+ <canvas id="canvas" width="100" height="100"></canvas>
+</body>
+<script>
+ var canvas = document.getElementById('canvas');
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'rgb(0, 100, 100)';
+ ctx.fillRect(0, 0, 100, 100);
+</script>
diff --git a/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent.html b/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent.html
new file mode 100644
index 0000000..9140b70
--- /dev/null
+++ b/css/css-backgrounds/animations/background-color-animation-fallback-missing-0-percent.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
+<link rel="match" href="background-color-animation-fallback-missing-0-percent-ref.html">
+<style>
+.container {
+ /*TODO(crbug.com/1163949): Support animation keyframes without 0% or 100%.*/
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ /* Use a long animation that start at 50% progress where the slope of the
+ selected timing function is zero. By setting up the animation in this way,
+ we accommodate lengthy delays in running the test without a potential drift
+ in the animated property value. This is important for avoiding flakes,
+ especially on debug builds. The screenshots are taken as soon as the
+ animation is ready, thus the long animation duration has no bearing on
+ the actual duration of the test. */
+ animation: bgcolor 1000000s cubic-bezier(0,1,1,0) -500000s;
+}
+@keyframes bgcolor {
+ 20% { background-color: rgb(0, 200, 0); }
+ 80% { background-color: rgb(0, 0, 200); }
+ 100% { background-color: rgb(200, 0, 0); }
+}
+</style>
+<script src="/common/reftest-wait.js"></script>
+<body>
+<div class="container"></div>
+
+<script>
+document.getAnimations()[0].ready.then(() => {
+ takeScreenshot();
+});
+</script>
+</body>
+</html>
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length-ref.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length1-ref.html
similarity index 100%
rename from css/css-backgrounds/animations/two-background-color-animation-diff-length-ref.html
rename to css/css-backgrounds/animations/two-background-color-animation-diff-length1-ref.html
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length1.html
similarity index 98%
rename from css/css-backgrounds/animations/two-background-color-animation-diff-length.html
rename to css/css-backgrounds/animations/two-background-color-animation-diff-length1.html
index b484eec..b584ed8 100644
--- a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html
+++ b/css/css-backgrounds/animations/two-background-color-animation-diff-length1.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
-<link rel="match" href="two-background-color-animation-diff-length-ref.html">
+<link rel="match" href="two-background-color-animation-diff-length1-ref.html">
<style>
.container {
width: 100px;
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length-ref.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length2-ref.html
similarity index 100%
copy from css/css-backgrounds/animations/two-background-color-animation-diff-length-ref.html
copy to css/css-backgrounds/animations/two-background-color-animation-diff-length2-ref.html
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length2.html
similarity index 73%
copy from css/css-backgrounds/animations/two-background-color-animation-diff-length.html
copy to css/css-backgrounds/animations/two-background-color-animation-diff-length2.html
index b484eec..c6822de 100644
--- a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html
+++ b/css/css-backgrounds/animations/two-background-color-animation-diff-length2.html
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
-<link rel="match" href="two-background-color-animation-diff-length-ref.html">
+<link rel="match" href="two-background-color-animation-diff-length2-ref.html">
<style>
.container {
width: 100px;
height: 100px;
background-color: green;
- animation: bgcolor2 10s, bgcolor1 0.001s;
+ animation: bgcolor2 10s, bgcolor1 2s 1s;
}
@keyframes bgcolor1 {
0% { background-color: rgb(0, 200, 0); }
@@ -24,14 +24,12 @@
<div class="container"></div>
<script>
-// This test ensures that if we have two different-length animation, when the
-// one with higher compositing order finishes, the other one would still run
-// normally.
+// This test ensures that when there are two animations where one of them has
+// animation delays, we show the right color when the delayed animation is not
+// started yet.
const animations = document.getAnimations();
Promise.all([animations[0].ready, animations[1].ready]).then(() => {
- waitForAnimationFrames(3).then(() => {
- takeScreenshot();
- });
+ takeScreenshot();
});
</script>
</body>
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length3-ref.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length3-ref.html
new file mode 100644
index 0000000..66af34d
--- /dev/null
+++ b/css/css-backgrounds/animations/two-background-color-animation-diff-length3-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<body>
+ <canvas id="canvas" width="100" height="100"></canvas>
+</body>
+<script>
+ var canvas = document.getElementById('canvas');
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = 'rgb(0, 199, 0)';
+ ctx.fillRect(0, 0, 100, 100);
+</script>
diff --git a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html b/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html
similarity index 71%
copy from css/css-backgrounds/animations/two-background-color-animation-diff-length.html
copy to css/css-backgrounds/animations/two-background-color-animation-diff-length3.html
index b484eec..cfb0bf8 100644
--- a/css/css-backgrounds/animations/two-background-color-animation-diff-length.html
+++ b/css/css-backgrounds/animations/two-background-color-animation-diff-length3.html
@@ -1,17 +1,17 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
-<link rel="match" href="two-background-color-animation-diff-length-ref.html">
+<link rel="match" href="two-background-color-animation-diff-length3-ref.html">
<style>
.container {
width: 100px;
height: 100px;
background-color: green;
- animation: bgcolor2 10s, bgcolor1 0.001s;
+ animation: bgcolor2 10s, bgcolor1 2s 0.001s;
}
@keyframes bgcolor1 {
- 0% { background-color: rgb(0, 200, 0); }
- 100% { background-color: rgb(200, 0, 0); }
+ 0% { background-color: rgb(0, 199, 0); }
+ 100% { background-color: rgb(0, 200, 0); }
}
@keyframes bgcolor2 {
0% { background-color: rgb(0, 0, 199); }
@@ -24,9 +24,9 @@
<div class="container"></div>
<script>
-// This test ensures that if we have two different-length animation, when the
-// one with higher compositing order finishes, the other one would still run
-// normally.
+// This test ensures that when there are two animations where one of them has
+// animation delays, we show the right color when the delayed animation is
+// started.
const animations = document.getAnimations();
Promise.all([animations[0].ready, animations[1].ready]).then(() => {
waitForAnimationFrames(3).then(() => {