<html>
<body>
    <div id="outer" style="position: absolute; top: 50px; overflow: hidden; width: 100px; height: 100px; background-color: red;">
        <!-- removing this will make 'outer' the layout root -->
        <div style="position: absolute; top: 0;"></div>
        <div style="position: absolute; overflow: hidden; width: 100px; height: 100px;">
            <!-- removing this will make its parent a candidate layout
                 root. Since 'outer' is already a root, only the chain
                 from the parent to 'outer' should be marked. There are two
                 chains, positioned and normal (because of the static Y).
                 The bug was that because the existing root was the parent,
                 rather than a more distant ancestor on the normal chain, it
                 was skipped over and marking continued up to the view. -->
            <div></div>
        </div>
    </div>
    <script>
        function test() {
            document.body.offsetTop;
            document.getElementById("outer").style.display = "none";
        }

        test();
    </script>
</body>
</html>
