4 <style type=
"text/css">
13 -webkit-animation: test
10ms linear forwards
;
14 -webkit-animation-play-state: paused
;
15 animation: test
10ms linear forwards
;
16 animation-play-state: paused
;
19 -webkit-animation-play-state: running
;
20 animation-play-state: running
;
23 -webkit-animation-delay: -10ms;
24 animation-delay: -10ms;
27 -webkit-animation-delay: 0ms;
31 -webkit-animation-delay: 10ms;
32 animation-delay: 10ms;
34 @
-webkit-keyframes test
{
43 <script type=
"text/javascript">
44 if (window
.testRunner
) {
45 testRunner
.dumpAsText();
46 testRunner
.waitUntilDone();
49 function log(message
) {
50 var div
= document
.createElement('div');
51 div
.textContent
= message
;
52 document
.body
.appendChild(div
);
55 function startNextAnimation(currentId
) {
56 // Running animations serially avoids flakiness due to overlap.
57 if (currentId
=== 'animation1') {
58 start(document
.getElementById('animation2'), true);
59 } else if (currentId
=== 'animation2') {
60 start(document
.getElementById('animation3'), false);
61 } else if (currentId
=== 'animation3' && window
.testRunner
) {
62 testRunner
.notifyDone();
66 function onStartEventFired(expectStartEventFirst
, e
) {
68 if (expectStartEventFirst
) {
69 log('PASS: ' + id
+ ': Start event fired without setting play state to running');
71 log((isRunning
? 'PASS' : 'FAIL') + ': ' + id
+ ': Start event fired ' + (isRunning
? 'after' : 'before') + ' play state was set to running');
73 startNextAnimation(id
);
77 function run(element
) {
78 element
.classList
.add('running');
82 function start(target
, expectImmediateStartEvent
) {
84 var startEventHandler
= onStartEventFired
.bind(null, expectImmediateStartEvent
);
85 target
.addEventListener('webkitAnimationStart', startEventHandler
);
86 target
.addEventListener('animationstart', startEventHandler
);
87 target
.classList
.add('animated');
88 if (!expectImmediateStartEvent
) {
89 setTimeout(run
.bind(null, target
), 100);
94 start(document
.getElementById('animation1'), true);
99 <p>Tests that an animation which is initially paused fires its start event as soon as its delay expires, not when it transitions to the running state.
</p>
100 <div class=
"target" id=
"animation1"></div>
101 <div class=
"target" id=
"animation2"></div>
102 <div class=
"target" id=
"animation3"></div>
103 <div id=
"result"></div>