1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
7 <title>Test missing keyframes with fill modes
</title>
8 <style type=
"text/css" media=
"screen">
15 -webkit-animation-delay:
0.1s;
16 -webkit-animation-duration:
0.1s;
17 -webkit-animation-timing-function: linear;
19 @-webkit-keyframes anim1 {
24 @-webkit-keyframes anim2 {
28 @-webkit-keyframes anim3 {
32 @-webkit-keyframes anim4 {
37 background-color: blue;
38 -webkit-animation-fill-mode: none;
39 -webkit-animation-name: anim1;
42 background-color: red;
43 -webkit-animation-fill-mode: backwards;
44 -webkit-animation-name: anim1;
47 background-color: green;
48 -webkit-animation-fill-mode: forwards;
49 -webkit-animation-name: anim1;
52 background-color: yellow;
53 -webkit-animation-fill-mode: both;
54 -webkit-animation-name: anim1;
57 background-color: #
999;
58 -webkit-animation-fill-mode: both;
59 -webkit-animation-iteration-count:
2;
60 -webkit-animation-direction: alternate;
61 -webkit-animation-name: anim1;
65 background-color: blue;
66 -webkit-animation-fill-mode: none;
67 -webkit-animation-name: anim2;
70 background-color: red;
71 -webkit-animation-fill-mode: backwards;
72 -webkit-animation-name: anim2;
75 background-color: green;
76 -webkit-animation-fill-mode: forwards;
77 -webkit-animation-name: anim2;
80 background-color: yellow;
81 -webkit-animation-fill-mode: both;
82 -webkit-animation-name: anim2;
85 background-color: #
999;
86 -webkit-animation-fill-mode: both;
87 -webkit-animation-iteration-count:
2;
88 -webkit-animation-direction: alternate;
89 -webkit-animation-name: anim2;
93 <script type=
"text/javascript" charset=
"utf-8">
95 var animsFinished =
0;
97 const expectedValues = [
98 {id:
"a", start:
100, end:
100},
99 {id:
"b", start:
200, end:
100},
100 {id:
"c", start:
100, end:
300},
101 {id:
"d", start:
200, end:
300},
102 {id:
"e", start:
200, end:
200}
106 if (window.testRunner) {
107 testRunner.dumpAsText();
108 testRunner.waitUntilDone();
111 function animationEnded(event) {
112 if (++animsFinished == numAnims) {
113 setTimeout(endTest,
0); // this set timeout should be ok in the test environment
114 // since we're just giving style a chance to resolve
120 for (var i=
0; i < expectedValues.length; i++) {
121 var el = document.getElementById(expectedValues[i].id);
122 var expectedValue = expectedValues[i].end;
123 var realValue = parseFloat(window.getComputedStyle(el).left);
124 if (Math.abs(expectedValue - realValue) < allowance) {
129 result +=
" - end of animation - id: " + expectedValues[i].id +
" expected: " + expectedValue +
" actual: " + realValue +
"<br>";
131 document.getElementById('result').innerHTML = result;
133 if (window.testRunner)
134 testRunner.notifyDone();
137 window.onload = function () {
138 for (var i=
0; i < expectedValues.length; i++) {
139 var el = document.getElementById(expectedValues[i].id);
140 var expectedValue = expectedValues[i].start;
141 var realValue = parseFloat(window.getComputedStyle(el).left);
142 if (Math.abs(expectedValue - realValue) < allowance) {
147 result +=
" - start of animation - id: " + expectedValues[i].id +
" expected: " + expectedValue +
" actual: " + realValue +
"<br>";
149 document.addEventListener(
"webkitAnimationEnd", animationEnded, false);
155 This test performs an animation of the left property with four different
156 fill modes. It animates over
0.1 second with a
0.1 second delay.
157 It takes snapshots at document load and the end of the animation.
159 <div id=
"a" class=
"box">
160 None - from/to present
162 <div id=
"b" class=
"box">
163 Backwards - from/to present
165 <div id=
"c" class=
"box">
166 Forwards - from/to present
168 <div id=
"d" class=
"box">
169 Both - from/to present
171 <div id=
"e" class=
"box">
172 Both iterating - from/to present
175 <div id=
"f" class=
"box">
178 <div id=
"g" class=
"box">
179 Backwards - from missing
181 <div id=
"h" class=
"box">
182 Forwards - from missing
184 <div id=
"i" class=
"box">
187 <div id=
"j" class=
"box">
188 Both iterating - from missing