blob: 420004eb574547222917d99760678efe559067ad [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="initial-scale=0.5">
<style>
button {
display: block;
}
iframe {
margin-top: 800px;
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.internals)
internals.settings.setFrameFlattening("FullyEnabled")
function pageDidScroll()
{
document.getElementById('result').textContent = 'FAIL: page scrolled to ' + document.scrollingElement.scrollTop;
}
function doTest()
{
window.setTimeout(function() {
document.getElementById('frame').contentDocument.getElementById('input').focus();
}, 0);
// Wait for any scroll to happen.
window.setTimeout(function() {
if (window.testRunner)
testRunner.notifyDone();
}, 100);
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body onscroll="pageDidScroll()">
<p>Tests that a programmatic focus should not scroll into view</p>
<div id="result">
PASS: page did not scroll.
</div>
<iframe id="frame" srcdoc="<style>input { margin: 400px 20px; }</style>
<input id='input' type='text'>
"></iframe>
</body>
</html>