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 requestAnimationFrame(createObject); |
14 } | 14 } |
15 | 15 |
16 function createObject() | 16 function createObject() |
17 { | 17 { |
18 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); | 18 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); |
19 rect.setAttribute("width", "800"); | 19 rect.setAttribute("width", "800"); |
20 rect.setAttribute("height", "100"); | 20 rect.setAttribute("height", "100"); |
21 rect.setAttribute("y", "100"); | 21 rect.setAttribute("y", "100"); |
22 rect.setAttribute("fill", "blue"); | 22 rect.setAttribute("fill", "blue"); |
23 rect.setAttribute("mask", "url(#dynMask)"); | 23 rect.setAttribute("mask", "url(#dynMask)"); |
24 | 24 |
25 content.appendChild(rect); | 25 content.appendChild(rect); |
26 setTimeout(createMask, 0); | 26 requestAnimationFrame(createMask); |
27 } | 27 } |
28 | 28 |
29 function createMask() | 29 function createMask() |
30 { | 30 { |
31 var mask = document.createElementNS("http://www.w3.org/2000/svg", "mask"
); | 31 var mask = document.createElementNS("http://www.w3.org/2000/svg", "mask"
); |
32 mask.setAttribute("id", "dynMask"); | 32 mask.setAttribute("id", "dynMask"); |
33 mask.setAttribute("maskUnits", "userSpaceOnUse"); | 33 mask.setAttribute("maskUnits", "userSpaceOnUse"); |
34 mask.setAttribute("x", "0"); | 34 mask.setAttribute("x", "0"); |
35 mask.setAttribute("y", "0"); | 35 mask.setAttribute("y", "0"); |
36 mask.setAttribute("width", "800"); | 36 mask.setAttribute("width", "800"); |
37 mask.setAttribute("height", "300"); | 37 mask.setAttribute("height", "300"); |
38 | 38 |
39 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); | 39 var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"
); |
40 rect.setAttribute("width", "800"); | 40 rect.setAttribute("width", "800"); |
41 rect.setAttribute("height", "300"); | 41 rect.setAttribute("height", "300"); |
42 rect.setAttribute("fill", "red"); | 42 rect.setAttribute("fill", "red"); |
43 | 43 |
44 mask.appendChild(rect); | 44 mask.appendChild(rect); |
45 content.appendChild(mask); | 45 content.appendChild(mask); |
46 | 46 |
47 finishRepaintTest(); | 47 finishRepaintTest(); |
48 } | 48 } |
49 </script> | 49 </script> |
50 | 50 |
51 </svg> | 51 </svg> |
OLD | NEW |