[iOS WK2] Don't disable position:fixed when a form element has focus
[WebKit-https.git] / LayoutTests / fast / visual-viewport / ios / zoomed-focus-in-fixed.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
3 <html>
4 <head>
5     <meta name="viewport" content="initial-scale=1.0">
6     <style>
7         body {
8             width: 1000px;
9             height: 2000px;
10         }
11         .fixed {
12             position: fixed;
13             background-color: silver;
14             top: 10px;
15             padding: 10px;
16         }
17     </style>
18     <script>
19         if (window.testRunner) {
20             testRunner.waitUntilDone();
21             testRunner.dumpAsText();
22         }
23
24         function getScrollDownUIScript()
25         {
26             return `(function() {
27                 uiController.immediateScrollToOffset(0, 800);
28             })();`;
29         }
30         
31         function getFocusInputUIScript(x, y)
32         {
33             return `(function() {
34                 uiController.didShowKeyboardCallback = function() {
35                     uiController.uiScriptComplete();
36                 }
37                 
38                 uiController.singleTapAtPoint(${x}, ${y}, function() {});
39             })();`;
40         }
41
42         function runTest()
43         {
44             if (!window.testRunner || !testRunner.runUIScript)
45                 return;
46
47             testRunner.runUIScript(getScrollDownUIScript(), function() {
48                 window.setTimeout(function() {
49                     var rect = document.getElementById('input').getBoundingClientRect();
50                     // singleTapAtPoint takes document coordinates, so add scrollTop to clientRect.top.
51                     testRunner.runUIScript(getFocusInputUIScript(rect.left, rect.top + document.scrollingElement.scrollTop), function() {
52
53                         if (window.internals) {
54                             var output = 'Layout viewport: ' + JSON.stringify(internals.layoutViewportRect()) + '\nVisual viewport: ' + JSON.stringify(internals.visualViewportRect()) + '\n';
55                             document.getElementById('results').innerText = output;
56                         }
57
58                         testRunner.notifyDone();
59                     });
60                 }, 0);
61             });
62         }
63
64         window.addEventListener('load', runTest, false);
65     </script>
66 </head>
67 <body>
68 <pre id="results"></pre>
69 <div class="fixed">
70     <input id="input" type="text">
71 </div>
72 </body>
73 </html>