summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode.html
blob: bbf45c5590617d2af73668231842d9a4a2f9d63d (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html>
<head>
  <style>
    #content {
      width: 7500px;
      height: 7500px;
      background-color: blue;
    }
  </style>
  <script src="../../resources/js-test.js"></script>
  <script>
    onload = function() {
      description('Test that calling scroll methods on the body element scrolls the viewport in quirks mode');

      debug('Test that "scroll" on the document element does not scroll');
      document.documentElement.scroll(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scrollTo" on the document element does not scroll');
      document.documentElement.scrollTo(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scrollBy" on the document element does not scroll');
      document.documentElement.scrollBy(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scroll" on the body element scrolls');
      document.body.scroll(50, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "100");
      shouldBe("document.body.scrollLeft", "50");

      debug('');
      debug('Test that "scrollTo" on the body element scrolls');
      document.body.scrollTo(450, 200);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "200");
      shouldBe("document.body.scrollLeft", "450");

      debug('');
      debug('Test that "scrollBy" on the body element scrolls');
      document.body.scrollBy(300, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "300");
      shouldBe("document.body.scrollLeft", "750");
    }
  </script>
</head>

<body>
  <div id="content"></div>
</body>
</html>