128 lines
3.7 KiB
HTML
128 lines
3.7 KiB
HTML
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
|
|
<html>
|
|
<head>
|
|
<style>
|
|
body {
|
|
height: 2000px;
|
|
}
|
|
|
|
.scroller {
|
|
position: absolute;
|
|
left: 20px;
|
|
top: 220px;
|
|
height: 200px;
|
|
width: 200px;
|
|
border: 4px solid gray;
|
|
padding: 5px;
|
|
box-sizing: border-box;
|
|
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;
|
|
|
|
const topContentInset = 55;
|
|
var scroller;
|
|
var overflowScrollEventCount = 0;
|
|
var windowScrollEventCount = 0;
|
|
|
|
async function resetScrollPositions()
|
|
{
|
|
window.scrollTo(0, 200);
|
|
scroller.scrollTop = 0;
|
|
|
|
// Wait for scroll events to fire.
|
|
await UIHelper.renderingUpdate();
|
|
|
|
overflowScrollEventCount = 0;
|
|
windowScrollEventCount = 0;
|
|
}
|
|
|
|
async function testScrollOutsideTopLeft()
|
|
{
|
|
debug('');
|
|
debug('Test scroll outside top left corner');
|
|
await resetScrollPositions();
|
|
await UIHelper.mouseWheelScrollAt(18, topContentInset + 18);
|
|
|
|
shouldBe('overflowScrollEventCount', '0');
|
|
shouldBe('windowScrollEventCount > 0', 'true');
|
|
}
|
|
|
|
async function testScrollInsideTopLeft()
|
|
{
|
|
debug('');
|
|
debug('Test scroll inside top left corner');
|
|
await resetScrollPositions();
|
|
await UIHelper.mouseWheelScrollAt(25, topContentInset + 25);
|
|
|
|
shouldBe('overflowScrollEventCount > 0', 'true');
|
|
shouldBe('windowScrollEventCount', '0');
|
|
}
|
|
|
|
async function testScrollOutsideBottomRight()
|
|
{
|
|
debug('');
|
|
debug('Test scroll outside bottom right corner');
|
|
await resetScrollPositions();
|
|
await UIHelper.mouseWheelScrollAt(220, topContentInset + 220);
|
|
|
|
shouldBe('overflowScrollEventCount', '0');
|
|
shouldBe('windowScrollEventCount > 0', 'true');
|
|
}
|
|
|
|
async function testScrollInsideBottomRight()
|
|
{
|
|
debug('');
|
|
debug('Test scroll inside bottom right corner');
|
|
await resetScrollPositions();
|
|
await UIHelper.mouseWheelScrollAt(198, topContentInset + 198);
|
|
|
|
shouldBe('overflowScrollEventCount > 0', 'true');
|
|
shouldBe('windowScrollEventCount', '0');
|
|
}
|
|
|
|
async function scrollTest()
|
|
{
|
|
await testScrollOutsideTopLeft();
|
|
await testScrollInsideTopLeft();
|
|
await testScrollOutsideBottomRight();
|
|
await testScrollInsideBottomRight();
|
|
|
|
finishJSTest();
|
|
}
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
if (window.internals)
|
|
internals.setTopContentInset(topContentInset);
|
|
|
|
scroller = document.querySelector('.scroller');
|
|
scroller.addEventListener('scroll', () => {
|
|
++overflowScrollEventCount;
|
|
}, false);
|
|
|
|
window.addEventListener('scroll', () => {
|
|
++windowScrollEventCount;
|
|
}, false);
|
|
|
|
setTimeout(scrollTest, 0);
|
|
}, false);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="scroller">
|
|
<div class="content"></div>
|
|
</div>
|
|
<div id="console"></div>
|
|
<script src="../../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|