| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 | 2 |
| 3 <!-- READ BEFORE UPDATING: | 3 <!-- READ BEFORE UPDATING: |
| 4 If this test is updated make sure to increment the "revision" value of the | 4 If this test is updated make sure to increment the "revision" value of the |
| 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure | 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure |
| 6 that the baseline images are regenerated on the next run. | 6 that the baseline images are regenerated on the next run. |
| 7 --> | 7 --> |
| 8 | 8 |
| 9 <html> | 9 <html> |
| 10 <head> | 10 <head> |
| 11 <title>OffscreenCanvas 2d commit flow on worker thread: blue square on white bac
kground.</title> | 11 <title>OffscreenCanvas 2d commit flow on worker thread: Four-color square on whi
te background.</title> |
| 12 <style type="text/css"> | 12 <style type="text/css"> |
| 13 .nomargin { | 13 .nomargin { |
| 14 margin: 0px auto; | 14 margin: 0px auto; |
| 15 } | 15 } |
| 16 </style> | 16 </style> |
| 17 <script id="myWorker" type="text/worker"> | 17 <script id="myWorker" type="text/worker"> |
| 18 self.onmessage = function(e) { | 18 self.onmessage = function(e) { |
| 19 var transferredCanvas = e.data; | 19 var transferredCanvas = e.data; |
| 20 var offscreen2d = transferredCanvas.getContext("2d"); | 20 var offscreen2d = transferredCanvas.getContext("2d"); |
| 21 offscreen2d.fillStyle = "red"; |
| 22 offscreen2d.fillRect(0, 0, 100, 100); |
| 23 offscreen2d.fillStyle = "green"; |
| 24 offscreen2d.fillRect(100, 0, 100, 100); |
| 21 offscreen2d.fillStyle = "blue"; | 25 offscreen2d.fillStyle = "blue"; |
| 22 offscreen2d.fillRect(0, 0, transferredCanvas.width, transferredCanvas.height
); | 26 offscreen2d.fillRect(0, 100, 100, 100); |
| 27 offscreen2d.fillStyle = "black"; |
| 28 offscreen2d.fillRect(100, 100, 100, 100); |
| 23 offscreen2d.commit(); | 29 offscreen2d.commit(); |
| 24 self.postMessage(""); | 30 self.postMessage(""); |
| 25 }; | 31 }; |
| 26 </script> | 32 </script> |
| 27 <script> | 33 <script> |
| 28 var g_swapsBeforeAck = 15; | 34 var g_swapsBeforeAck = 15; |
| 29 | 35 |
| 30 function makeWorker(script) | 36 function makeWorker(script) |
| 31 { | 37 { |
| 32 var blob = new Blob([script]); | 38 var blob = new Blob([script]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 var offscreenCanvas = canvas2D.transferControlToOffscreen(); | 57 var offscreenCanvas = canvas2D.transferControlToOffscreen(); |
| 52 var worker = makeWorker(document.getElementById("myWorker").textContent); | 58 var worker = makeWorker(document.getElementById("myWorker").textContent); |
| 53 worker.postMessage(offscreenCanvas, [offscreenCanvas]); | 59 worker.postMessage(offscreenCanvas, [offscreenCanvas]); |
| 54 worker.onmessage = function (e) { | 60 worker.onmessage = function (e) { |
| 55 waitForFinish(); | 61 waitForFinish(); |
| 56 }; | 62 }; |
| 57 } | 63 } |
| 58 </script> | 64 </script> |
| 59 </head> | 65 </head> |
| 60 <body onload="main()"> | 66 <body onload="main()"> |
| 61 <div style="position:relative; width:350px; height:350px; background-color:white
"> | 67 <div style="position:relative; width:300px; height:300px; background-color:white
"> |
| 62 </div> | 68 </div> |
| 63 <div id="container" style="position:absolute; top:0px; left:0px"> | 69 <div id="container" style="position:absolute; top:0px; left:0px"> |
| 64 <canvas id="c" width="320" height="320" class="nomargin"></canvas> | 70 <canvas id="c" width="200" height="200" class="nomargin"></canvas> |
| 65 </div> | 71 </div> |
| 66 </body> | 72 </body> |
| 67 </html> | 73 </html> |
| OLD | NEW |