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 480 360" 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 480 360" 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 <defs id="defs"> | 5 <defs id="defs"> |
6 <marker id="markerStart" viewBox="0 0 10 10" markerWidth="2" markerHeight="2
" refX="5" refY="5" markerUnits="strokeWidth"> | 6 <marker id="markerStart" viewBox="0 0 10 10" markerWidth="2" markerHeight="2
" refX="5" refY="5" markerUnits="strokeWidth"> |
7 <rect width="10" height="10" fill="red" stroke="none"/> | 7 <rect width="10" height="10" fill="red" stroke="none"/> |
8 </marker> | 8 </marker> |
9 <marker id="markerEnd" viewBox="0 0 10 10" markerWidth="2" markerHeight="2"
refX="5" refY="5" markerUnits="strokeWidth"> | 9 <marker id="markerEnd" viewBox="0 0 10 10" markerWidth="2" markerHeight="2"
refX="5" refY="5" markerUnits="strokeWidth"> |
10 <path d="M 5 0 L 10 10 L 0 10 Z" fill="blue" stroke="none"/> | 10 <path d="M 5 0 L 10 10 L 0 10 Z" fill="blue" stroke="none"/> |
11 </marker> | 11 </marker> |
12 </defs> | 12 </defs> |
13 | 13 |
14 <g id="content"/> | 14 <g id="content"/> |
15 | 15 |
16 <script> | 16 <script> |
17 window.testIsAsync = true; | 17 window.testIsAsync = true; |
18 var defs = document.getElementById("defs"); | 18 var defs = document.getElementById("defs"); |
19 var content = document.getElementById("content"); | 19 var content = document.getElementById("content"); |
20 | 20 |
21 function repaintTest() { | 21 function repaintTest() { |
22 setTimeout(createObject, 0); | 22 requestAnimationFrame(createObject); |
23 } | 23 } |
24 | 24 |
25 function createObject() | 25 function createObject() |
26 { | 26 { |
27 var path = document.createElementNS("http://www.w3.org/2000/svg", "path"
); | 27 var path = document.createElementNS("http://www.w3.org/2000/svg", "path"
); |
28 path.setAttribute("fill", "none"); | 28 path.setAttribute("fill", "none"); |
29 path.setAttribute("stroke", "black"); | 29 path.setAttribute("stroke", "black"); |
30 path.setAttribute("stroke-width", "8"); | 30 path.setAttribute("stroke-width", "8"); |
31 path.setAttribute("marker-start", "url(#markerStart)"); | 31 path.setAttribute("marker-start", "url(#markerStart)"); |
32 path.setAttribute("marker-mid", "url(#markerMiddle)"); | 32 path.setAttribute("marker-mid", "url(#markerMiddle)"); |
33 path.setAttribute("marker-end", "url(#markerEnd)"); | 33 path.setAttribute("marker-end", "url(#markerEnd)"); |
34 path.setAttribute("d", "M 130 135 L 180 135 L 180 185"); | 34 path.setAttribute("d", "M 130 135 L 180 135 L 180 185"); |
35 | 35 |
36 content.appendChild(path); | 36 content.appendChild(path); |
37 setTimeout(createMarker, 0); | 37 requestAnimationFrame(createMarker); |
38 } | 38 } |
39 | 39 |
40 function createMarker() | 40 function createMarker() |
41 { | 41 { |
42 var marker = document.createElementNS("http://www.w3.org/2000/svg", "mar
ker"); | 42 var marker = document.createElementNS("http://www.w3.org/2000/svg", "mar
ker"); |
43 marker.setAttribute("id", "markerMiddle"); | 43 marker.setAttribute("id", "markerMiddle"); |
44 marker.setAttribute("viewBox", "0 0 10 10"); | 44 marker.setAttribute("viewBox", "0 0 10 10"); |
45 marker.setAttribute("markerWidth", "2"); | 45 marker.setAttribute("markerWidth", "2"); |
46 marker.setAttribute("markerHeight", "2"); | 46 marker.setAttribute("markerHeight", "2"); |
47 marker.setAttribute("refX", "5"); | 47 marker.setAttribute("refX", "5"); |
48 marker.setAttribute("refY", "5"); | 48 marker.setAttribute("refY", "5"); |
49 marker.setAttribute("markerUnits", "strokeWidth"); | 49 marker.setAttribute("markerUnits", "strokeWidth"); |
50 | 50 |
51 var circle = document.createElementNS("http://www.w3.org/2000/svg", "cir
cle"); | 51 var circle = document.createElementNS("http://www.w3.org/2000/svg", "cir
cle"); |
52 circle.setAttribute("cx", "5"); | 52 circle.setAttribute("cx", "5"); |
53 circle.setAttribute("cy", "5"); | 53 circle.setAttribute("cy", "5"); |
54 circle.setAttribute("r", "5"); | 54 circle.setAttribute("r", "5"); |
55 circle.setAttribute("fill", "green"); | 55 circle.setAttribute("fill", "green"); |
56 circle.setAttribute("stroke", "none"); | 56 circle.setAttribute("stroke", "none"); |
57 | 57 |
58 marker.appendChild(circle); | 58 marker.appendChild(circle); |
59 defs.appendChild(marker); | 59 defs.appendChild(marker); |
60 | 60 |
61 finishRepaintTest(); | 61 finishRepaintTest(); |
62 } | 62 } |
63 </script> | 63 </script> |
64 | 64 |
65 </svg> | 65 </svg> |
OLD | NEW |