OLD | NEW |
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> |
OLD | NEW |