summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/layout/common-ancestor-relayout-boundary.html
blob: 3694ff48531b46873e4b18014ee120c370597b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<style>
/* Make all divs relayout boundaries. */
div {
    width: 100px;
    height: 100px;
    overflow: hidden;
}
</style>
<div id="relayout-common-ancestor"><div><div></div></div><div><div></div></div></div>
<script>
function dirtyLayout()
{
    var container = document.getElementById('relayout-common-ancestor');
    for (var i = 0; i < container.childNodes.length; ++i) {
        var child = container.childNodes[i].firstChild;
        child.style.width = "99px";
        // Force a style recalc that doesn't force a layout so that the
        // needsLayout count is incremented.
        getComputedStyle(child).color;
    }
}

document.documentElement.offsetTop;

// Pass quiet=true here so that the added nodes from the shouldBe don't
// mess up the needsLayoutCount on line 45.
if (window.internals)
    shouldBe("window.internals.needsLayoutCount()", "0", true);

dirtyLayout();

// The tree appears as following, with the starred nodes dirty:
//       div [relayout-common-ancestor]
//      /   \
//   *div  *div
//    /      /
// *div   *div
if (window.internals)
    shouldBe("window.internals.needsLayoutCount()", "4");

document.documentElement.offsetTop;

if (window.internals)
    shouldBe("window.internals.needsLayoutCount()", "0");
</script>