blob: 79875609739760b64e52aa6eb7164aa7ad29887b [file] [log] [blame]
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<script>
var expectedScrollTop = 200;
var expectedScrollLeft = 100;
var event;
var div;
if (window.layoutTestController) {
layoutTestController.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.expectedScrollLeft, -window.expectedScrollTop);
}
setTimeout('checkOffsets();', 100);
}
function checkOffsets()
{
div = document.getElementById("overflow");
shouldBe("div.scrollTop", "window.expectedScrollTop");
shouldBe("div.scrollLeft", "window.expectedScrollLeft");
if (window.layoutTestController)
window.layoutTestController.notifyDone();
}
function mousewheelHandler(e)
{
event = e;
shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-3");
shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-3");
if (e.wheelDeltaY)
shouldBe("event.wheelDelta", "window.expectedScrollTop*-3");
else
shouldBe("event.wheelDelta", "window.expectedScrollLeft*-3");
}
</script>
</head>
<body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
<div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
<div style="background-color:red;height:200px;width:400px;"></div>
<div style="background-color:green;height:200px;width:400px;"></div>
<div style="background-color:red;height:200px;width:400px;"></div>
</div>
<div id="console"></div>
</body>
</html>