parse-input-arguments-011.https.html (1090B)
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="parse-input-arguments-ref.html"> 5 <style> 6 .container { 7 width: 100px; 8 height: 100px; 9 } 10 11 #canvas-geometry { 12 background-image: paint(geometry); 13 } 14 </style> 15 <script src="/common/reftest-wait.js"></script> 16 <script src="/common/worklet-reftest.js"></script> 17 <body> 18 <div id="canvas-geometry" class="container"></div> 19 20 <script id="code" type="text/worklet"> 21 var testsPassed = false; 22 try { 23 registerPaint('foo7', class { }); 24 } catch(ex) { 25 // 'paint' property doesn't exist on the prototype chain. 26 if (ex.name == 'TypeError') 27 testsPassed = true; 28 } 29 30 registerPaint('geometry', class { 31 paint(ctx, geom) { 32 if (testsPassed) 33 ctx.fillStyle = 'green'; 34 else 35 ctx.fillStyle = 'red'; 36 ctx.fillRect(0, 0, geom.width, geom.height); 37 } 38 }); 39 </script> 40 41 <script> 42 importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent); 43 </script> 44 </body> 45 </html>