2 <body style="overflow:hidden" onload="test()">
3 <div id="other"> </div>
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; height:500px;" id="root">
10 <script type="text/javascript">
13 var svgroot = document.createElementNS("http://www.w3.org/2000/svg", "svg");
14 document.getElementById("root").appendChild(svgroot);
15 // 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");
17 redRect.setAttribute("fill", "red");
18 redRect.setAttribute("x", "50%");
19 redRect.setAttribute("y", "10");
20 redRect.setAttribute("width", "50%");
21 redRect.setAttribute("height", "50%");
22 svgroot.style.position = "absolute";
23 svgroot.style.top="0px";
24 svgroot.appendChild(redRect);
25 // add a green rectangle to the left of the red one
26 var greenRect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
27 greenRect.setAttribute("fill", "green");
28 greenRect.setAttribute("x", "0%");
29 greenRect.setAttribute("y", "10");
30 greenRect.setAttribute("width", "50%");
31 svgroot.appendChild(greenRect);
32 document.body.offsetLeft;
33 // dirty an SVG attribute
34 greenRect.setAttribute("height", "50%");
35 // make sure the svg root's .style attribute is out of date
36 svgroot.style.position = "absolute";
37 // force layout. this will be rooted at the RenderSVGRoot and will set m_posChildNeedsLayout on its
38 // containing RenderBlock (corresponding to DIV#root)
39 document.body.offsetWidth;
40 // dirty an SVG attribute, will set FrameView::m_layoutRoot to the RenderSVGRoot
41 greenRect.setAttribute("width", "50%");
42 // dirty a normal DOM attribute in a separate part of the DOM. this is where things go awry since
43 // FrameView::scheduleRelayoutOfSubtree will clear out its m_layoutRoot and call
44 // RenderObject::markContainingBlocksForLayout() on the RenderSVGRoot. Since the RenderSVGRoot's
45 // container already has m_posChildNeedsLayout set, the RenderSVGRoot's container's container
46 // (corresponding to the DIV#grandparent) will not have any needs layout flags set on it.
47 document.getElementById('other').style.width="500px";
48 // Run a layout pass. This will propagate the render tree up to the DIV#other's render object but
49 // will not traverse into the svg subtree at all since the DIV#grandparent's render object is
50 // not marked as needing layout.
51 document.body.offsetWidth;
52 // This goes into the void since the RenderSVGRoot is already marked as needsLayout but there is no
54 greenRect.setAttribute("x", "50%");