Skip to content

Commit e976909

Browse files
David Awogbemilachromium-wpt-export-bot
authored andcommitted
[animation-trigger] Ensure triggered CSS animations are exposed
Normally, we pause a triggered CSS animation at the time of attaching the trigger. However, this means we will leave as idle a CSS animation whose trigger name we didn't find. This results in the animation being idle and not showing up in getAnimations. We should: - make them show up in getAnimations by pausing in anticipation of finding the trigger (which may show up later), and - spec this behavior. This CL also addresses the fact that pause() likely should not change the paused_for_trigger state of the animation. Bug: 390314945, 465915372 Change-Id: I381ea0cc42772a1e4afb5e13d27631982c8be97d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7228342 Reviewed-by: Kevin Ellis <[email protected]> Reviewed-by: David Awogbemila <[email protected]> Commit-Queue: David Awogbemila <[email protected]> Cr-Commit-Position: refs/heads/main@{#1554739}
1 parent e962f1a commit e976909

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

scroll-animations/animation-trigger/animation-trigger-untriggered-animations-exposed.tentative.html

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
transform: translateX(-50px);
2121
}
2222
}
23-
.target {
23+
#subject {
2424
height: 100px;
25-
width: 100%;
26-
background-color: blue;
27-
animation: slide-in 3s;
25+
width: 100px;
26+
background-color: purple;
2827
timeline-trigger: --trigger view() contain 0% contain 100%;
29-
animation-trigger: --trigger;
3028
}
3129
.target {
3230
height: 100px;
3331
width: 100%;
3432
background-color: blue;
33+
animation: slide-in 3s;
34+
color: white;
3535
}
3636
.space {
3737
height: 250px;
@@ -45,20 +45,28 @@
4545
animation-fill-mode: none;
4646
}
4747

48+
.valid {
49+
animation-trigger: --trigger play-once;
50+
}
51+
.invalid {
52+
animation-trigger: --nonexistent-trigger play-once;
53+
}
54+
4855
</style>
4956
<div id="scroller" class="scroller">
5057
<div class="space"></div>
5158
<div id="subject"></div>
5259
<div class="space"></div>
53-
<div id="active_target" class="active target"></div>
54-
<div id="idle_target" class="idle target"></div>
60+
<div id="active_target" class="active valid target">Active</div>
61+
<div id="idle_target" class="idle valid target">Idle</div>
62+
<div id="invalid_target" class="invalid target">Invalid</div>
5563
</div>
5664
<script>
5765
promise_test(async () => {
58-
assert_equals(idle_target.getAnimations().length, 1,
59-
"idle target has an animation");
60-
assert_equals(active_target.getAnimations().length, 1,
61-
"active target has an animation");
66+
for (const target of document.querySelectorAll(".target")) {
67+
assert_equals(target.getAnimations().length, 1,
68+
`animation on ${target.id} is exposed`);
69+
}
6270
}, "getAnimations includes an untriggered " +
6371
"'fill-mode: none' and 'fill-mode: both' animations.");
6472
</script>

0 commit comments

Comments
 (0)