blob: cad4e13c1c8d94c7b87e413a1409b84155ac4ba3 [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
window.jsTestIsAsync = true;
var givenScrollTop = 2; // When paging, this is ignored. Every event is one page.
var givenScrollLeft = 0;
var expectedScrollTop = 161;
var expectedScrollLeft = 0;
var event;
var div;
function runTest()
{
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);
}
div = document.getElementById("overflow");
shouldBecomeEqual("div.scrollTop == window.expectedScrollTop && " +
"div.scrollLeft == window.expectedScrollLeft", "true", finishJSTest);
}
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="runTest()">
<!-- This div is 200 pixels high. The content results in scrool bars on
both edges, resulting in an effective content area of 185 x 185 on
linux. The paging context overlap is 24 pixels. So one page of scroll
moves the content by 185 - 24 -= 161 pixels. -->
<div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
<div style="height:300px;width:600px">
<div style="background-color:red;height:300px;width:300px;position:relative;left:0px;top:0px"></div>
<div style="background-color:green;height:300px;width:300px;position:relative;left:300px;top:-300px"></div>
</div>
<div style="height:300px;width:600px">
<div style="background-color:blue;height:300px;width:300px;position:relative;left:0px;top:0px"></div>
<div style="background-color:yellow;height:300px;width:300px;position:relative;left:300px;top:-300px"></div>
</div>
</div>
<div id="console"></div>
</body>
</html>