chromium/third_party/blink/web_tests/fast/dom/Element/scrollTop-scrollLeft-body.html

<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
  var count = 0;
  var iframeStrict1, iframeStrict2, iframeStrict3, iframeStrict4;
  var iframeQuirks1, iframeQuirks2, iframeQuirks3, iframeQuriks4;
  function verifyTest() {
    // Need to wait on all inner frames to load.
    if (count++ < 7)
        return;

    description('Test for scrollTop/Left and scrollingElement values of scrollable document.body in quirks and strict modes');

    iframeStrict1 = document.getElementById("strict1");
    iframeStrict2 = document.getElementById("strict2");
    iframeStrict3 = document.getElementById("strict3");
    iframeStrict4 = document.getElementById("strict4");
    iframeQuirks1 = document.getElementById("quirks1");
    iframeQuirks2 = document.getElementById("quirks2");
    iframeQuirks3 = document.getElementById("quirks3");
    iframeQuirks4 = document.getElementById("quirks4");

    shouldBe("iframeStrict1.contentDocument.scrollingElement", "iframeStrict1.contentDocument.documentElement");
    shouldBe("iframeStrict1.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeStrict1.contentDocument.documentElement.scrollLeft", "100");
    shouldBe("iframeStrict1.contentDocument.body.scrollTop", "200");
    shouldBe("iframeStrict1.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeStrict1.contentWindow.pageYOffset", "0");
    shouldBe("iframeStrict1.contentWindow.pageXOffset", "100");

    shouldBeNull("iframeQuirks1.contentDocument.scrollingElement");
    shouldBe("iframeQuirks1.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeQuirks1.contentDocument.documentElement.scrollLeft", "0");
    shouldBe("iframeQuirks1.contentDocument.body.scrollTop", "200");
    shouldBe("iframeQuirks1.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeQuirks1.contentWindow.pageYOffset", "0");
    shouldBe("iframeQuirks1.contentWindow.pageXOffset", "0");

    shouldBe("iframeStrict2.contentDocument.scrollingElement", "iframeStrict2.contentDocument.documentElement");
    shouldBe("iframeStrict2.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeStrict2.contentDocument.documentElement.scrollLeft", "100");
    shouldBe("iframeStrict2.contentDocument.body.scrollTop", "0");
    shouldBe("iframeStrict2.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeStrict2.contentWindow.pageYOffset", "0");
    shouldBe("iframeStrict2.contentWindow.pageXOffset", "100");

    shouldBeNull("iframeQuirks2.contentDocument.scrollingElement");
    shouldBe("iframeQuirks2.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeQuirks2.contentDocument.documentElement.scrollLeft", "0");
    shouldBe("iframeQuirks2.contentDocument.body.scrollTop", "0");
    shouldBe("iframeQuirks2.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeQuirks2.contentWindow.pageYOffset", "0");
    shouldBe("iframeQuirks2.contentWindow.pageXOffset", "0");

    shouldBe("iframeStrict3.contentDocument.scrollingElement", "iframeStrict3.contentDocument.documentElement");
    shouldBe("iframeStrict3.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeStrict3.contentDocument.documentElement.scrollLeft", "100");
    shouldBe("iframeStrict3.contentDocument.body.scrollTop", "200");
    shouldBe("iframeStrict3.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeStrict3.contentWindow.pageYOffset", "0");
    shouldBe("iframeStrict3.contentWindow.pageXOffset", "100");

    shouldBeNull("iframeQuirks3.contentDocument.scrollingElement");
    shouldBe("iframeQuirks3.contentDocument.documentElement.scrollTop", "0");
    shouldBe("iframeQuirks3.contentDocument.documentElement.scrollLeft", "0");
    shouldBe("iframeQuirks3.contentDocument.body.scrollTop", "200");
    shouldBe("iframeQuirks3.contentDocument.body.scrollLeft", "0");
    shouldBe("iframeQuirks3.contentWindow.pageYOffset", "0");
    shouldBe("iframeQuirks3.contentWindow.pageXOffset", "0");

    shouldBe("iframeStrict4.contentDocument.scrollingElement", "iframeStrict4.contentDocument.documentElement");
    shouldBe("iframeStrict4.contentDocument.body.scrollTop", "0");
    shouldBe("iframeStrict4.contentDocument.body.scrollLeft", "0");

    shouldBe("iframeQuirks4.contentDocument.scrollingElement", "iframeQuirks4.contentDocument.body");
    shouldBe("iframeQuirks4.contentDocument.body.scrollTop", "4000");
    shouldBe("iframeQuirks4.contentDocument.body.scrollLeft", "3000");

    finishJSTest();
  }
  var jsTestIsAsync = true;
</script>

<iframe id="strict1" src="resources/overflow-scroll-scrollable-body-strict.html"></iframe>
<iframe id="quirks1" src="resources/overflow-scroll-scrollable-body-quirks.html"></iframe>
<iframe id="strict2" src="resources/overflow-scroll-non-scrollable-body-strict.html"></iframe>
<iframe id="quirks2" src="resources/overflow-scroll-non-scrollable-body-quirks.html"></iframe>
<iframe id="strict3" src="resources/overflow-hidden-scrollable-body-strict.html"></iframe>
<iframe id="quirks3" src="resources/overflow-hidden-scrollable-body-quirks.html"></iframe>
<iframe id="strict4" src="resources/display-none-body-strict.html"></iframe>
<iframe id="quirks4" src="resources/display-none-body-quirks.html"></iframe>