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/gpu_tests/pixel_test_pages.py. This will ens
ure |
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 commit flow on worker thread: red square on white backgro
und.</title> | 11 <title>OffscreenCanvas commit flow on worker thread: red square on white backgro
und.</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 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 function main() | 77 function main() |
78 { | 78 { |
79 draw(); | 79 draw(); |
80 } | 80 } |
81 | 81 |
82 function draw() | 82 function draw() |
83 { | 83 { |
84 var canvas = document.getElementById("c"); | 84 var canvas = document.getElementById("c"); |
85 var offscreenCanvas = canvas.transferControlToOffscreen(); | 85 var offscreenCanvas = canvas.transferControlToOffscreen(); |
86 var worker = makeWorker(document.getElementById("myWorker").textContent); | 86 var worker = makeWorker(document.getElementById("myWorker").textContent); |
87 worker.postMessage(offscreenCanvas, [offscreenCanvas]); | |
88 worker.onmessage = function (e) { | 87 worker.onmessage = function (e) { |
89 waitForFinish(); | 88 waitForFinish(); |
90 } | 89 } |
| 90 worker.postMessage(offscreenCanvas, [offscreenCanvas]); |
91 } | 91 } |
92 | 92 |
93 function waitForFinish() | 93 function waitForFinish() |
94 { | 94 { |
95 if (g_swapsBeforeAck == 0) { | 95 if (g_swapsBeforeAck == 0) { |
96 domAutomationController.setAutomationId(1); | 96 domAutomationController.setAutomationId(1); |
97 domAutomationController.send("SUCCESS"); | 97 domAutomationController.send("SUCCESS"); |
98 } else { | 98 } else { |
99 g_swapsBeforeAck--; | 99 g_swapsBeforeAck--; |
100 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; | 100 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
101 window.webkitRequestAnimationFrame(waitForFinish); | 101 window.webkitRequestAnimationFrame(waitForFinish); |
102 } | 102 } |
103 } | 103 } |
104 </script> | 104 </script> |
105 </head> | 105 </head> |
106 <body onload="main()"> | 106 <body onload="main()"> |
107 <div style="position:relative; width:300px; height:300px; background-color:white
"> | 107 <div style="position:relative; width:300px; height:300px; background-color:white
"> |
108 </div> | 108 </div> |
109 <div id="container" style="position:absolute; top:0px; left:0px"> | 109 <div id="container" style="position:absolute; top:0px; left:0px"> |
110 <canvas id="c" width="300" height="300" class="nomargin"></canvas> | 110 <canvas id="c" width="300" height="300" class="nomargin"></canvas> |
111 </div> | 111 </div> |
112 </body> | 112 </body> |
113 </html> | 113 </html> |
OLD | NEW |