blob: df604688c1809939a5eb9f5aea1f0bcd74d90114 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<style>
#overflowing {
width: 200px;
height: 200px;
margin: 10px;
border: 1px solid black;
overflow: scroll;
}
.content {
height: 400px;
background-image: linear-gradient(white, gray)
}
</style>
<script src="../../resources/ui-helper.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function logResult(s)
{
document.getElementById('result').textContent += s + "\n";
}
var scrollTopBeforeScroll;
var scrollTopAfterScroll;
function divScrolled()
{
scrollTopAfterScroll = document.getElementById('overflowing').scrollTop;
}
async function testScrollability()
{
var divTarget = document.getElementById('overflowing');
var divBounds = divTarget.getBoundingClientRect();
scrollTopBeforeScroll = divTarget.scrollTop;
logResult('Sending mouseWheel events');
await UIHelper.mouseWheelScrollAt(divBounds.left + 10, divBounds.top + 10, 0, -1, 0, -1);
if (scrollTopAfterScroll > scrollTopBeforeScroll)
logResult('PASS: mouseWheel caused scrolling');
else
logResult('FAIL; mouseWheel did not scroll; scrollTop is ' + scrollTopAfterScroll + ', was ' + scrollTopBeforeScroll);
}
async function startTest()
{
if (!window.eventSender) {
logResult('This test must be run in DumpRenderTree/WebKitTestRunner');
return;
}
await testScrollability();
setTimeout(() => {
logResult('\nNavigating forward then back\n');
window.location.href = "data:text/html,<body onload='history.back()'></body>";
}, 0);
}
var showCount = 0;
async function pageShowed()
{
if (++showCount == 2) {
await testScrollability();
testRunner.notifyDone();
}
}
window.addEventListener('load', startTest, false);
window.addEventListener('pageshow', pageShowed, false);
</script>
</head>
<body>
<div id="overflowing" onscroll="divScrolled()">
<div class="content">
</div>
</div>
<pre id="result"></pre>
</body>
</html>