2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=835044
7 <window title=
"Mozilla Bug 835044"
9 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
13 <panel id=
"thepanel" level=
"parent"
14 onpopupshown=
"sendMouseEvent();"
15 onmousemove=
"checkCoords(event);"
16 style=
"width: 80px; height: 80px">
19 <!-- test results are displayed in the html:body -->
20 <body xmlns=
"http://www.w3.org/1999/xhtml">
21 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=835044"
23 target=
"_blank">Mozilla Bug
835044</a>
26 <!-- test code goes here -->
27 <script type=
"application/javascript">
29 SimpleTest.waitForExplicitFinish();
31 let panel = document.getElementById('thepanel');
35 function startTest() {
36 // This first event is to ensure that the next event will have different
37 // coordinates to the previous mouse position, and so actually generates
38 // mouse events. The mouse is not moved off the window, as that might
39 // move focus to another application.
40 synthesizeNativeMouseEvent({
42 screenX: window.mozInnerScreenX,
43 screenY: window.mozInnerScreenY,
44 elementOnWidget: window.documentElement,
47 panel.openPopup(document.getElementById(
"anchor"),
"after_start");
50 function sendMouseEvent() {
51 rect = panel.getBoundingClientRect();
52 synthesizeNativeMouseEvent({
60 function checkCoords(event) {
64 isfuzzy(event.clientX, rect.left +
10, window.devicePixelRatio,
"Motion x coordinate");
65 isfuzzy(event.clientY, rect.top +
20, window.devicePixelRatio,
"Motion y coordinate");
66 info(`Event client: ${event.clientX}, ${event.clientY}, panel client: ${rect.left}, ${rect.top}`);
67 info(`Event screen: ${event.screenX}, ${event.screenY}, panel screen: ${panel.screenX}, ${panel.screenY}`);
68 info(`offset client: ${event.clientX - rect.left}, ${event.clientY - rect.top}`);
69 info(`offset screen: ${event.screenX - panel.screenX}, ${event.screenY - panel.screenY}`);