| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <html> | 3 <html> |
| 4 <head> | 4 <head> |
| 5 <style type="text/css"> | 5 <style type="text/css"> |
| 6 .box { | 6 .box { |
| 7 position: relative; | 7 position: relative; |
| 8 height: 25px; | 8 height: 25px; |
| 9 width: 25px; | 9 width: 25px; |
| 10 background-color: blue; | 10 background-color: blue; |
| 11 margin: 10px; | 11 margin: 10px; |
| 12 } | 12 } |
| 13 .animation { | 13 .animation { |
| 14 -webkit-animation-duration: 0.1s; | 14 animation-duration: 0.1s; |
| 15 -webkit-animation-name: animation; | 15 animation-name: animation; |
| 16 } | 16 } |
| 17 #animation1 { | 17 #animation1 { |
| 18 -webkit-animation-delay: 0.05s; | 18 animation-delay: 0.05s; |
| 19 } | 19 } |
| 20 #animation2 { | 20 #animation2 { |
| 21 -webkit-animation-delay: -0.05s; | 21 animation-delay: -0.05s; |
| 22 } | 22 } |
| 23 #animation3 { | 23 #animation3 { |
| 24 -webkit-animation-delay: -0.15s; | 24 animation-delay: -0.15s; |
| 25 } | 25 } |
| 26 @-webkit-keyframes animation { | 26 @keyframes animation { |
| 27 from { left: 0; } | 27 from { left: 0; } |
| 28 to { left: 500px; } | 28 to { left: 500px; } |
| 29 } | 29 } |
| 30 </style> | 30 </style> |
| 31 <script type="text/javascript"> | 31 <script type="text/javascript"> |
| 32 if (window.testRunner) { | 32 if (window.testRunner) { |
| 33 testRunner.dumpAsText(); | 33 testRunner.dumpAsText(); |
| 34 testRunner.waitUntilDone(); | 34 testRunner.waitUntilDone(); |
| 35 } | 35 } |
| 36 function log(text) { | 36 function log(text) { |
| 37 var div = document.createElement('div'); | 37 var div = document.createElement('div'); |
| 38 div.innerText = text; | 38 div.innerText = text; |
| 39 document.getElementById('log').appendChild(div); | 39 document.getElementById('log').appendChild(div); |
| 40 } | 40 } |
| 41 | 41 |
| 42 var count = 0; | 42 var count = 0; |
| 43 document.addEventListener('webkitAnimationStart', function(event) { | 43 document.addEventListener('animationstart', function(event) { |
| 44 var pass = event.elapsedTime === [0, 0.05, 0.15][count++]; | 44 var pass = event.elapsedTime === [0, 0.05, 0.15][count++]; |
| 45 log((pass ? 'PASS' : 'FAIL') + ': ' + event.target.id + ': Start event:
elapsedTime=' + event.elapsedTime); | 45 log((pass ? 'PASS' : 'FAIL') + ': ' + event.target.id + ': Start event:
elapsedTime=' + event.elapsedTime); |
| 46 }, false); | 46 }, false); |
| 47 | 47 |
| 48 document.addEventListener('webkitAnimationEnd', function(event) { | 48 document.addEventListener('animationend', function(event) { |
| 49 var pass = event.elapsedTime === 0.1; | 49 var pass = event.elapsedTime === 0.1; |
| 50 log((pass ? 'PASS' : 'FAIL') + ': ' + event.target.id + ': End event: el
apsedTime=' + event.elapsedTime); | 50 log((pass ? 'PASS' : 'FAIL') + ': ' + event.target.id + ': End event: el
apsedTime=' + event.elapsedTime); |
| 51 switch (count) { | 51 switch (count) { |
| 52 case 1: | 52 case 1: |
| 53 document.getElementById('animation2').classList.add('animation'); | 53 document.getElementById('animation2').classList.add('animation'); |
| 54 break; | 54 break; |
| 55 case 2: | 55 case 2: |
| 56 document.getElementById('animation3').classList.add('animation'); | 56 document.getElementById('animation3').classList.add('animation'); |
| 57 break; | 57 break; |
| 58 case 3: | 58 case 3: |
| 59 if (window.testRunner) | 59 if (window.testRunner) |
| 60 testRunner.notifyDone(); | 60 testRunner.notifyDone(); |
| 61 } | 61 } |
| 62 }, false); | 62 }, false); |
| 63 </script> | 63 </script> |
| 64 </head> | 64 </head> |
| 65 <body> | 65 <body> |
| 66 <p>Tests animation events with a negative delay. | 66 <p>Tests animation events with a negative delay. |
| 67 <div id="animation1" class="box animation"></div> | 67 <div id="animation1" class="box animation"></div> |
| 68 <div id="animation2" class="box"></div> | 68 <div id="animation2" class="box"></div> |
| 69 <div id="animation3" class="box"></div> | 69 <div id="animation3" class="box"></div> |
| 70 <div id="log"></div> | 70 <div id="log"></div> |
| 71 </body> | 71 </body> |
| 72 </html> | 72 </html> |
| OLD | NEW |