| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <html> | 3 <html> |
| 4 <head> | 4 <head> |
| 5 <style> | 5 <style> |
| 6 #container { | 6 #container { |
| 7 position: relative; | 7 position: relative; |
| 8 width: 400px; | 8 width: 400px; |
| 9 height: 100px; | 9 height: 100px; |
| 10 border: 1px solid black; | 10 border: 1px solid black; |
| 11 } | 11 } |
| 12 #box { | 12 #box { |
| 13 position: absolute; | 13 position: absolute; |
| 14 left: 0px; | 14 left: 0px; |
| 15 height: 100px; | 15 height: 100px; |
| 16 width: 100px; | 16 width: 100px; |
| 17 background-color: blue; | 17 background-color: blue; |
| 18 -webkit-transition-duration: 1s; | 18 -webkit-transition-duration: 1s; |
| 19 -webkit-transition-timing-function: linear; | 19 -webkit-transition-timing-function: linear; |
| 20 } | 20 } |
| 21 </style> | 21 </style> |
| 22 <script> | 22 <script> |
| 23 if (window.testRunner) { | 23 if (window.testRunner) { |
| 24 testRunner.dumpAsText(); | 24 testRunner.dumpAsText(); |
| 25 testRunner.waitUntilDone(); | 25 testRunner.waitUntilDone(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 var id; |
| 29 |
| 28 function startTransition() | 30 function startTransition() |
| 29 { | 31 { |
| 30 var box = document.getElementById('box'); | 32 var box = document.getElementById('box'); |
| 33 |
| 31 box.style.left = '300px'; | 34 box.style.left = '300px'; |
| 32 box.style.opacity = 0.5; | 35 box.offsetTop; // force transition start |
| 33 window.setTimeout(function() { | 36 |
| 34 box.style.left = '0px'; | 37 box.style.left = '0px' |
| 35 | 38 box.offsetTop; // force transition interruption |
| 36 window.setTimeout(function() { | 39 |
| 37 var boxPos = parseInt(window.getComputedStyle(box).left); | 40 // Force at least one timing update and recalc after the interruption. |
| 38 document.getElementById('result').innerHTML = (boxPos < 200) ? "PASS"
: "FAIL"; | 41 id = requestAnimationFrame(function() { |
| 39 if (window.testRunner) | 42 cancelAnimationFrame(id); |
| 40 testRunner.notifyDone(); | 43 var current = internals.numberOfActiveAnimations(); |
| 41 }, 250); | 44 document.getElementById('result').innerHTML = (current == 0) ? "PASS" :
"FAIL"; |
| 42 }, 500); | 45 if (window.testRunner) |
| 46 testRunner.notifyDone(); |
| 47 }); |
| 43 } | 48 } |
| 44 window.addEventListener('load', startTransition, false) | 49 window.addEventListener('load', startTransition, false) |
| 45 </script> | 50 </script> |
| 46 </head> | 51 </head> |
| 47 <body> | 52 <body> |
| 48 | 53 |
| 49 <p>Box should start moving left after left style is reset after 500ms</p> | 54 <p>Box should stay left as style is reset immediately</p> |
| 50 <div id="container"> | 55 <div id="container"> |
| 51 <div id="box"> | 56 <div id="box"> |
| 52 </div> | 57 </div> |
| 53 </div> | 58 </div> |
| 54 <div id="result"> | 59 <div id="result"> |
| 55 </div> | 60 </div> |
| 56 </body> | 61 </body> |
| 57 </html> | 62 </html> |
| OLD | NEW |