Bug 1776444 [wpt PR 34582] - Revert "Add TimedHTMLParserBudget to fieldtrial_testing_...
[gecko.git] / widget / tests / test_panel_mouse_coords.xhtml
blob8071bee36d28fb543ac2f70fa0cfb3bfda88aea3
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=835044
6 -->
7 <window title="Mozilla Bug 835044"
8 onload="startTest()"
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 width="80" height="80">
17 </panel>
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"
22 id="anchor"
23 target="_blank">Mozilla Bug 835044</a>
24 </body>
26 <!-- test code goes here -->
27 <script type="application/javascript">
28 <![CDATA[
29 SimpleTest.waitForExplicitFinish();
31 let panel = document.getElementById('thepanel');
32 let rect;
34 function startTest() {
35 // This first event is to ensure that the next event will have different
36 // coordinates to the previous mouse position, and so actually generates
37 // mouse events. The mouse is not moved off the window, as that might
38 // move focus to another application.
39 synthesizeNativeMouseEvent({
40 type: "mousemove",
41 screenX: window.mozInnerScreenX,
42 screenY: window.mozInnerScreenY,
43 elementOnWidget: window.documentElement,
44 });
46 panel.openPopup(document.getElementById("anchor"), "after_start");
49 function sendMouseEvent() {
50 rect = panel.getBoundingClientRect();
51 synthesizeNativeMouseEvent({
52 type: "mousemove",
53 target: panel,
54 offsetX: 1,
55 offsetY: 2,
56 });
59 function checkCoords(event) {
60 isfuzzy(event.clientX, rect.left + 1, window.devicePixelRatio, "Motion x coordinate");
61 isfuzzy(event.clientY, rect.top + 2, window.devicePixelRatio, "Motion y coordinate");
62 done();
65 function done() {
66 SimpleTest.finish();
68 ]]>
69 </script>
70 </window>