| OLD | NEW |
| 1 /* | 1 /* |
| 2 Distributed under both the W3C Test Suite License [1] and the W3C | 2 Distributed under both the W3C Test Suite License [1] and the W3C |
| 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 4 policies and contribution forms [3]. | 4 policies and contribution forms [3]. |
| 5 | 5 |
| 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 8 [3] http://www.w3.org/2004/10/27-testcases | 8 [3] http://www.w3.org/2004/10/27-testcases |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 function handleFrame() { | 151 function handleFrame() { |
| 152 if (--frameCount <= 0) { | 152 if (--frameCount <= 0) { |
| 153 resolve(); | 153 resolve(); |
| 154 } else { | 154 } else { |
| 155 window.requestAnimationFrame(handleFrame); // wait another frame | 155 window.requestAnimationFrame(handleFrame); // wait another frame |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 window.requestAnimationFrame(handleFrame); | 158 window.requestAnimationFrame(handleFrame); |
| 159 }); | 159 }); |
| 160 } | 160 } |
| 161 | |
| 162 // Continually calls requestAnimationFrame until |minDelay| has elapsed | |
| 163 // as recorded using document.timeline.currentTime (i.e. frame time not | |
| 164 // wall-clock time). | |
| 165 function waitForAnimationFramesWithDelay(minDelay) { | |
| 166 var startTime = document.timeline.currentTime; | |
| 167 return new Promise(function(resolve) { | |
| 168 (function handleFrame() { | |
| 169 if (document.timeline.currentTime - startTime >= minDelay) { | |
| 170 resolve(); | |
| 171 } else { | |
| 172 window.requestAnimationFrame(handleFrame); | |
| 173 } | |
| 174 }()); | |
| 175 }); | |
| 176 } | |
| OLD | NEW |