forked from WebKit/WebKit-http
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccelerated-animation-interruption-display-none.html
57 lines (48 loc) · 1.67 KB
/
accelerated-animation-interruption-display-none.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<style>
#target {
width: 100px;
height: 100px;
background-color: black;
animation: foo linear 10s;
}
@keyframes foo {
from { transform: "translateX(100px)" };
to { transform: "none" };
}
</style>
</head>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<div id="target"></div>
<script>
function waitNFrames(numberOfFrames, continuation)
{
let elapsedFrames = 0;
(function rAFCallback() {
if (elapsedFrames++ >= numberOfFrames)
continuation();
else
requestAnimationFrame(rAFCallback);
})();
}
async_test(t => {
const initialNumberOfTimelineInvalidations = internals.numberOfAnimationTimelineInvalidations();
waitNFrames(3, () => {
assert_greater_than(internals.numberOfAnimationTimelineInvalidations(), initialNumberOfTimelineInvalidations, "There should be updates made to the timeline as an animation is set up.");
document.getElementById("target").style.display = "none";
waitNFrames(2, () => {
const numberOfTimelineInvalidationsAfterInterruption = internals.numberOfAnimationTimelineInvalidations();
requestAnimationFrame(() => {
assert_equals(internals.numberOfAnimationTimelineInvalidations(), numberOfTimelineInvalidationsAfterInterruption, "There should not be any updates made to the timeline after interrupting the single running animation.");
t.done();
});
});
});
}, "Interrupting an animation by setting 'display: none' should stop invalidating the animation timeline.");
</script>
</body>
</html>