tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

helper_zoomToFocusedInput_nozoom_bug1738696.html (2345B)


      1 <!DOCTYPE>
      2 <html>
      3  <head>
      4  <title>Checking zoomToFocusedInput does not zoom is meta viewport does not allow it</title>
      5  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1, maximum-scale=1, user-scalable=no" />
      6  <script type="application/javascript" src="apz_test_utils.js"></script>
      7  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      8  <script src="/tests/SimpleTest/paint_listener.js"></script>
      9  </head>
     10 <body>
     11 <input id="input1" type="text" style="width:100%; height: 200px; border: 5px solid black"/>
     12 <script type="application/javascript">
     13 /* This test does not always exercise the bug it was written for, in the sense
     14   that the test would fail without the corresponding patch. It seems as though
     15   when hitting bug 1743602 the test does not exercise the bug. If bug 1743602
     16   gets fixed hopefully this test will end up exercising the bug. A dev pixel
     17   ratio of 1 seems to make it hard (but not impossible) for the test to
     18   exercise the bug. This is what you get when running the emulator locally or
     19   in our CI infrastructure. A dev pixel ratio of ~2.6 (23 appunits = 1 dev
     20   pixel) seems to make it easier (but not 100%) for the test to exercise the
     21   bug. This is what I got when running the test on a real phone locally (pixel 2).
     22 */
     23 async function test() {
     24  let utils = SpecialPowers.getDOMWindowUtils(window);
     25 
     26  let resolution = await getResolution();
     27  ok(resolution > 0,
     28     "The initial_resolution is " + resolution + ", which is some sane value");
     29 
     30  document.getElementById('input1').focus();
     31  await waitToClearOutAnyPotentialScrolls(window);
     32  await promiseApzFlushedRepaints();
     33  let prev_resolution = resolution;
     34  resolution = await getResolution();
     35  ok(resolution == prev_resolution, "focusing input did not change resolution " + resolution);
     36 
     37  utils.zoomToFocusedInput();
     38  await waitToClearOutAnyPotentialScrolls(window);
     39 
     40  await promiseApzFlushedRepaints();
     41  await promiseApzFlushedRepaints();
     42  resolution = await getResolution();
     43  ok(resolution == prev_resolution, "zoomToFocusedInput input did not change resolution " + resolution);
     44 }
     45 
     46 SpecialPowers.getDOMWindowUtils(window).setDynamicToolbarMaxHeight(300);
     47 
     48 waitUntilApzStable().then(test).then(subtestDone, subtestFailed);
     49 </script>
     50 </body>
     51 </html>