summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/Document/scrollingElement-noLayout-quirks.html
blob: 8c270c84fda39b79006fb6b2d05ed4f0f34cbf72 (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
<!-- NOTE: Quirks mode document -->
<style>
  body {
    overflow: scroll;
    height: 500px;
    width: 500px;
  }
  #spacer {
    height: 10000px;
  }
</style>
<html>
    <body>
      <div id=spacer></div>
    </body>
</html>
<script src="../../../resources/js-test.js"></script>
<script>
    description('Verify that document.scrollingElement updates style in quirks mode without triggering layout');
    setPrintTestResultsLazily();

    document.body.offsetTop;
    shouldBe("internals.needsLayoutCount()", "0");

    document.body.style.padding = "10px";
    shouldBe("document.scrollingElement", "document.body");
    debug("Verifying layout hasn't been triggered");
    shouldBe("internals.needsLayoutCount()", "3");
    debug("But style update was");
    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "0");

    document.documentElement.style.overflow = "scroll";

    // Workaround crbug.com/486034 to foce body style to be considered dirty
    document.body.style.padding = "8px";

    debug("Verify style change is reflected - body is now a real scrolling block element");
    shouldBeNull("document.scrollingElement");
    debug("Verifying layout still hasn't been triggered");
    shouldBe("internals.needsLayoutCount()", "3");
</script>