blob: 51934fe3f5c734dd4c89a9057d5715f31492c2cf [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
<html>
<head>
<style>
body {
height: 2000px;
}
.scroller {
position: absolute;
top: 310px;
left: 10px;
height: 300px;
width: 300px;
border: 20px solid gray;
padding: 5px;
overflow: scroll;
}
.content {
width: 200%;
height: 300%;
}
</style>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script>
var jsTestIsAsync = true;
var scroller;
var overflowScrollEventCount = 0;
var windowScrollEventCount = 0;
async function resetScrollPositions()
{
window.scrollTo(0, 300);
scroller.scrollTop = 0;
// Wait for scroll events to fire.
await UIHelper.renderingUpdate();
overflowScrollEventCount = 0;
windowScrollEventCount = 0;
}
async function testScrollOverContent()
{
debug('');
debug('Test scroll over content');
await resetScrollPositions();
await UIHelper.mouseWheelScrollAt(500, 500);
shouldBe('overflowScrollEventCount > 0', 'true');
shouldBe('windowScrollEventCount == 0', 'true');
}
async function scrollTest()
{
await testScrollOverContent();
finishJSTest();
}
const pageScale = 2;
window.addEventListener('load', () => {
scroller = document.querySelector('.scroller');
scroller.addEventListener('scroll', () => {
++overflowScrollEventCount;
}, false);
window.addEventListener('scroll', () => {
++windowScrollEventCount;
}, false);
if (window.internals)
internals.setPageScaleFactor(pageScale, 0, 0);
setTimeout(scrollTest, 0);
}, false);
</script>
</head>
<body>
<div class="scroller">
<div class="content"></div>
</div>
<div class="overlapper"></div>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>