Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | |
| 3 <title>Model liveness: currentTime will not change in a task (frames)</title | |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#model-liveness"> | |
| 2 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
| 4 | 7 |
| 5 <iframe id=frame></iframe> | 8 <iframe id=frame></iframe> |
| 6 | 9 |
| 7 <script> | 10 <script> |
| 8 var handle = async_test('Animation time should tick consistently across frames') ; | 11 var handle = async_test('Document timeline should tick consistently across frame s'); |
| 9 var baseTime = document.timeline.currentTime; | 12 var baseTime = document.timeline.currentTime; |
| 10 var frameBaseTime = frame.contentDocument.timeline.currentTime; | 13 var frameBaseTime = frame.contentDocument.timeline.currentTime; |
| 11 setTimeout(function() { | 14 setTimeout(() => { |
| 15 // Ensure that time in this task has advanced sufficiently for implementations | |
| 16 // that might bind the currentTime lazily. | |
| 12 var start = performance.now(); | 17 var start = performance.now(); |
| 13 while (performance.now() - start < 30); | 18 while (performance.now() - start < 30); |
| 14 var delta = document.timeline.currentTime - baseTime; | 19 var delta = document.timeline.currentTime - baseTime; |
| 15 | 20 |
| 21 // Advance time further before querying the frame's time. | |
| 16 var start = performance.now(); | 22 var start = performance.now(); |
| 17 while (performance.now() - start < 30); | 23 while (performance.now() - start < 30); |
|
alancutter (OOO until 2018)
2016/07/12 04:23:27
Can we use requestAnimationFrame instead of setTim
| |
| 18 var frameDelta = frame.contentDocument.timeline.currentTime - frameBaseTime; | 24 var frameDelta = frame.contentDocument.timeline.currentTime - frameBaseTime; |
| 19 | 25 |
| 20 handle.step(() => assert_equals(Math.round(delta), Math.round(frameDelta))); | 26 handle.step(() => assert_times_equals(delta, frameDelta); |
|
suzyh_UTC10 (ex-contributor)
2016/07/13 22:45:25
Missed this the first time around. The function is
| |
| 21 handle.done(); | 27 handle.done(); |
| 22 }); | 28 }); |
| 23 </script> | 29 </script> |
| OLD | NEW |