blob: 4f0736504c823840bb6aca11c8d834754a4ed6a0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head><title>Tests that a momentum scroll (i.e. a fling) eventually resets back to no-overhang state</title></head>
<body>
<div id="box" style="height:800px; background: red; border:2px solid black; width:100%"></div>
<div id="info">This test requires DRT.</div>
<script>
if (window.internals) {
document.getElementById('info').style.visibility = 'hidden';
internals.settings.setMockScrollbarsEnabled(false);
eventSender.mouseMoveTo(10, 10);
eventSender.mouseDragBegin();
eventSender.mouseDragEnd();
// Simulate a momentum scroll following the end of a normal scroll.
eventSender.mouseMomentumBegin();
eventSender.mouseMomentumScrollBy(0, 250, false, true);
eventSender.mouseMomentumEnd();
// The momentum scroll above should have resulted in overflow above the page.
// Ensure that it has (via scrollTop) and register an onscroll listener to
// ensure that the timer restores the position.
if (document.documentElement.scrollTop == 0) {
// FAIL: Above didn't result in overscroll.
document.getElementById('box').style.background = 'blue';
return;
}
document.getElementById('box').style.background = 'green';
// Wait for the timer to restore the position.
testRunner.waitUntilDone();
var startedScrolling = false;
window.onscroll = function() {
if (document.documentElement.scrollTop == 0) {
testRunner.notifyDone();
}
};
}
</script>
</body>
</html>