OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 #flexbox { | 5 #flexbox { |
6 display: -webkit-flex; | 6 display: -webkit-flex; |
7 } | 7 } |
8 | 8 |
9 #left { | 9 #left { |
10 -webkit-flex: 1; | 10 -webkit-flex: 1; |
11 background-color: yellow; | 11 background-color: yellow; |
12 } | 12 } |
13 | 13 |
14 #content { | 14 #content { |
15 -webkit-flex: 1; | 15 -webkit-flex: 1; |
16 background-color: grey; | 16 background-color: grey; |
17 } | 17 } |
18 </style> | 18 </style> |
| 19 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> |
19 <script> | 20 <script> |
20 // This test makes sure that we repaint the right region of a flexbox when | 21 // This test makes sure that we repaint the right region of a flexbox when |
21 // changing the flex values. Only the middle of the test page should be | 22 // changing the flex values. Only the middle of the test page should be |
22 // repainted. If the top of the test page (above the flexbox) is repainted, | 23 // repainted. If the top of the test page (above the flexbox) is repainted, |
23 // this test fails. | 24 // this test fails. |
24 | 25 |
25 function setFlex(id, animationPercentage, start, end) { | 26 function setFlex(id, animationPercentage, start, end) { |
26 var flexValue = start + ((end - start) * animationPercentage); | 27 var flexValue = start + ((end - start) * animationPercentage); |
27 document.getElementById(id).style.webkitFlex = flexValue + " 0 0px"; | 28 document.getElementById(id).style.webkitFlex = flexValue + " 0 0px"; |
28 } | 29 } |
29 | 30 |
30 function step(count) { | 31 function step(count) { |
31 var animationPercentage = count ? 1 : .9; | 32 var animationPercentage = count ? 1 : .9; |
32 setFlex("content", animationPercentage, 1, 5); | 33 setFlex("content", animationPercentage, 1, 5); |
33 | 34 |
34 if (!count) | 35 if (!count) |
35 setTimeout(step.bind(null, 1)); | 36 setTimeout(step.bind(null, 1)); |
36 else if (window.testRunner) { | 37 else if (window.testRunner) { |
37 var repaintRects = window.internals.repaintRectsAsText(document); | 38 finishRepaintTest(); |
38 window.internals.stopTrackingRepaints(document); | |
39 var pre = document.createElement('pre'); | |
40 document.body.appendChild(pre); | |
41 pre.textContent += repaintRects; | |
42 | |
43 testRunner.notifyDone(); | |
44 } | 39 } |
45 } | 40 } |
46 | 41 |
47 window.onload = function() { | 42 window.testIsAsync = true; |
48 if (window.testRunner) { | 43 window.onload = runRepaintTest; |
49 testRunner.dumpAsText(); | 44 |
50 testRunner.waitUntilDone(); | 45 function repaintTest() { |
51 document.body.offsetTop; | |
52 window.internals.startTrackingRepaints(document); | |
53 } | |
54 window.startTime = Date.now(); | 46 window.startTime = Date.now(); |
55 | |
56 setTimeout(step.bind(null, 0), 0); | 47 setTimeout(step.bind(null, 0), 0); |
57 }; | 48 } |
58 </script> | 49 </script> |
59 </head> | 50 </head> |
60 <body> | 51 <body> |
61 <br><br><br><br><br><br> | 52 <br><br><br><br><br><br> |
62 <div id="flexbox"> | 53 <div id="flexbox"> |
63 <div id="left"></div> | 54 <div id="left"></div> |
64 <div id="content"> | 55 <div id="content"> |
65 <p style="margin: 0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ae
nean laoreet dolor id urna eleifend aliquet. Nulla vel dolor ipsum. Aliquam ut t
urpis nisl, in vulputate sapien. Cum sociis natoque penatibus et magnis dis part
urient montes, nascetur ridiculus mus. Sed congue magna vitae dolor feugiat vehi
cula. Sed volutpat, tellus vel varius vestibulum, purus quam mollis sapien, in c
ondimentum leo neque sed nulla. Nunc quis porta elit. Pellentesque erat lectus,
ultricies a lobortis id, faucibus id quam.</p> | 56 <p style="margin: 0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ae
nean laoreet dolor id urna eleifend aliquet. Nulla vel dolor ipsum. Aliquam ut t
urpis nisl, in vulputate sapien. Cum sociis natoque penatibus et magnis dis part
urient montes, nascetur ridiculus mus. Sed congue magna vitae dolor feugiat vehi
cula. Sed volutpat, tellus vel varius vestibulum, purus quam mollis sapien, in c
ondimentum leo neque sed nulla. Nunc quis porta elit. Pellentesque erat lectus,
ultricies a lobortis id, faucibus id quam.</p> |
66 </div> | 57 </div> |
67 </body> | 58 </body> |
68 </html> | 59 </html> |
OLD | NEW |