<html>
<head id="head">
    <script>
        function test()
        {
            if (window.testRunner)
                testRunner.dumpAsText();

            var target = document.getElementById("target");
            getSelection().setBaseAndExtent(target, 0, target, 0);
            document.body.offsetTop;

            var head = document.getElementById("head");
            var link = document.createElement("link");
            link.setAttribute("href", "data:text/css,");
            link.setAttribute("rel", "stylesheet");
            // This will increase the pending stylesheet count
            head.appendChild(link);
            // This will require layout
            foo.style.width = "100px";
        }
    </script>
</head>
<body onload="test()">
    <p>
        Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14118">http://bugs.webkit.org/show_bug.cgi?id=14118</a>
        ASSERTION FAILED: !needsLayout() seen again</i>.
    </p>
    <p>
        No assertion failure here means SUCCESS.
    </p>
    <div id="target">This is something to select</div>
    <div id="foo"></div>
</body>
</html>
