blob: 1c9afd5785eb3b75df53e082d2941def085755ac [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
var givenScrollTop = 2;
var givenScrollLeft = 0;
var expectedScrollTop = 0;
var expectedScrollLeft = 0;
var pixelsPerWheelTick = 40;
var event;
var div;
if (window.testRunner)
testRunner.waitUntilDone();
function dispatchWheelEvent()
{
var overflowElement = document.getElementById("overflow");
if (overflowElement)
overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
if (window.eventSender) {
eventSender.mouseMoveTo(100, 110);
eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
}
setTimeout('checkOffsets();', 100);
}
function checkOffsets()
{
div = document.getElementById("overflow");
shouldBe("div.scrollTop", "window.expectedScrollTop");
shouldBe("div.scrollLeft", "window.expectedScrollLeft");
if (window.testRunner)
testRunner.notifyDone();
}
function mousewheelHandler(e)
{
event = e;
shouldBe("event.wheelDeltaY", "window.givenScrollTop*-3");
shouldBe("event.wheelDeltaX", "0");
if (e.wheelDeltaY)
shouldBe("event.wheelDelta", "window.givenScrollTop*-3");
else
shouldBe("event.wheelDelta", "0");
}
</script>
</head>
<body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
<div id="overflow" style="border:2px solid black;overflow:auto;white-space:nowrap;height:200px;width:200px;">
<div style="height:185px;width:600px;">
<div style="border:0px;background-color:red;height:181px;width:300px;display:inline-block;"></div>
<div style="border:0px;background-color:green;height:181px;width:300px;display:inline-block;"></div>
</div>
</div>
<div id="console"></div>
</body>
</html>