| <!DOCTYPE html> |
| <html> |
| <body> |
| <canvas id='output' width='400' height='400'></canvas> |
| <script> |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| } |
| |
| let ofc = new OffscreenCanvas(100, 100); |
| let ctx = ofc.getContext("2d"); |
| |
| draw(); |
| requestAnimationFrame(() => { |
| requestAnimationFrame(() => { |
| draw(); |
| if (window.testRunner) { |
| testRunner.notifyDone(); |
| } |
| }); |
| }); |
| |
| function draw() { |
| ctx.clearRect(0, 0, 100, 100); |
| ctx.font = "50px Ahem"; |
| ctx.textBaseline = "top"; |
| ctx.fillStyle = "red"; |
| ctx.fillText("X", 0, 0); |
| |
| var c = document.getElementById("output").getContext("2d"); |
| c.drawImage(ofc, 0, 0); |
| } |
| |
| </script> |
| </body> |
| </html> |