Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | <svg |
michael@0 | 2 | width="500px" height="500px" viewBox="0 0 500 500" |
michael@0 | 3 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" |
michael@0 | 4 | > |
michael@0 | 5 | <title>Filters and offsets, user space origins, invalidation</title> |
michael@0 | 6 | <defs> |
michael@0 | 7 | <filter id="flood-boundingBox" |
michael@0 | 8 | filterUnits="objectBoundingBox" |
michael@0 | 9 | x="0%" y="0%" width="100%" height="100%" |
michael@0 | 10 | color-interpolation-filters="sRGB"> |
michael@0 | 11 | <feFlood flood-color="lime"/> |
michael@0 | 12 | </filter> |
michael@0 | 13 | <filter id="matrix-boundingBox" |
michael@0 | 14 | filterUnits="objectBoundingBox" |
michael@0 | 15 | x="0%" y="0%" width="100%" height="100%" |
michael@0 | 16 | color-interpolation-filters="sRGB"> |
michael@0 | 17 | <feColorMatrix type="matrix" values="0 1 0 0 0 |
michael@0 | 18 | 1 0 0 0 0 |
michael@0 | 19 | 0 0 1 0 0 |
michael@0 | 20 | 0 0 0 1 0"/> |
michael@0 | 21 | </filter> |
michael@0 | 22 | <filter id="matrix-fillPaint-boundingBox" |
michael@0 | 23 | filterUnits="objectBoundingBox" |
michael@0 | 24 | x="0%" y="0%" width="100%" height="100%" |
michael@0 | 25 | color-interpolation-filters="sRGB"> |
michael@0 | 26 | <feColorMatrix type="matrix" values="0 1 0 0 0 |
michael@0 | 27 | 1 0 0 0 0 |
michael@0 | 28 | 0 0 1 0 0 |
michael@0 | 29 | 0 0 0 1 0" in="FillPaint"/> |
michael@0 | 30 | </filter> |
michael@0 | 31 | <filter id="flood-userSpace-atZero" |
michael@0 | 32 | filterUnits="userSpaceOnUse" |
michael@0 | 33 | x="0" y="0" width="100" height="100" |
michael@0 | 34 | color-interpolation-filters="sRGB"> |
michael@0 | 35 | <feFlood flood-color="lime"/> |
michael@0 | 36 | </filter> |
michael@0 | 37 | <filter id="matrix-userSpace-atZero" |
michael@0 | 38 | filterUnits="userSpaceOnUse" |
michael@0 | 39 | x="0" y="0" width="100" height="100" |
michael@0 | 40 | color-interpolation-filters="sRGB"> |
michael@0 | 41 | <feColorMatrix type="matrix" values="0 1 0 0 0 |
michael@0 | 42 | 1 0 0 0 0 |
michael@0 | 43 | 0 0 1 0 0 |
michael@0 | 44 | 0 0 0 1 0"/> |
michael@0 | 45 | </filter> |
michael@0 | 46 | <filter id="flood-userSpace-at100" |
michael@0 | 47 | filterUnits="userSpaceOnUse" |
michael@0 | 48 | x="100" y="100" width="100" height="100" |
michael@0 | 49 | color-interpolation-filters="sRGB"> |
michael@0 | 50 | <feFlood flood-color="lime"/> |
michael@0 | 51 | </filter> |
michael@0 | 52 | <filter id="matrix-userSpace-at100" |
michael@0 | 53 | filterUnits="userSpaceOnUse" |
michael@0 | 54 | x="100" y="100" width="100" height="100" |
michael@0 | 55 | color-interpolation-filters="sRGB"> |
michael@0 | 56 | <feColorMatrix type="matrix" values="0 1 0 0 0 |
michael@0 | 57 | 1 0 0 0 0 |
michael@0 | 58 | 0 0 1 0 0 |
michael@0 | 59 | 0 0 0 1 0"/> |
michael@0 | 60 | </filter> |
michael@0 | 61 | <filter id="matrix-fillPaint-userSpace-at100" |
michael@0 | 62 | filterUnits="userSpaceOnUse" |
michael@0 | 63 | x="100" y="100" width="100" height="100" |
michael@0 | 64 | color-interpolation-filters="sRGB"> |
michael@0 | 65 | <feColorMatrix type="matrix" values="0 1 0 0 0 |
michael@0 | 66 | 1 0 0 0 0 |
michael@0 | 67 | 0 0 1 0 0 |
michael@0 | 68 | 0 0 0 1 0" in="FillPaint"/> |
michael@0 | 69 | </filter> |
michael@0 | 70 | <mask id="boundingBox" maskContentUnits="objectBoundingBox"> |
michael@0 | 71 | <rect x="0" y="0" width="1" height="1" fill="white"/> |
michael@0 | 72 | </mask> |
michael@0 | 73 | <mask id="userSpace-atZero" maskContentUnits="userSpaceOnUse"> |
michael@0 | 74 | <rect x="0" y="0" width="100" height="100" fill="white"/> |
michael@0 | 75 | </mask> |
michael@0 | 76 | <mask id="userSpace-at100" maskContentUnits="userSpaceOnUse"> |
michael@0 | 77 | <rect x="100" y="100" width="100" height="100" fill="white"/> |
michael@0 | 78 | </mask> |
michael@0 | 79 | <g id="usedRect"> |
michael@0 | 80 | <rect class="fillColor" width="100" height="100"/> |
michael@0 | 81 | </g> |
michael@0 | 82 | </defs> |
michael@0 | 83 | <g transform="translate(40,40)"> |
michael@0 | 84 | <rect stroke-width="1" stroke="black" fill="none" x="99.5" y="99.5" width="101" height="101"/> |
michael@0 | 85 | |
michael@0 | 86 | <rect x="0" y="100" width="100" height="100" class="fillColor offsetContainer" id="rect"/> |
michael@0 | 87 | <use xlink:href="#usedRect" x="0" y="100" class="offsetContainer" id="use"/> |
michael@0 | 88 | <svg x="0" y="100" width="100" height="100" class="offsetContainer" id="innerSVG"> |
michael@0 | 89 | <rect class="fillColor" width="100" height="100"/> |
michael@0 | 90 | </svg> |
michael@0 | 91 | <foreignObject x="0" y="100" width="100" height="100" class="offsetContainer" id="foreignObject"> |
michael@0 | 92 | <svg width="100" height="100"> |
michael@0 | 93 | <rect class="fillColor" width="100" height="100"/> |
michael@0 | 94 | </svg> |
michael@0 | 95 | </foreignObject> |
michael@0 | 96 | </g> |
michael@0 | 97 | <script><![CDATA[ |
michael@0 | 98 | |
michael@0 | 99 | var options = { |
michael@0 | 100 | offsetContainer: "rect", |
michael@0 | 101 | filter: null, |
michael@0 | 102 | mask: null, |
michael@0 | 103 | updateOffsetOn: "reftestInvalidate" // | "initial" | "timeout" |
michael@0 | 104 | }; |
michael@0 | 105 | |
michael@0 | 106 | location.search.substr(1).split("&").forEach(function (s) { |
michael@0 | 107 | var pv = s.split("="); |
michael@0 | 108 | options[pv[0]] = pv[1] || true; |
michael@0 | 109 | }); |
michael@0 | 110 | |
michael@0 | 111 | var offsetContainer = document.getElementById(options.offsetContainer); |
michael@0 | 112 | |
michael@0 | 113 | function updateOffsetNow() { |
michael@0 | 114 | offsetContainer.setAttribute("x", "100"); |
michael@0 | 115 | } |
michael@0 | 116 | |
michael@0 | 117 | function updateOffsetOnReftestInvalidate() { |
michael@0 | 118 | document.documentElement.setAttribute("class", "reftest-wait"); |
michael@0 | 119 | document.addEventListener("MozReftestInvalidate", function () { |
michael@0 | 120 | updateOffsetNow(); |
michael@0 | 121 | document.documentElement.removeAttribute("class"); |
michael@0 | 122 | }, false); |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | function updateOffsetOnTimeout() { |
michael@0 | 126 | setTimeout(updateOffsetNow, 500); |
michael@0 | 127 | } |
michael@0 | 128 | |
michael@0 | 129 | options.updateOffset = options.updateOffsetOn == "initial" ? updateOffsetNow : |
michael@0 | 130 | (options.updateOffsetOn == "timeout" ? updateOffsetOnTimeout : |
michael@0 | 131 | updateOffsetOnReftestInvalidate); |
michael@0 | 132 | |
michael@0 | 133 | var offsetContainers = Array.prototype.slice.call(document.getElementsByClassName("offsetContainer"), 0); |
michael@0 | 134 | for (var i = 0; i < offsetContainers.length; i++) { |
michael@0 | 135 | if (offsetContainers[i] != offsetContainer) { |
michael@0 | 136 | offsetContainers[i].parentNode.removeChild(offsetContainers[i]); |
michael@0 | 137 | } |
michael@0 | 138 | } |
michael@0 | 139 | |
michael@0 | 140 | var fillColor = options.filter ? "red" : "lime"; |
michael@0 | 141 | if (options.filter) { |
michael@0 | 142 | offsetContainer.setAttribute("filter", "url(#" + options.filter + ")"); |
michael@0 | 143 | } |
michael@0 | 144 | if (options.mask) { |
michael@0 | 145 | offsetContainer.setAttribute("mask", "url(#" + options.mask + ")"); |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | var fillColors = document.getElementsByClassName("fillColor"); |
michael@0 | 149 | for (var j = 0; j < fillColors.length; j++) { |
michael@0 | 150 | fillColors[j].setAttribute("fill", fillColor); |
michael@0 | 151 | } |
michael@0 | 152 | |
michael@0 | 153 | options.updateOffset(); |
michael@0 | 154 | |
michael@0 | 155 | ]]></script> |
michael@0 | 156 | </svg> |