registered-property-invalidation-001.https.html (1183B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <title>Registering a property causes invalidation for initial value</title> 4 <link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> 5 <link rel="match" href="parse-input-arguments-ref.html"> 6 <script src="/common/reftest-wait.js"></script> 7 <script src="/common/worklet-reftest.js"></script> 8 <body> 9 <style> 10 #target { 11 background: paint(geometry); 12 width: 100px; 13 height: 100px; 14 } 15 </style> 16 <div id="target"></div> 17 <script id="code" type="text/worklet"> 18 registerPaint('geometry', class { 19 static get inputProperties() { return ['--color']; } 20 paint(ctx, geom, styleMap) { 21 ctx.fillStyle = styleMap.get('--color').toString(); 22 ctx.fillRect(0, 0, geom.width, geom.height); 23 } 24 }); 25 </script> 26 27 <script> 28 async function test() { 29 getComputedStyle(target); 30 let code = document.getElementById('code').textContent; 31 await importWorklet(CSS.paintWorklet, code); 32 await workletPainted(); 33 CSS.registerProperty({ 34 name: '--color', 35 syntax: '<color>', 36 initialValue: 'green', 37 inherits: false 38 }); 39 await workletPainted(); 40 takeScreenshot(); 41 } 42 43 test(); 44 </script> 45 </body> 46 </html>