Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[scroll-animations]: update isCurrent calculation
Bug: 1356542 Change-Id: I31263f33a15fb3b98217aee84c0768403bd0eba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4054060 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1078224}
- Loading branch information
1 parent
076bcd7
commit 0804c5c
Showing
11 changed files
with
114 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
.../blink/web_tests/external/wpt/scroll-animations/css/get-animations-inactive-timeline.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<title>getAnimations for scroll-linked animations</title> | ||
<link rel="help" | ||
href="https://www.w3.org/TR/web-animations-1/#animation-effect-phases-and-states"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@keyframes slide { | ||
from { transform: translateX(100px); } | ||
to { transform: translateX(100px); } | ||
} | ||
|
||
#container { | ||
border: 10px solid lightgray; | ||
overflow-x: scroll; | ||
height: 200px; | ||
width: 200px; | ||
scroll-timeline-name: timeline; | ||
} | ||
#spacer { | ||
height: 200vh; | ||
} | ||
#target { | ||
background-color: green; | ||
height: 100px; | ||
width: 100px; | ||
animation: slide 1s linear timeline; | ||
} | ||
</style> | ||
<body> | ||
<div id="container"> | ||
<div id="spacer"></div> | ||
<div id="target"></div> | ||
</div> | ||
</body> | ||
<script type="text/javascript"> | ||
promise_test(async t => { | ||
// Newly created timeline is inactive, | ||
let animations = document.getAnimations(); | ||
assert_equals(animations.length, 1, | ||
'Single running animation'); | ||
assert_true(animations[0].timeline instanceof ScrollTimeline, | ||
'Animation associated with a scroll timeline'); | ||
assert_equals(animations[0].timeline.currentTime, null, | ||
'Timeline is initially inactive'); | ||
|
||
// Canceled animation is no longer current. | ||
const anim = animations[0]; | ||
animations[0].cancel(); | ||
|
||
assert_equals( | ||
document.getAnimations().length, 0, | ||
'A canceled animation is no longer returned by getAnimations'); | ||
|
||
// Replaying an animation makes it current. | ||
anim.play(); | ||
assert_equals( | ||
document.getAnimations().length, 1, | ||
'A play-pending animation is return by getAnimations'); | ||
|
||
// Animation effect is still current even if the timeline's source element | ||
// cannot be scrolled. | ||
spacer.style = 'display: none'; | ||
t.add_cleanup(() => { | ||
spacer.style = ''; | ||
}); | ||
|
||
animations = document.getAnimations(); | ||
assert_equals( | ||
animations.length, 1, | ||
'Running animation is included in getAnimations list even if ' + | ||
'currentTime is null'); | ||
assert_true(animations[0].timeline instanceof ScrollTimeline, | ||
'Animation has timeline associated with an element that ' + | ||
'cannot be scrolled'); | ||
assert_equals(animations[0].timeline.currentTime, null, | ||
'Inactive timeline when timeline\'s source element cannot ' + | ||
'be scrolled'); | ||
}, 'getAnimations includes inactive scroll-linked animations that have not ' + | ||
'been canceled'); | ||
</script> |