Fixed elements bounce when rubber-banding at the bottom of the page
[WebKit-https.git] / LayoutTests / fast / visual-viewport / rubberbanding-viewport-rects.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <script src="../../resources/js-test-pre.js"></script>
6     <style>
7         body {
8             height: 2000px;
9             width: 2000px;
10         }
11     </style>
12     <script>
13         description("This test scrolls the page and checks that the layout and visual viewports respond as expected.");
14
15         if (window.internals) {
16             internals.settings.setVisualViewportEnabled(true);
17             internals.settings.setAllowUnclampedScrollPosition(true);
18         }
19
20         window.jsTestIsAsync = true;
21
22         var visualViewport;
23         function doTest()
24         {
25             // Zooming may scroll the view away from the origin.
26             window.scrollTo(-123, -234);
27             visualViewport = internals.visualViewportRect();
28             layoutViewport = internals.layoutViewportRect();
29             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
30
31             // Don't use shouldBeEqualToString() to avoid showing failures when correct output differs between platforms.
32             evalAndLogResult("JSON.stringify(layoutViewport)");
33             evalAndLogResult("JSON.stringify(visualViewport)");
34
35             debug('');
36             window.scrollTo(475, 525);
37             visualViewport = internals.visualViewportRect();
38             layoutViewport = internals.layoutViewportRect();
39             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
40
41             evalAndLogResult("JSON.stringify(layoutViewport)");
42             evalAndLogResult("JSON.stringify(visualViewport)");
43
44             debug('');
45             window.scrollTo(1800, 1850);
46             visualViewport = internals.visualViewportRect();
47             layoutViewport = internals.layoutViewportRect();
48             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
49
50             evalAndLogResult("JSON.stringify(layoutViewport)");
51             evalAndLogResult("JSON.stringify(visualViewport)");
52
53             window.scrollTo(0, 0);
54
55             finishJSTest();
56         }
57         
58         window.addEventListener('load', doTest, false);
59     </script>
60 </head>
61 <body>
62     <script src="../../resources/js-test-post.js"></script>
63 </body>
64 </html>