blob: 29d20ad6a9ddd9a5864b52c7b049460130103548 [file] [log] [blame]
<script src="../../resources/js-test-pre.js"></script>
<style>
#pusher {
width: 1000px;
height: 1000px;
outline: 1px solid black;
}
#subpixel-test {
width: 4.5px;
}
</style>
<div id="console"></div>
<div id="testArea">
<div id="pusher">This box is here to create scrollbars.</div>
<div id="subpixel-test"></div>
</div>
<script>
var r = document.getElementById('subpixel-test').getBoundingClientRect();
var hasSubpixelSupport = r.right - r.left == 4.5;
var event;
function sendClick()
{
if (window.eventSender) {
eventSender.mouseMoveTo(100, 100);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
function zoomPageIn()
{
if (window.eventSender) {
eventSender.zoomPageIn();
}
}
function zoomPageOut()
{
if (window.eventSender) {
eventSender.zoomPageOut();
}
}
function scrollPage(x, y)
{
window.scrollTo(x, y);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
// Default.
function base(e)
{
event = e;
debug("Base");
shouldBe("event.clientX", "100");
shouldBe("event.clientY", "100");
shouldBe("event.pageX", "100");
shouldBe("event.pageY", "100");
}
window.addEventListener("click", base, false);
sendClick();
window.removeEventListener("click", base, false);
// Just zoomed.
function justZoomed(e)
{
event = e;
debug("\nJust zoomed");
shouldBe("event.clientX", "83");
shouldBe("event.clientY", "83");
shouldBe("event.pageX", "83");
shouldBe("event.pageY", "83");
}
window.addEventListener("click", justZoomed, false);
zoomPageIn();
sendClick();
zoomPageOut();
window.removeEventListener("click", justZoomed, false);
// Just scrolled.
function justScrolled(e)
{
event = e;
debug("\nJust scrolled");
shouldBe("event.clientX", "100");
shouldBe("event.clientY", "100");
shouldBe("event.pageX", "150");
shouldBe("event.pageY", "150");
}
window.addEventListener("click", justScrolled, false);
scrollPage(50, 50);
sendClick();
scrollPage(0, 0);
window.removeEventListener("click", justScrolled, false);
// Zoomed and scrolled.
function zoomedAndScrolled(e)
{
event = e;
debug("\nZoomed and scrolled");
shouldBe("event.clientX", hasSubpixelSupport ? "83" : "84");
shouldBe("event.clientY", hasSubpixelSupport ? "83" : "84");
shouldBe("event.pageX", "133");
shouldBe("event.pageY", "133");
}
window.addEventListener("click", zoomedAndScrolled, false);
zoomPageIn();
scrollPage(50, 50);
sendClick();
zoomPageOut();
scrollPage(0, 0);
window.removeEventListener("click", zoomedAndScrolled, false);
if (window.testRunner) {
var area = document.getElementById('testArea');
area.parentNode.removeChild(area);
testRunner.notifyDone();
}
</script>
<script src="../../resources/js-test-post.js"></script>