OLD | NEW |
1 <?xml version="1.0" encoding="utf-8"?> | 1 <?xml version="1.0" encoding="utf-8"?> |
2 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" onload="runRepaintAndPixelTest()"> | 2 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" onload="runRepaintAndPixelTest()"> |
3 <script xlink:href="../../fast/repaint/resources/text-based-repaint.js"/> | 3 <script xlink:href="../../fast/repaint/resources/text-based-repaint.js"/> |
4 <script> | 4 <script> |
| 5 window.testIsAsync = true; |
5 function draw(x, y) { | 6 function draw(x, y) { |
6 var maskrect = document.getElementById("maskRect"); | 7 var maskrect = document.getElementById("maskRect"); |
7 maskrect.setAttribute("transform", "translate(" + x + "," + y + ")"); | 8 maskrect.setAttribute("transform", "translate(" + x + "," + y + ")"); |
8 | 9 |
9 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); | 10 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); |
10 rect.setAttribute("x", x); | 11 rect.setAttribute("x", x); |
11 rect.setAttribute("y", y); | 12 rect.setAttribute("y", y); |
12 rect.setAttribute("width", 453); | 13 rect.setAttribute("width", 453); |
13 rect.setAttribute("height", 299); | 14 rect.setAttribute("height", 299); |
14 rect.setAttribute("fill", "green"); | 15 rect.setAttribute("fill", "green"); |
15 rect.setAttribute("mask", "url(#mask)"); | 16 rect.setAttribute("mask", "url(#mask)"); |
16 | 17 |
17 var root = document.getElementById("root"); | 18 var root = document.getElementById("root"); |
18 while (root.firstChild) { | 19 while (root.firstChild) { |
19 root.removeChild(root.firstChild); | 20 root.removeChild(root.firstChild); |
20 } | 21 } |
21 root.appendChild(rect); | 22 root.appendChild(rect); |
22 } | 23 } |
23 | 24 |
24 function repaintTest() { | 25 function repaintTest() { |
25 if (window.testRunner) | |
26 testRunner.waitUntilDone(); | |
27 | |
28 draw(150, 50); | 26 draw(150, 50); |
29 requestAnimationFrame(function() { | 27 requestAnimationFrame(function() { |
30 draw(50, 50); | 28 draw(50, 50); |
31 if (window.testRunner) | 29 finishRepaintTest(); |
32 testRunner.notifyDone(); | |
33 }); | 30 }); |
34 } | 31 } |
35 | 32 |
36 </script> | 33 </script> |
37 <defs> | 34 <defs> |
38 <mask id="mask" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse"> | 35 <mask id="mask" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse"> |
39 <rect id="maskRect" x="50" y="50" width="460" height="316" fill="white" /> | 36 <rect id="maskRect" x="50" y="50" width="460" height="316" fill="white" /> |
40 </mask> | 37 </mask> |
41 </defs> | 38 </defs> |
42 <g id="root"> | 39 <g id="root"> |
43 <rect x="50" y="50" width="453" height="299" fill="green" mask="url(#mask)"/
> | 40 <rect x="50" y="50" width="453" height="299" fill="green" mask="url(#mask)"/
> |
44 </g> | 41 </g> |
45 </svg> | 42 </svg> |
OLD | NEW |