blob: aab7e0f1e0b44c586c519c9fb03ac3bf550e8897 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<style>
body {
height: 100%;
}
.fixed {
position: fixed;
background-color: silver;
bottom: 0;
padding: 10px;
}
</style>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
function getFocusInputUIScript(x, y)
{
return `(function() {
uiController.didEndZoomingCallback = function() {
uiController.uiScriptComplete();
}
uiController.singleTapAtPoint(${x}, ${y}, function() {});
})();`;
}
function runTest()
{
if (!window.testRunner || !testRunner.runUIScript)
return;
var rect = document.getElementById('input').getBoundingClientRect();
// singleTapAtPoint takes document coordinates, so add scrollTop to clientRect.top.
testRunner.runUIScript(getFocusInputUIScript(rect.left, rect.top + document.scrollingElement.scrollTop), function() {
var output = 'Layout viewport: ' + JSON.stringify(internals.layoutViewportRect()) + '\nVisual viewport: ' + JSON.stringify(internals.visualViewportRect()) + '\n';
document.getElementById('results').innerText = output;
testRunner.notifyDone();
});
}
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
<pre id="results"></pre>
<div class="fixed">
<input id="input" type="text">
</div>
</body>
</html>