1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/svg/dynamic-clipPath-01.svg Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,125 @@ 1.4 +<!-- 1.5 + Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ 1.7 +--> 1.8 +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" 1.9 + class="reftest-wait" 1.10 + onload="startTest()" 1.11 + xmlns:xlink="http://www.w3.org/1999/xlink"> 1.12 + <title>Testing that dynamic changes to the element for a given ID are reflected in clip-path</title> 1.13 + <defs> 1.14 + <svg id="d"> 1.15 + <rect width="100%" height="50%" fill="lime"/> 1.16 + <rect y="50%" width="100%" height="50%" fill="red"/> 1.17 + </svg> 1.18 + </defs> 1.19 + 1.20 + <rect y="30%" width="100%" height="70%" fill="lime"/> 1.21 + 1.22 + <use xlink:href="#d" id="u1" x="10%" width="11%" height="100%" clip-path="url(#r1)"/> 1.23 + <script> 1.24 + // force frame construction; test that parsing "r1" after frame construction 1.25 + // is still bound to "u1" eventually 1.26 + var rect = document.getElementById("u1").getBoundingClientRect(); 1.27 + </script> 1.28 + <clipPath id="r1"> 1.29 + <rect width="100%" height="40%"/> 1.30 + </clipPath> 1.31 + 1.32 + <clipPath id="x"> 1.33 + <rect width="100%" height="40%"/> 1.34 + </clipPath> 1.35 + <use xlink:href="#d" id="u2" x="20%" width="11%" height="100%" clip-path="url(#r2)"/> 1.36 + 1.37 + <clipPath id="r3"> 1.38 + <rect width="100%" height="100%"/> 1.39 + </clipPath> 1.40 + <clipPath id="r3"> 1.41 + <rect width="100%" height="40%"/> 1.42 + </clipPath> 1.43 + <use xlink:href="#d" id="u3" x="30%" width="11%" height="100%" clip-path="url(#r3)"/> 1.44 + 1.45 + <clipPath id="r4"> 1.46 + <rect width="100%" height="100%"/> 1.47 + </clipPath> 1.48 + <clipPath id="r4"> 1.49 + <rect width="100%" height="40%"/> 1.50 + </clipPath> 1.51 + <use xlink:href="#d" id="u4" x="40%" width="11%" height="100%" clip-path="url(#r4)"/> 1.52 + 1.53 + <clipPath id="r5"> 1.54 + <rect width="100%" height="100%"/> 1.55 + </clipPath> 1.56 + <use xlink:href="#d" id="u5" x="50%" width="11%" height="100%" clip-path="url(#r5)"/> 1.57 + 1.58 + <clipPath id="r6"> 1.59 + <rect width="100%" height="100%"/> 1.60 + </clipPath> 1.61 + <clipPath id="r6-2"> 1.62 + <rect width="100%" height="40%"/> 1.63 + </clipPath> 1.64 + <use xlink:href="#d" id="u6" x="60%" width="11%" height="100%" clip-path="url(#r6)"/> 1.65 + 1.66 + <clipPath id="r7"> 1.67 + <rect width="100%" height="40%"/> 1.68 + </clipPath> 1.69 + <clipPath id="r7-2"> 1.70 + <rect width="100%" height="100%"/> 1.71 + </clipPath> 1.72 + <use xlink:href="#d" id="u7" x="70%" width="11%" height="100%" clip-path="url(#r7)"/> 1.73 + 1.74 + <clipPath id="r8-2"> 1.75 + <rect width="100%" height="40%"/> 1.76 + </clipPath> 1.77 + <clipPath id="r8"> 1.78 + <rect width="100%" height="100%"/> 1.79 + </clipPath> 1.80 + <use xlink:href="#d" id="u8" x="80%" width="11%" height="100%" clip-path="url(#r8)"/> 1.81 + 1.82 + <rect width="11%" height="100%" fill="lime"/> 1.83 + <rect x="90%" width="11%" height="100%" fill="lime"/> 1.84 + 1.85 + <script> 1.86 + function startTest() { 1.87 + document.addEventListener("MozReftestInvalidate", doTest, false); 1.88 + setTimeout(doTest, 4000); // fallback for running outside reftest 1.89 + } 1.90 + 1.91 + function doTest() { 1.92 + // check that changing an id to "r2" lets u2 find it 1.93 + var r2 = document.getElementById("x"); 1.94 + r2.setAttribute("id", "r2"); 1.95 + 1.96 + var rect = document.getElementById("u3").getBoundingClientRect(); 1.97 + // check that removing the bad r3 lets u3 find the good one 1.98 + var r3 = document.getElementById("r3"); 1.99 + r3.parentNode.removeChild(r3); 1.100 + 1.101 + // check that renaming the bad r4 lets u4 find the good one 1.102 + var r4 = document.getElementById("r4"); 1.103 + r4.removeAttribute("id"); 1.104 + 1.105 + // check that changing u5's reference works 1.106 + var u5 = document.getElementById("u5"); 1.107 + u5.setAttribute("clip-path", "url(#r1)"); 1.108 + 1.109 + // check that inserting a good element before the bad r6 works 1.110 + var r6 = document.getElementById("r6-2"); 1.111 + r6.parentNode.removeChild(r6); 1.112 + r6.setAttribute("id", "r6"); 1.113 + document.documentElement.insertBefore(r6, document.documentElement.firstChild); 1.114 + 1.115 + // check that inserting a bad element after a good one doesn't break anything 1.116 + var r7 = document.getElementById("r7-2"); 1.117 + r7.parentNode.removeChild(r7); 1.118 + r7.setAttribute("id", "r7"); 1.119 + document.documentElement.appendChild(r7); 1.120 + 1.121 + // check that renaming a good element to r8 works 1.122 + var r8 = document.getElementById("r8-2"); 1.123 + r8.setAttribute("id", "r8"); 1.124 + 1.125 + document.documentElement.removeAttribute("class"); 1.126 + } 1.127 + </script> 1.128 +</svg>