background-image-alpha.https.html (1254B)
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="background-image-alpha-ref.html"> 5 <style> 6 .container { 7 width: 100px; 8 height: 100px; 9 } 10 11 #canvas-opaque { 12 background-image: paint(opaque); 13 } 14 15 #canvas-nonopaque { 16 background-image: paint(nonOpaque); 17 } 18 19 #background { 20 background-color: yellow; 21 display: inline-block; 22 } 23 </style> 24 <script src="/common/reftest-wait.js"></script> 25 <script src="/common/worklet-reftest.js"></script> 26 <body> 27 <div id="background"> 28 <div id="canvas-opaque" class="container"></div> 29 <div id="canvas-nonopaque" class="container"></div> 30 </div> 31 32 <script id="code" type="text/worklet"> 33 registerPaint('opaque', class { 34 static get contextOptions() { return {alpha: false}; } 35 paint(ctx, geom) { 36 ctx.fillStyle = 'blue'; 37 ctx.fillRect(20, 20, 60, 60); 38 } 39 }); 40 41 registerPaint('nonOpaque', class { 42 static get contextOptions() { return {alpha: true}; } 43 paint(ctx, geom) { 44 ctx.fillStyle = 'blue'; 45 ctx.fillRect(20, 20, 60, 60); 46 } 47 }); 48 </script> 49 50 <script> 51 importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); 52 </script> 53 </body> 54 </html>