Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="reftest-wait" |
michael@0 | 6 | xmlns:xlink="http://www.w3.org/1999/xlink" onload="startTest()"> |
michael@0 | 7 | <title>Testing that dynamic changes to the element for a given ID are reflected in patterns</title> |
michael@0 | 8 | |
michael@0 | 9 | <rect id="u1" x="10%" width="11%" height="100%" fill="url(#r1)"/> |
michael@0 | 10 | <script> |
michael@0 | 11 | // force frame construction; test that parsing "r1" after frame construction |
michael@0 | 12 | // is still bound to "u1" eventually |
michael@0 | 13 | var rect = document.getElementById("u1").getBoundingClientRect(); |
michael@0 | 14 | </script> |
michael@0 | 15 | <pattern id="r1" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 16 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 17 | </pattern> |
michael@0 | 18 | |
michael@0 | 19 | <pattern id="x" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 20 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 21 | </pattern> |
michael@0 | 22 | <rect id="u2" x="20%" width="11%" height="100%" fill="url(#r2)"/> |
michael@0 | 23 | |
michael@0 | 24 | <pattern id="r3" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 25 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 26 | </pattern> |
michael@0 | 27 | <pattern id="r3" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 28 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 29 | </pattern> |
michael@0 | 30 | <rect id="u3" x="30%" width="11%" height="100%" fill="url(#r3)"/> |
michael@0 | 31 | |
michael@0 | 32 | <pattern id="r4" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 33 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 34 | </pattern> |
michael@0 | 35 | <pattern id="r4" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 36 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 37 | </pattern> |
michael@0 | 38 | <rect id="u4" x="40%" width="11%" height="100%" fill="url(#r4)"/> |
michael@0 | 39 | |
michael@0 | 40 | <pattern id="r5" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 41 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 42 | </pattern> |
michael@0 | 43 | <rect id="u5" x="50%" width="11%" height="100%" fill="url(#r5)"/> |
michael@0 | 44 | |
michael@0 | 45 | <pattern id="r6" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 46 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 47 | </pattern> |
michael@0 | 48 | <pattern id="r6-2" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 49 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 50 | </pattern> |
michael@0 | 51 | <rect id="u6" x="60%" width="11%" height="100%" fill="url(#r6)"/> |
michael@0 | 52 | |
michael@0 | 53 | <pattern id="r7" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 54 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 55 | </pattern> |
michael@0 | 56 | <pattern id="r7-2" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 57 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 58 | </pattern> |
michael@0 | 59 | <rect id="u7" x="70%" width="11%" height="100%" fill="url(#r7)"/> |
michael@0 | 60 | |
michael@0 | 61 | <pattern id="r8-2" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 62 | <rect width="100%" height="100%" fill="lime"/> |
michael@0 | 63 | </pattern> |
michael@0 | 64 | <pattern id="r8" width="100%" height="100%" patternUnits="userSpaceOnUse"> |
michael@0 | 65 | <rect width="100%" height="100%" fill="red"/> |
michael@0 | 66 | </pattern> |
michael@0 | 67 | <rect id="u8" x="80%" width="11%" height="100%" fill="url(#r8)"/> |
michael@0 | 68 | |
michael@0 | 69 | <rect width="11%" height="100%" fill="lime"/> |
michael@0 | 70 | <rect x="90%" width="11%" height="100%" fill="lime"/> |
michael@0 | 71 | |
michael@0 | 72 | <script> |
michael@0 | 73 | function startTest() { |
michael@0 | 74 | document.addEventListener("MozReftestInvalidate", doTest, false); |
michael@0 | 75 | setTimeout(doTest, 4000); // fallback for running outside reftest |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | function doTest() { |
michael@0 | 79 | // check that changing an id to "r2" lets u2 find it |
michael@0 | 80 | var r2 = document.getElementById("x"); |
michael@0 | 81 | r2.setAttribute("id", "r2"); |
michael@0 | 82 | |
michael@0 | 83 | var rect = document.getElementById("u3").getBoundingClientRect(); |
michael@0 | 84 | // check that removing the bad r3 lets u3 find the good one |
michael@0 | 85 | var r3 = document.getElementById("r3"); |
michael@0 | 86 | r3.parentNode.removeChild(r3); |
michael@0 | 87 | |
michael@0 | 88 | // check that renaming the bad r4 lets u4 find the good one |
michael@0 | 89 | var r4 = document.getElementById("r4"); |
michael@0 | 90 | r4.removeAttribute("id"); |
michael@0 | 91 | |
michael@0 | 92 | // check that changing u5's reference works |
michael@0 | 93 | var u5 = document.getElementById("u5"); |
michael@0 | 94 | u5.setAttribute("fill", "url(#r1)"); |
michael@0 | 95 | |
michael@0 | 96 | // check that inserting a good element before the bad r6 works |
michael@0 | 97 | var r6 = document.getElementById("r6-2"); |
michael@0 | 98 | r6.parentNode.removeChild(r6); |
michael@0 | 99 | r6.setAttribute("id", "r6"); |
michael@0 | 100 | document.documentElement.insertBefore(r6, document.documentElement.firstChild); |
michael@0 | 101 | |
michael@0 | 102 | // check that inserting a bad element after a good one doesn't break anything |
michael@0 | 103 | var r7 = document.getElementById("r7-2"); |
michael@0 | 104 | r7.parentNode.removeChild(r7); |
michael@0 | 105 | r7.setAttribute("id", "r7"); |
michael@0 | 106 | document.documentElement.appendChild(r7); |
michael@0 | 107 | |
michael@0 | 108 | // check that renaming a good element to r8 works |
michael@0 | 109 | var r8 = document.getElementById("r8-2"); |
michael@0 | 110 | r8.setAttribute("id", "r8"); |
michael@0 | 111 | |
michael@0 | 112 | document.documentElement.removeAttribute("class"); |
michael@0 | 113 | } |
michael@0 | 114 | </script> |
michael@0 | 115 | </svg> |