| OLD | NEW |
| 1 description("This tests that page scaling does not affect mouse event pageX and
pageY coordinates."); | 1 description("This tests that page scaling does not affect mouse event pageX and
pageY coordinates."); |
| 2 | 2 |
| 3 var html = document.documentElement; | 3 var html = document.documentElement; |
| 4 | 4 |
| 5 var div = document.createElement("div"); | 5 var div = document.createElement("div"); |
| 6 div.style.width = "100px"; | 6 div.style.width = "100px"; |
| 7 div.style.height = "100px"; | 7 div.style.height = "100px"; |
| 8 div.style.backgroundColor = "blue"; | 8 div.style.backgroundColor = "blue"; |
| 9 | 9 |
| 10 var eventLog = ""; | 10 var eventLog = ""; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 function testEvents(button, description, expectedString) { | 38 function testEvents(button, description, expectedString) { |
| 39 sendEvents(button); | 39 sendEvents(button); |
| 40 debug(description); | 40 debug(description); |
| 41 shouldBeEqualToString("eventLog", expectedString); | 41 shouldBeEqualToString("eventLog", expectedString); |
| 42 debug(""); | 42 debug(""); |
| 43 clearEventLog(); | 43 clearEventLog(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (window.eventSender && window.internals) { | 46 if (window.eventSender && window.internals) { |
| 47 // Mouse events only work after an initial layout | |
| 48 document.body.offsetLeft; | |
| 49 | |
| 50 eventSender.mouseMoveTo(10, 10); | 47 eventSender.mouseMoveTo(10, 10); |
| 51 // We are clicking in the same position on screen. As we scale or transform
the page, | 48 // We are clicking in the same position on screen. As we scale or transform
the page, |
| 52 // we expect the pageX and pageY event coordinates to change because differe
nt | 49 // we expect the pageX and pageY event coordinates to change because differe
nt |
| 53 // parts of the document are under the mouse. | 50 // parts of the document are under the mouse. |
| 54 testEvents(0, "Unscaled", "click(10, 10)"); | 51 testEvents(0, "Unscaled", "click(10, 10)"); |
| 55 | 52 |
| 56 window.internals.setPageScaleFactor(0.5, 0, 0); | 53 window.internals.setPageScaleFactor(0.5, 0, 0); |
| 57 testEvents(0, "setPageScale(0.5)", "click(20, 20)"); | 54 testEvents(0, "setPageScale(0.5)", "click(20, 20)"); |
| 58 } | 55 } |
| OLD | NEW |