 Chromium Code Reviews
 Chromium Code Reviews Issue 1120963003:
  Implements getImageAnimationPolicy() at ImageLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1120963003:
  Implements getImageAnimationPolicy() at ImageLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <script> | |
| 2 var updated = false; | |
| 3 var prevTime; | |
| 4 if (window.internals) | |
| 5 internals.settings.setImageAnimationPolicy("none"); | |
| 6 | |
| 7 if (window.testRunner) | |
| 8 testRunner.waitUntilDone(); | |
| 9 | |
| 10 function changeImage() { | |
| 11 document.getElementById("target").src = "animation-green.gif"; | |
| 12 updated = true; | |
| 13 } | |
| 14 | |
| 15 function timestamp() { | |
| 16 // Finish Test after 100ms after image is loaded | |
| 17 // to make sure that animation is not looped | |
| 18 // because animation policy is none. | |
| 19 if (Date.now() - prevTime > 100) { | |
| 
esprehn
2015/05/26 23:29:16
This is still a 100ms delay, you wan't put a 100ms
 | |
| 20 if (window.testRunner) | |
| 21 testRunner.notifyDone(); | |
| 22 } | |
| 23 window.requestAnimationFrame(timestamp); | |
| 24 } | |
| 25 | |
| 26 function imageLoaded() { | |
| 27 if (!updated) | |
| 28 return; | |
| 29 | |
| 30 if (window.testRunner) { | |
| 31 testRunner.layoutAndPaintAsyncThen(function () { | |
| 32 prevTime = Date.now(); | |
| 33 window.requestAnimationFrame(timestamp); | |
| 34 }); | |
| 35 } | |
| 36 } | |
| 37 </script> | |
| 38 <body onload="changeImage()"> | |
| 39 <img id="target" src="animation-blue.gif" onload="imageLoaded()"> | |
| 40 </body> | |
| OLD | NEW |