1 description("This tests that page scaling does not affect mouse event pageX and pageY coordinates.");
3 var html = document.documentElement;
5 var div = document.createElement("div");
6 div.style.width = "100px";
7 div.style.height = "100px";
8 div.style.backgroundColor = "blue";
12 function appendEventLog() {
13 var msg = event.type + "(" + event.pageX + ", " + event.pageY + ")";
15 if (window.eventSender) {
22 function clearEventLog() {
26 div.addEventListener("click", appendEventLog, false);
27 document.body.insertBefore(div, document.body.firstChild);
29 function sendEvents(button) {
30 if (!window.eventSender || !window.internals) {
31 debug("This test requires DumpRenderTree. Click on the blue rect with the left mouse button to log the mouse coordinates.")
34 eventSender.mouseDown(button);
35 eventSender.mouseUp(button);
38 function testEvents(button, description, expectedString) {
41 shouldBeEqualToString("eventLog", expectedString);
46 if (window.eventSender && window.internals) {
47 eventSender.mouseMoveTo(10, 10);
48 // We are clicking in the same position on screen. As we scale or transform the page,
49 // we expect the pageX and pageY event coordinates to change because different
50 // parts of the document are under the mouse.
51 testEvents(0, "Unscaled", "click(10, 10)");
53 window.internals.setPageScaleFactorLimits(0.5, 0.5);
54 window.internals.setPageScaleFactor(0.5);
55 testEvents(0, "setPageScale(0.5)", "click(20, 20)");