layout/reftests/invalidation/filter-userspace-offset.svg

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/invalidation/filter-userspace-offset.svg	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,156 @@
     1.4 +<svg
     1.5 +  width="500px" height="500px" viewBox="0 0 500 500"
     1.6 +  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
     1.7 +  >
     1.8 +  <title>Filters and offsets, user space origins, invalidation</title>
     1.9 +  <defs>
    1.10 +    <filter id="flood-boundingBox"
    1.11 +            filterUnits="objectBoundingBox"
    1.12 +            x="0%" y="0%" width="100%" height="100%"
    1.13 +            color-interpolation-filters="sRGB">
    1.14 +      <feFlood flood-color="lime"/>
    1.15 +    </filter>
    1.16 +    <filter id="matrix-boundingBox"
    1.17 +            filterUnits="objectBoundingBox"
    1.18 +            x="0%" y="0%" width="100%" height="100%"
    1.19 +            color-interpolation-filters="sRGB">
    1.20 +      <feColorMatrix type="matrix" values="0 1 0 0 0
    1.21 +                                           1 0 0 0 0
    1.22 +                                           0 0 1 0 0
    1.23 +                                           0 0 0 1 0"/>
    1.24 +    </filter>
    1.25 +    <filter id="matrix-fillPaint-boundingBox"
    1.26 +            filterUnits="objectBoundingBox"
    1.27 +            x="0%" y="0%" width="100%" height="100%"
    1.28 +            color-interpolation-filters="sRGB">
    1.29 +      <feColorMatrix type="matrix" values="0 1 0 0 0
    1.30 +                                           1 0 0 0 0
    1.31 +                                           0 0 1 0 0
    1.32 +                                           0 0 0 1 0" in="FillPaint"/>
    1.33 +    </filter>
    1.34 +    <filter id="flood-userSpace-atZero"
    1.35 +            filterUnits="userSpaceOnUse"
    1.36 +            x="0" y="0" width="100" height="100"
    1.37 +            color-interpolation-filters="sRGB">
    1.38 +      <feFlood flood-color="lime"/>
    1.39 +    </filter>
    1.40 +    <filter id="matrix-userSpace-atZero"
    1.41 +            filterUnits="userSpaceOnUse"
    1.42 +            x="0" y="0" width="100" height="100"
    1.43 +            color-interpolation-filters="sRGB">
    1.44 +      <feColorMatrix type="matrix" values="0 1 0 0 0
    1.45 +                                           1 0 0 0 0
    1.46 +                                           0 0 1 0 0
    1.47 +                                           0 0 0 1 0"/>
    1.48 +    </filter>
    1.49 +    <filter id="flood-userSpace-at100"
    1.50 +            filterUnits="userSpaceOnUse"
    1.51 +            x="100" y="100" width="100" height="100"
    1.52 +            color-interpolation-filters="sRGB">
    1.53 +      <feFlood flood-color="lime"/>
    1.54 +    </filter>
    1.55 +    <filter id="matrix-userSpace-at100"
    1.56 +            filterUnits="userSpaceOnUse"
    1.57 +            x="100" y="100" width="100" height="100"
    1.58 +            color-interpolation-filters="sRGB">
    1.59 +      <feColorMatrix type="matrix" values="0 1 0 0 0
    1.60 +                                           1 0 0 0 0
    1.61 +                                           0 0 1 0 0
    1.62 +                                           0 0 0 1 0"/>
    1.63 +    </filter>
    1.64 +    <filter id="matrix-fillPaint-userSpace-at100"
    1.65 +            filterUnits="userSpaceOnUse"
    1.66 +            x="100" y="100" width="100" height="100"
    1.67 +            color-interpolation-filters="sRGB">
    1.68 +      <feColorMatrix type="matrix" values="0 1 0 0 0
    1.69 +                                           1 0 0 0 0
    1.70 +                                           0 0 1 0 0
    1.71 +                                           0 0 0 1 0" in="FillPaint"/>
    1.72 +    </filter>
    1.73 +    <mask id="boundingBox" maskContentUnits="objectBoundingBox">
    1.74 +      <rect x="0" y="0" width="1" height="1" fill="white"/>
    1.75 +    </mask>
    1.76 +    <mask id="userSpace-atZero" maskContentUnits="userSpaceOnUse">
    1.77 +      <rect x="0" y="0" width="100" height="100" fill="white"/>
    1.78 +    </mask>
    1.79 +    <mask id="userSpace-at100" maskContentUnits="userSpaceOnUse">
    1.80 +      <rect x="100" y="100" width="100" height="100" fill="white"/>
    1.81 +    </mask>
    1.82 +    <g id="usedRect">
    1.83 +      <rect class="fillColor" width="100" height="100"/>
    1.84 +    </g>
    1.85 +  </defs>
    1.86 +  <g transform="translate(40,40)">
    1.87 +    <rect stroke-width="1" stroke="black" fill="none" x="99.5" y="99.5" width="101" height="101"/>
    1.88 +
    1.89 +    <rect x="0" y="100" width="100" height="100" class="fillColor offsetContainer" id="rect"/>
    1.90 +    <use xlink:href="#usedRect" x="0" y="100" class="offsetContainer" id="use"/>
    1.91 +    <svg x="0" y="100" width="100" height="100" class="offsetContainer" id="innerSVG">
    1.92 +      <rect class="fillColor" width="100" height="100"/>
    1.93 +    </svg>
    1.94 +    <foreignObject x="0" y="100" width="100" height="100" class="offsetContainer" id="foreignObject">
    1.95 +      <svg width="100" height="100">
    1.96 +        <rect class="fillColor" width="100" height="100"/>
    1.97 +      </svg>
    1.98 +    </foreignObject>
    1.99 +  </g>
   1.100 +  <script><![CDATA[
   1.101 +
   1.102 +var options = {
   1.103 +  offsetContainer: "rect",
   1.104 +  filter: null,
   1.105 +  mask: null,
   1.106 +  updateOffsetOn: "reftestInvalidate" // | "initial" | "timeout"
   1.107 +};
   1.108 +
   1.109 +location.search.substr(1).split("&").forEach(function (s) {
   1.110 +  var pv = s.split("=");
   1.111 +  options[pv[0]] = pv[1] || true;
   1.112 +});
   1.113 +
   1.114 +var offsetContainer = document.getElementById(options.offsetContainer);
   1.115 +
   1.116 +function updateOffsetNow() {
   1.117 +  offsetContainer.setAttribute("x", "100");
   1.118 +}
   1.119 +
   1.120 +function updateOffsetOnReftestInvalidate() {
   1.121 +  document.documentElement.setAttribute("class", "reftest-wait");
   1.122 +  document.addEventListener("MozReftestInvalidate", function () {
   1.123 +    updateOffsetNow();
   1.124 +    document.documentElement.removeAttribute("class");
   1.125 +  }, false);
   1.126 +}
   1.127 +
   1.128 +function updateOffsetOnTimeout() {
   1.129 +  setTimeout(updateOffsetNow, 500);
   1.130 +}
   1.131 +
   1.132 +options.updateOffset = options.updateOffsetOn == "initial" ? updateOffsetNow :
   1.133 +                         (options.updateOffsetOn == "timeout" ? updateOffsetOnTimeout :
   1.134 +                          updateOffsetOnReftestInvalidate);
   1.135 +
   1.136 +var offsetContainers = Array.prototype.slice.call(document.getElementsByClassName("offsetContainer"), 0);
   1.137 +for (var i = 0; i < offsetContainers.length; i++) {
   1.138 +  if (offsetContainers[i] != offsetContainer) {
   1.139 +    offsetContainers[i].parentNode.removeChild(offsetContainers[i]);
   1.140 +  }
   1.141 +}
   1.142 +
   1.143 +var fillColor = options.filter ? "red" : "lime";
   1.144 +if (options.filter) {
   1.145 +  offsetContainer.setAttribute("filter", "url(#" + options.filter + ")");
   1.146 +}
   1.147 +if (options.mask) {
   1.148 +  offsetContainer.setAttribute("mask", "url(#" + options.mask + ")");
   1.149 +}
   1.150 +
   1.151 +var fillColors = document.getElementsByClassName("fillColor");
   1.152 +for (var j = 0; j < fillColors.length; j++) {
   1.153 +  fillColors[j].setAttribute("fill", fillColor);
   1.154 +}
   1.155 +
   1.156 +options.updateOffset();
   1.157 +
   1.158 +]]></script>
   1.159 +</svg>

mercurial