OLD | NEW |
1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics
/SVG/1.1/DTD/svg11-basic.dtd"> | 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics
/SVG/1.1/DTD/svg11-basic.dtd"> |
3 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" id="svg-root" width="100%" height="100%" viewBox="0 0 800 600" onload="runRe
paintAndPixelTest()"> | 3 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" id="svg-root" width="100%" height="100%" viewBox="0 0 800 600" onload="runRe
paintAndPixelTest()"> |
4 <script xlink:href="../../fast/repaint/resources/text-based-repaint.js"/> | 4 <script xlink:href="../../fast/repaint/resources/text-based-repaint.js"/> |
5 | 5 |
6 <g id="content"/> | 6 <g id="content"/> |
7 | 7 |
8 <script> | 8 <script> |
9 window.testIsAsync = true; | 9 window.testIsAsync = true; |
10 var content = document.getElementById("content"); | 10 var content = document.getElementById("content"); |
11 | 11 |
12 function repaintTest() { | 12 function repaintTest() { |
13 setTimeout(createObject, 0); | 13 // FIXME: we need a better way of waiting for layout/repainting to happe
n |
| 14 setTimeout(createObject, 1); |
14 } | 15 } |
15 | 16 |
16 function createObject() | 17 function createObject() |
17 { | 18 { |
18 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); | 19 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); |
19 rect.setAttribute("width", "800"); | 20 rect.setAttribute("width", "800"); |
20 rect.setAttribute("height", "100"); | 21 rect.setAttribute("height", "100"); |
21 rect.setAttribute("y", "100"); | 22 rect.setAttribute("y", "100"); |
22 rect.setAttribute("fill", "blue"); | 23 rect.setAttribute("fill", "blue"); |
23 rect.setAttribute("mask", "url(#dynMask)"); | 24 rect.setAttribute("mask", "url(#dynMask)"); |
24 | 25 |
25 content.appendChild(rect); | 26 content.appendChild(rect); |
26 setTimeout(createMask, 0); | 27 // FIXME: we need a better way of waiting for layout/repainting to happe
n |
| 28 setTimeout(createMask, 1); |
27 } | 29 } |
28 | 30 |
29 function createMask() | 31 function createMask() |
30 { | 32 { |
31 var mask = document.createElementNS("http://www.w3.org/2000/svg", "mask"
); | 33 var mask = document.createElementNS("http://www.w3.org/2000/svg", "mask"
); |
32 mask.setAttribute("id", "dynMask"); | 34 mask.setAttribute("id", "dynMask"); |
33 mask.setAttribute("maskUnits", "userSpaceOnUse"); | 35 mask.setAttribute("maskUnits", "userSpaceOnUse"); |
34 mask.setAttribute("x", "0"); | 36 mask.setAttribute("x", "0"); |
35 mask.setAttribute("y", "0"); | 37 mask.setAttribute("y", "0"); |
36 mask.setAttribute("width", "800"); | 38 mask.setAttribute("width", "800"); |
37 mask.setAttribute("height", "300"); | 39 mask.setAttribute("height", "300"); |
38 | 40 |
39 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); | 41 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); |
40 rect.setAttribute("width", "800"); | 42 rect.setAttribute("width", "800"); |
41 rect.setAttribute("height", "300"); | 43 rect.setAttribute("height", "300"); |
42 rect.setAttribute("fill", "red"); | 44 rect.setAttribute("fill", "red"); |
43 | 45 |
44 mask.appendChild(rect); | 46 mask.appendChild(rect); |
45 content.appendChild(mask); | 47 content.appendChild(mask); |
46 | 48 |
47 finishRepaintTest(); | 49 finishRepaintTest(); |
48 } | 50 } |
49 </script> | 51 </script> |
50 | 52 |
51 </svg> | 53 </svg> |
OLD | NEW |