| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../resources/run-after-layout-and-paint.js"></script> |
| 5 <style> |
| 6 #output { |
| 7 width: 200px; |
| 8 height: 400px; |
| 9 background-image: paint(paths); |
| 10 } |
| 11 </style> |
| 12 </head> |
| 13 <body> |
| 14 <div id="output"></div> |
| 15 |
| 16 <script id="code" type="text/worklet"> |
| 17 registerPaint('paths', class { |
| 18 paint(ctx) { |
| 19 ctx.beginPath(); |
| 20 ctx.lineWidth = '10'; |
| 21 ctx.strokeStyle = 'green'; |
| 22 ctx.lineJoin = 'round'; |
| 23 ctx.moveTo(15, 15); |
| 24 ctx.lineTo(135, 15); |
| 25 ctx.lineTo(70, 170); |
| 26 ctx.closePath(); |
| 27 ctx.stroke(); |
| 28 |
| 29 var path1 = new Path2D(); |
| 30 path1.moveTo(150, 25); |
| 31 path1.bezierCurveTo(10, 150, 10, 300, 100, 200); |
| 32 ctx.strokeStyle = 'purple'; |
| 33 ctx.setLineDash([ 10, 5 ]); |
| 34 ctx.stroke(path1); |
| 35 |
| 36 ctx.fillStyle = 'red'; |
| 37 ctx.beginPath() |
| 38 ctx.arc(75, 325, 50, 0, Math.PI * 2, true); |
| 39 ctx.arc(75, 325, 20, 0, Math.PI * 2, true); |
| 40 ctx.fill("evenodd"); |
| 41 } |
| 42 }); |
| 43 </script> |
| 44 |
| 45 <script> |
| 46 if (window.testRunner) { |
| 47 testRunner.waitUntilDone(); |
| 48 } |
| 49 |
| 50 var blob = new Blob([document.getElementById('code').textContent]); |
| 51 paintWorklet.import(URL.createObjectURL(blob)).then(function() { |
| 52 runAfterLayoutAndPaint(function() { |
| 53 if (window.testRunner) { |
| 54 testRunner.notifyDone(); |
| 55 } |
| 56 }); |
| 57 }); |
| 58 </script> |
| 59 </body> |
| 60 </html> |
| OLD | NEW |