mask-invalidation-1b.html (2552B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Masking: mask invalidation.</title> 6 <style type="text/css"> 7 div.outer { 8 background-color: purple; 9 position: absolute; 10 margin: 1px 2px 3px 4px; 11 border: solid purple; 12 width: 40px; 13 height: 20px; 14 } 15 16 div.inner { 17 width: 10px; 18 height: 10px; 19 border: 1px solid transparent; 20 will-change: transform; 21 } 22 23 div.mask { 24 mask-size: 100% 100%; 25 mask-origin: border-box; 26 mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100%" height="50%" fill="blue" fill-opacity="1"/><rect x="0" y="50%" width="100%" height="50%" fill="blue" fill-opacity="0"/></svg>'); 27 } 28 29 #d1 { 30 top: 10px; 31 left: 10px; 32 mask-clip: padding-box; 33 border-width: 10px; 34 padding: 0px; 35 } 36 37 #d2 { 38 top: 10px; 39 left: 110px; 40 mask-clip: padding-box; 41 border-width: 0px; 42 padding: 10px; 43 } 44 45 #d3 { 46 top: 15px; 47 left: 215px; 48 mask-clip: content-box; 49 border-width: 10px; 50 padding: 0px; 51 } 52 </style> 53 </head> 54 <body> 55 <div id="d1" class="outer mask"><div class="inner"></div></div> 56 <div id="d2" class="outer mask"><div class="inner"></div></div> 57 <div id="d3" class="outer mask"><div class="inner"></div></div> 58 <script type="text/javascript"> 59 function invalidateMaskedElements() 60 { 61 // Shrink border area, thicken padding area. Keep ths size of this 62 // division unchanged. 63 document.getElementById("d1").style.borderWidth = "5px"; 64 document.getElementById("d1").style.padding = "5px"; 65 66 // Shrink padding area, thicken border area. Keep ths size of this 67 // division unchanged. 68 document.getElementById("d2").style.borderWidth = "5px"; 69 document.getElementById("d2").style.padding = "5px"; 70 71 // Shrink border area, thicken content area. Keep ths size of this 72 // division unchanged. 73 document.getElementById("d3").style.width = "50px"; 74 document.getElementById("d3").style.height = "30px"; 75 document.getElementById("d3").style.borderWidth = "0px"; 76 77 document.documentElement.removeAttribute("class"); 78 } 79 80 document.addEventListener("MozReftestInvalidate", 81 invalidateMaskedElements); 82 </script> 83 </body> 84 </html>