2d.layer.clearRect.full.html (785B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <link rel="match" href="2d.layer.clearRect.full-expected.html"> 5 <title>Canvas test: 2d.layer.clearRect.full</title> 6 <h1>2d.layer.clearRect.full</h1> 7 <p class="desc">clearRect inside a layer can clear all of the layer content.</p> 8 <canvas id="canvas" width="100" height="100"> 9 <p class="fallback">FAIL (fallback content)</p> 10 </canvas> 11 <script> 12 const canvas = document.getElementById("canvas"); 13 const ctx = canvas.getContext('2d'); 14 15 ctx.fillStyle = 'blue'; 16 ctx.fillRect(10, 10, 80, 50); 17 18 ctx.beginLayer(); 19 ctx.fillStyle = 'red'; 20 ctx.fillRect(20, 20, 80, 50); 21 ctx.fillStyle = 'green'; 22 ctx.clearRect(0, 0, 100, 100); 23 ctx.endLayer(); 24 </script>