chromium/third_party/blink/web_tests/fast/dom/partial-layout-block.html

<!DOCTYPE HTML>
<html>
<script>
if (window.internals)
    internals.useMockOverlayScrollbars();
</script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<link rel="stylesheet" href="../../resources/testharness.css">
<head>
<style>
html, body {
    margin: 0;
    padding: 0;
}

#measure {
    margin: 10px;
    padding: 10px;
}

#fixedsize {
    width: 100px;
    height: 100px;
}
</style>
</head>
<body>
<div id="measure"><div id="fixedsize"></div></div>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    test(function() {
        var measure = document.getElementById('measure');

        // Record partial layout values for offset*.
        var measureWidth = measure.offsetWidth;
        var measureHeight = measure.offsetHeight;
        var measureTop = measure.offsetTop;
        var measureLeft = measure.offsetLeft;

        // Invalidate measure and force a full layout.
        var child = measure.firstChild;
        measure.removeChild(child);
        document.body.clientHeight;
        measure.appendChild(child);
        var forceLayout = document.body.clientHeight;

        var childOffsetTop = child.offsetTop;

        assert_equals(measureWidth, document.body.offsetWidth - 20);
        assert_equals(measureHeight, measure.offsetHeight);
        assert_equals(measureTop, childOffsetTop - 10);
        assert_equals(measureLeft, measure.offsetLeft);
    }, 'Test that partial layout works for offset{width, height, left, top} methods.');
</script>
</body>
</html>