paint2d-reset.https.html (1021B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> 4 <link rel="match" href="paint2d-reset-ref.html"> 5 <style> 6 #output { 7 width: 100px; 8 height: 100px; 9 background-image: paint(rects); 10 } 11 </style> 12 <script src="/common/reftest-wait.js"></script> 13 <script src="/common/worklet-reftest.js"></script> 14 <body> 15 <div id="output"></div> 16 17 <script id="code" type="text/worklet"> 18 registerPaint('rects', class { 19 paint(ctx, geom) { 20 ctx.fillStyle = 'yellow'; 21 ctx.fillRect(10, 10, 50, 50); 22 ctx.fillStyle = 'magenta'; 23 ctx.fillRect(20, 20, 50, 50); 24 ctx.strokeStyle = 'cyan'; 25 ctx.moveTo(40, 0); 26 ctx.reset(); 27 ctx.lineWidth = 10; 28 ctx.lineTo(0, 40); 29 ctx.stroke(); 30 ctx.fillRect(30, 30, 20, 20); 31 } 32 }); 33 </script> 34 35 <script> 36 importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); 37 </script> 38 </body> 39 </html>