blob: 036a1a283dcf6ff4f0901f60d9cdda4d7855b1e1 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
<style>
body {
margin: 0;
}
</style>
<meta name="viewport" content="initial-scale=1">
</head>
<body>
<div id="eventTarget" style="overflow: scroll; height: 200px">
<div style="height: 3000px"></div>
</div>
<p id="description"></p>
<div id="console">
</div>
<script>
description("Test scrolling on a block without -webkit-overflow-scrolling.");
window.jsTestIsAsync = true;
function getDragUIScript(startX, startY, endX, endY)
{
return `
(function() {
uiController.dragFromPointToPoint(${startX}, ${startY}, ${endX}, ${endY}, 0.15, function() {
uiController.uiScriptComplete("Dispatched Drag");
});
})();`
}
function runTest()
{
function scrollEventHandler(event) {
shouldBe("window.scrollX", "0");
shouldBe("window.scrollY", "0");
shouldBe("document.documentElement.scrollTop", "0");
shouldBe("document.documentElement.scrollLeft", "0");
shouldBeTrue("document.getElementById('eventTarget').scrollTop > 0");
shouldBe("document.getElementById('eventTarget').scrollLeft", "0");
finishJSTest();
}
let eventTarget = document.getElementById("eventTarget");
eventTarget.addEventListener("scroll", scrollEventHandler);
function touchEventHandler(event) {
debug("Received" + (event.cancelable ? " cancelable" : "") + " event " + event.type + " at " + event.touches[0].clientX + ", " + event.touches[0].clientY);
}
eventTarget.addEventListener('touchstart', touchEventHandler, { 'passive': true });
eventTarget.addEventListener('touchmove', touchEventHandler, { 'passive': true });
eventTarget.addEventListener('touchend', touchEventHandler, { 'passive': true });
eventTarget.addEventListener('touchcancel', touchEventHandler, { 'passive': true });
if (window.testRunner) {
testRunner.runUIScript(getDragUIScript(50, 150, 50, 50), function(result) {
debug(result);
});
}
shouldBe("window.scrollX", "0");
shouldBe("window.scrollY", "0");
shouldBe("document.documentElement.scrollTop", "0");
shouldBe("document.documentElement.scrollLeft", "0");
shouldBe("document.getElementById('eventTarget').scrollTop", "0");
shouldBe("document.getElementById('eventTarget').scrollLeft", "0");
}
window.addEventListener('load', runTest, false);
</script>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>