OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body style="overflow:hidden" onload="test()"> | 2 <body style="overflow:hidden" onload="test()"> |
3 <div id="other"> </div> | 3 <div id="other"> </div> |
4 <div> | 4 <div> |
5 <div style="position:absolute; top: 0px; overflow:hidden; width:500px; height:
500px;" id="grandparent"> | 5 <div style="position:absolute; top: 0px; overflow:hidden; width:500px; height:
500px;" id="grandparent"> |
6 <div style="position:absolute; top: 0px; overflow:hidden; width:500px; heigh
t:500px;" id="root"> | 6 <div style="position:absolute; top: 0px; overflow:hidden; width:500px; heigh
t:500px;" id="root"> |
7 </div> | 7 </div> |
8 </div> | 8 </div> |
9 </div> | 9 </div> |
10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
11 function test() { | 11 function test() { |
12 // create some SVG | 12 // create some SVG |
13 var svgroot = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | 13 var svgroot = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
| 14 svgroot.setAttribute("width", "100%"); |
| 15 svgroot.setAttribute("height", "100%"); |
14 document.getElementById("root").appendChild(svgroot); | 16 document.getElementById("root").appendChild(svgroot); |
15 // add a red rectangle that will be covered up by the green rectangle | 17 // add a red rectangle that will be covered up by the green rectangle |
16 var redRect = document.createElementNS("http://www.w3.org/2000/svg", "rect")
; | 18 var redRect = document.createElementNS("http://www.w3.org/2000/svg", "rect")
; |
17 redRect.setAttribute("fill", "red"); | 19 redRect.setAttribute("fill", "red"); |
18 redRect.setAttribute("x", "50%"); | 20 redRect.setAttribute("x", "50%"); |
19 redRect.setAttribute("y", "10"); | 21 redRect.setAttribute("y", "10"); |
20 redRect.setAttribute("width", "50%"); | 22 redRect.setAttribute("width", "50%"); |
21 redRect.setAttribute("height", "50%"); | 23 redRect.setAttribute("height", "50%"); |
22 svgroot.style.position = "absolute"; | 24 svgroot.style.position = "absolute"; |
23 svgroot.style.top="0px"; | 25 svgroot.style.top="0px"; |
(...skipping 25 matching lines...) Expand all Loading... |
49 // will not traverse into the svg subtree at all since the DIV#grandparent's
render object is | 51 // will not traverse into the svg subtree at all since the DIV#grandparent's
render object is |
50 // not marked as needing layout. | 52 // not marked as needing layout. |
51 document.body.offsetWidth; | 53 document.body.offsetWidth; |
52 // This goes into the void since the RenderSVGRoot is already marked as need
sLayout but there is no | 54 // This goes into the void since the RenderSVGRoot is already marked as need
sLayout but there is no |
53 // layout pending. | 55 // layout pending. |
54 greenRect.setAttribute("x", "50%"); | 56 greenRect.setAttribute("x", "50%"); |
55 } | 57 } |
56 </script> | 58 </script> |
57 </body> | 59 </body> |
58 | 60 |
OLD | NEW |