Fixed elements bounce when rubber-banding at the bottom of the page
[WebKit-https.git] / LayoutTests / fast / visual-viewport / rubberbanding-viewport-rects-extended-background.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 with extended backgrounds enabled 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             internals.settings.setBackgroundShouldExtendBeyondPage(true);
19         }
20
21         window.jsTestIsAsync = true;
22
23         var visualViewport;
24         function doTest()
25         {
26             // Zooming may scroll the view away from the origin.
27             window.scrollTo(-123, -234);
28             visualViewport = internals.visualViewportRect();
29             layoutViewport = internals.layoutViewportRect();
30             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
31
32             // Don't use shouldBeEqualToString() to avoid showing failures when correct output differs between platforms.
33             evalAndLogResult("JSON.stringify(layoutViewport)");
34             evalAndLogResult("JSON.stringify(visualViewport)");
35
36             debug('');
37             window.scrollTo(475, 525);
38             visualViewport = internals.visualViewportRect();
39             layoutViewport = internals.layoutViewportRect();
40             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
41
42             evalAndLogResult("JSON.stringify(layoutViewport)");
43             evalAndLogResult("JSON.stringify(visualViewport)");
44
45             debug('');
46             window.scrollTo(1800, 1850);
47             visualViewport = internals.visualViewportRect();
48             layoutViewport = internals.layoutViewportRect();
49             debug('Scrolled to ' + window.scrollX + ', ' + window.scrollY);
50
51             evalAndLogResult("JSON.stringify(layoutViewport)");
52             evalAndLogResult("JSON.stringify(visualViewport)");
53
54             window.scrollTo(0, 0);
55
56             finishJSTest();
57         }
58         
59         window.addEventListener('load', doTest, false);
60     </script>
61 </head>
62 <body>
63     <script src="../../resources/js-test-post.js"></script>
64 </body>
65 </html>