helper_test_select_zoom.html (1567B)
1 <html><head> 2 <script src="/tests/SimpleTest/SimpleTest.js"></script> 3 <script src='/tests/SimpleTest/paint_listener.js'></script> 4 <script src='apz_test_utils.js'></script> 5 <script src='apz_test_native_event_utils.js'></script> 6 <script> 7 function getSelectRect() { 8 const input = document.getElementById("select"); 9 let rect = input.getBoundingClientRect(); 10 let x = rect.left; 11 let y = rect.top; 12 13 const relativeOffset = getRelativeViewportOffset(window); 14 15 let resolution = SpecialPowers.getDOMWindowUtils(window).getResolution(); 16 x = resolution * (x - relativeOffset.x); 17 y = resolution * (y - relativeOffset.y); 18 19 let fullZoom = SpecialPowers.getFullZoom(window); 20 rect = { 21 left: x * fullZoom, 22 top: y * fullZoom, 23 width: rect.width * fullZoom * resolution, 24 height: rect.height * fullZoom * resolution, 25 }; 26 27 return rect; 28 } 29 </script> 30 </head> 31 <body> 32 Here is some text to stare at as the test runs. It serves no functional 33 purpose, but gives you an idea of the zoom level. It's harder to tell what 34 the zoom level is when the page is just solid white. 35 <select id='select' style="position: absolute; left:150px; top:300px;"><option>he he he</option><option>boo boo</option><option>baz baz</option></select> 36 37 <script> 38 // Silence SimpleTest warning about missing assertions by having it wait 39 // indefinitely. We don't need to give it an explicit finish because the 40 // entire window this test runs in will be closed after subtestDone is called. 41 SimpleTest.waitForExplicitFinish(); 42 </script> 43 </body></html>