| <!DOCTYPE html> |
| <html> |
| <script src="./resources/test-runner-paint-worklet.js"></script> |
| <style> |
| html, body { margin: 0; padding: 0; } |
| .container { |
| width: 200px; |
| height: 200px; |
| } |
| |
| #canvas-shadow { |
| background-image: paint(shadow); |
| } |
| </style> |
| <body> |
| <div id="canvas-shadow" class="container"></div> |
| |
| <script id="code" type="text/worklet"> |
| registerPaint('shadow', class { |
| paint(ctx) { |
| ctx.shadowBlur = 20; |
| ctx.shadowColor = 'red'; |
| ctx.shadowOffsetX = 30; |
| ctx.shadowOffsetY = 40; |
| // When we query these things from JS they should not be affected by |
| // the page zoom. |
| if (ctx.shadowBlur == 20 && ctx.shadowOffsetX == 30 && |
| ctx.shadowOffsetY == 40) { |
| ctx.fillRect(20, 20, 50, 50); |
| } else { |
| ctx.fillRect(0, 0, 10, 10); |
| } |
| } |
| }); |
| </script> |
| |
| <script> |
| document.body.style.zoom = "200%" |
| importPaintWorkletThenEndTest(document.getElementById('code').textContent); |
| </script> |
| </body> |
| </html> |