| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <style> | |
| 5 .box { | |
| 6 position: absolute; | |
| 7 width: 100px; | |
| 8 height: 100px; | |
| 9 margin: 10px; | |
| 10 background-color: green; | |
| 11 } | |
| 12 | |
| 13 .test { | |
| 14 -webkit-mask-image: -webkit-canvas(viewport-mask); | |
| 15 -webkit-mask-position: 50% 50%; | |
| 16 } | |
| 17 | |
| 18 .composited { | |
| 19 transform: translateZ(0); | |
| 20 } | |
| 21 | |
| 22 .indicator { | |
| 23 background-color: red; | |
| 24 } | |
| 25 | |
| 26 .outlined { | |
| 27 outline: 40px solid transparent; | |
| 28 } | |
| 29 </style> | |
| 30 <script> | |
| 31 if (window.testRunner) | |
| 32 testRunner.dumpAsTextWithPixelResults(); | |
| 33 | |
| 34 function drawMask() | |
| 35 { | |
| 36 var canvasWidth = 100; | |
| 37 var canvasHeight = 100; | |
| 38 var ctx = document.getCSSCanvasContext('2d', 'viewport-mask', canvasWidth,
canvasHeight) | |
| 39 ctx.fillStyle = "rgba(0, 0, 0, 1)"; | |
| 40 ctx.fillRect(0, 0, canvasWidth, canvasHeight); | |
| 41 } | |
| 42 | |
| 43 window.addEventListener('load', drawMask, false); | |
| 44 </script> | |
| 45 </head> | |
| 46 <body> | |
| 47 <!-- You should see two green boxes side by side, and no red. --> | |
| 48 <div class="indicator box" style="left: 10px;"></div> | |
| 49 <div class="indicator box" style="left: 120px;"></div> | |
| 50 | |
| 51 <div class="test box" style="left: 10px;"></div> | |
| 52 <div class="composited test box" style="left: 120px"></div> | |
| 53 | |
| 54 <div class="outlined"></div> | |
| 55 </body> | |
| 56 </html> | |
| OLD | NEW |