| xidachen@chromium.org | 941d25f | 2017-07-06 22:33:54 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html class="reftest-wait"> |
| 3 | <link rel="match" href="parse-input-arguments-ref.html"> |
| 4 | <style> |
| 5 | .container { |
| 6 | width: 100px; |
| 7 | height: 100px; |
| 8 | } |
| 9 | |
| 10 | #canvas-geometry { |
| 11 | background-image: paint(geometry); |
| 12 | } |
| 13 | </style> |
| 14 | <script src="/common/reftest-wait.js"></script> |
| 15 | <script src="/common/css-paint-tests.js"></script> |
| 16 | <body> |
| 17 | <div id="canvas-geometry" class="container"></div> |
| 18 | |
| 19 | <script id="code" type="text/worklet"> |
| 20 | var testsPassed = false; |
| 21 | try { |
| 22 | registerPaint('foo7', class { }); |
| 23 | } catch(ex) { |
| 24 | if (ex.name == 'TypeError' && ex.message == "Failed to execute 'registerPaint' on 'PaintWorkletGlobalScope': The 'paint' function on the prototype does not exist.") |
| 25 | testsPassed = true; |
| 26 | } |
| 27 | |
| 28 | registerPaint('geometry', class { |
| 29 | paint(ctx, geom) { |
| 30 | if (testsPassed) |
| 31 | ctx.strokeStyle = 'green'; |
| 32 | else |
| 33 | ctx.strokeStyle = 'red'; |
| 34 | ctx.lineWidth = 4; |
| 35 | ctx.strokeRect(0, 0, geom.width, geom.height); |
| 36 | } |
| 37 | }); |
| 38 | </script> |
| 39 | |
| 40 | <script> |
| 41 | importPaintWorkletAndTerminateTestAfterAsyncPaint(document.getElementById('code').textContent); |
| 42 | </script> |
| 43 | </body> |
| 44 | </html> |