Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scrolling / scrolling-apis-nan-scroll-position.html
blob54875198ae4e5c8aa3d021f35e9524d6cc9b3bd0
1 <!DOCTYPE HTML>
2 <style>
4 body {
5 height: 30000px;
6 width: 30000px;
9 .spacer {
10 height: 1000px;
11 width: 1000px;
14 #scroller {
15 height: 100px;
16 width: 100px;
17 overflow: scroll;
19 </style>
21 <div id=scroller>
22 <div class=spacer></div>
23 </div>
25 <script src="../../resources/js-test.js"></script>
26 <script>
27 description("Verifies that nan scroll position works correctly.");
29 function scrollToNonFinite(x, y)
31 window.scrollTo(100, 100);
32 window.scrollTo(x, y);
33 shouldBe('window.scrollY', "0");
34 shouldBe('window.scrollX', "0");
36 window.scrollTo(100, 100);
37 window.scrollTo({top: y, left: x});
38 shouldBe('window.scrollY', "0");
39 shouldBe('window.scrollX', "0");
42 function scrollByNonFinite(x, y)
44 window.scrollTo(100, 100);
45 window.scrollBy(x, y);
46 shouldBe('window.scrollY', "100");
47 shouldBe('window.scrollX', "100");
49 window.scrollTo(100, 100);
50 window.scrollBy({top: y, left: x});
51 shouldBe('window.scrollY', "100");
52 shouldBe('window.scrollX', "100");
55 function scrollTopNonFinite(y)
57 scroller.scrollTop = 1;
58 shouldBe("scroller.scrollTop", "1");
59 scroller.scrollTop = y;
60 shouldBe("scroller.scrollTop", "0");
63 function scrollLeftNonFinite(x)
65 scroller.scrollLeft = 1;
66 shouldBe("scroller.scrollLeft", "1");
67 scroller.scrollLeft = x;
68 shouldBe("scroller.scrollLeft", "0");
71 function scroll()
73 window.scrollTo(1, 1);
74 shouldBe('window.scrollY', "1");
75 shouldBe('window.scrollX', "1");
77 scrollToNonFinite(window.NaN, window.NaN);
78 scrollToNonFinite(window.Infinity, window.Infinity);
79 scrollToNonFinite(0, window.Infinity);
80 scrollToNonFinite(-window.Infinity, -window.Infinity);
82 scrollByNonFinite(window.NaN, window.NaN);
83 scrollByNonFinite(window.Infinity, window.Infinity);
84 scrollByNonFinite(0, window.Infinity);
85 scrollByNonFinite(-window.Infinity, -window.Infinity);
87 scrollTopNonFinite(window.NaN);
88 scrollTopNonFinite(window.Infinity);
89 scrollTopNonFinite(-window.Infinity);
91 scrollLeftNonFinite(window.NaN);
92 scrollLeftNonFinite(window.Infinity);
93 scrollLeftNonFinite(-window.Infinity);
96 onload = function() {
97 if (window.eventSender)
98 scroll();
101 </script>