Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE HTML> |
| 2 <canvas id="cnv" width=140 height=140></canvas> | 2 <html> |
| 3 | 3 <head> |
| 4 <style type="text/css"> | |
|
Justin Novosad
2016/10/28 21:12:19
Why is this necessary?
zakerinasab
2016/11/02 15:45:33
Not necessary, can be removed.
| |
| 5 .nomargin { | |
| 6 margin: 0px auto; | |
| 7 } | |
| 8 </style> | |
| 4 <script> | 9 <script> |
| 5 // This layout test checks if the 2D canvas is properly displayed | 10 // This browser pixel test checks if the 2D canvas is properly displayed |
| 6 // when the color space is set to linear-rgb. | 11 // when the color space is set to linear-rgb. |
| 7 | 12 |
| 8 var g_swapsBeforeAck = 15; | 13 var g_swapsBeforeAck = 15; |
| 9 | 14 |
| 10 function main() | 15 function main() |
| 11 { | 16 { |
| 12 draw(); | 17 draw(); |
| 13 waitForFinish(); | 18 waitForFinish(); |
| 14 } | 19 } |
| 15 | 20 |
| 16 function draw() | 21 function draw() |
| 17 { | 22 { |
| 18 var ctx = document.getElementById("cnv").getContext("2d", {colorSpace:'linear- rgb'}); | 23 var ctx = document.getElementById("c").getContext("2d", {colorSpace:'linear-rg b'}); |
| 19 ctx.fillStyle = 'red'; | 24 ctx.fillStyle = 'red'; |
| 20 ctx.fillRect(20,20,50,50); | 25 ctx.fillRect(20,20,50,50); |
| 21 ctx.fillStyle = 'green'; | 26 ctx.fillStyle = 'green'; |
| 22 ctx.fillRect(70,20,50,50); | 27 ctx.fillRect(70,20,50,50); |
| 23 ctx.fillStyle = 'blue'; | 28 ctx.fillStyle = 'blue'; |
| 24 ctx.fillRect(20,70,50,50); | 29 ctx.fillRect(20,70,50,50); |
| 25 ctx.fillStyle = 'black'; | 30 ctx.fillStyle = 'black'; |
| 26 ctx.fillRect(70,70,50,50); | 31 ctx.fillRect(70,70,50,50); |
| 27 } | 32 } |
| 28 | 33 |
| 29 function waitForFinish() | 34 function waitForFinish() |
| 30 { | 35 { |
| 31 if (g_swapsBeforeAck == 0) { | 36 if (g_swapsBeforeAck == 0) { |
| 32 domAutomationController.setAutomationId(1); | 37 domAutomationController.setAutomationId(1); |
| 33 domAutomationController.send("SUCCESS"); | 38 domAutomationController.send("SUCCESS"); |
| 34 } else { | 39 } else { |
| 35 g_swapsBeforeAck--; | 40 g_swapsBeforeAck--; |
| 36 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; | 41 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
| 37 window.webkitRequestAnimationFrame(waitForFinish); | 42 window.webkitRequestAnimationFrame(waitForFinish); |
| 38 } | 43 } |
| 39 } | 44 } |
| 40 | |
| 41 main(); | |
| 42 </script> | 45 </script> |
| 43 | 46 </head> |
| 44 | 47 <body onload="main()"> |
|
Justin Novosad
2016/10/28 21:12:19
Is this what fixes the timeout? If so, care to ex
zakerinasab
2016/11/02 15:45:33
It is necessary as it waits for all the components
| |
| 48 <div style="position:relative; width:300px; height:300px; background-color:white "> | |
|
Justin Novosad
2016/10/28 21:12:19
Why is this necessary?
zakerinasab
2016/11/02 15:45:33
No, can be removed.
| |
| 49 </div> | |
| 50 <div id="container" style="position:absolute; top:0px; left:0px"> | |
|
Justin Novosad
2016/10/28 21:12:19
Why is this necessary?
zakerinasab
2016/11/02 15:45:33
It seems the canvas must be inside a div for the b
| |
| 51 <canvas id="c" width="200" height="200" class="nomargin"></canvas> | |
| 52 </div> | |
| 53 </body> | |
| 54 </html> | |
| OLD | NEW |