Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: LayoutTests/paint/invalidation/animated-gif.html

Issue 1304093006: Add a new API for testing animated images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase harder Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype HTML> 1 <!doctype HTML>
2 <body> 2 <body>
3 <div style="height: 2000px; width: 2000px;"> 3 <div style="height: 2000px; width: 2000px;">
4 <img id="targetImage"> 4 <img id="targetImage">
5 </div> 5 </div>
6 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> 6 <script src="../../fast/repaint/resources/text-based-repaint.js"></script>
7 <script> 7 <script>
8 window.testIsAsync = true; 8 window.testIsAsync = true;
9 9
10 // Steps:
11 // 1. Load the image
12 // 2. Start tracking paint invalidation rects
13 // 3. Call layoutAndPaintAsyncThen (via runRepaintTest, which does this for us) to draw a frame
14 // 4. Wait longer than 100ms, so that the timer between the first and second ani mated GIF
15 // frame expires and a paint invalidation is issued on the animated GIF. (100 ms is the
16 // length of the first frame of the animation in the GIF file.)
17 // 5. Stop tracking paint invalidation rects (finishRepaintTest does this for us )
18
19 // These steps differ from a standard repaint test in that step 2 precedes step 3.
20 // This is critical because layoutAndPaintAsyncThen may take longer than the 100 ms of the timer,
21 // so we may miss it.
22
23 function repaintTest() { 10 function repaintTest() {
24 setTimeout(finishRepaintTest, 150); 11 window.internals.advanceImageAnimation(targetImage);
12 requestAnimationFrame(function() {
13 finishRepaintTest();
14 });
25 } 15 }
26 16
27 function targetImageOnload() { 17 function targetImageOnload() {
28 if (window.internals) 18 window.internals.startTrackingRepaints(document);
29 window.internals.startTrackingRepaints(document);
30 runRepaintTest(); 19 runRepaintTest();
31 } 20 }
32 21
33 window.onload = function() { 22 window.onload = function() {
34 targetImage.onload = targetImageOnload; 23 targetImage.onload = targetImageOnload;
35 targetImage.src="../../fast/backgrounds/resources/red-green-animated.gif"; 24 targetImage.src="../../fast/backgrounds/resources/red-green-animated.gif";
36 } 25 }
37 </script> 26 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698