tor-browser

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

helper_doubletap_zoom_gencon.html (3020B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <meta name="viewport" content="width=2100"/>
      6  <title>Check that on generated content works</title>
      7  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      8  <script type="application/javascript" src="apz_test_utils.js"></script>
      9  <script src="/tests/SimpleTest/paint_listener.js"></script>
     10  <script type="application/javascript">
     11 
     12 async function test() {
     13  let useTouchpad = (location.search == "?touchpad");
     14 
     15  let resolution = await getResolution();
     16  let initial_resolution = resolution;
     17  ok(resolution > 0,
     18     "The initial_resolution is " + resolution + ", which is some sane value");
     19 
     20  let target = document.getElementById("target");
     21 
     22  info("tar " + target.getBoundingClientRect().width);
     23 
     24  // Check that first double tap zooms in
     25  info("sending first double tap");
     26  await doubleTapOn(target, 10, 10, useTouchpad);
     27  let prev_resolution = resolution;
     28  resolution = await getResolution();
     29  ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);
     30 
     31  // Check that second double tap zooms out
     32  info("sending second double tap");
     33  await doubleTapOn(target, 10, 10, useTouchpad);
     34  prev_resolution = resolution;
     35  resolution = await getResolution();
     36  ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
     37  ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");
     38 
     39  info(" window.innerWidth " + window.innerWidth);
     40 
     41  // Check that third double tap zooms in
     42  info("sending third double tap");
     43  await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
     44  prev_resolution = resolution;
     45  resolution = await getResolution();
     46  ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);
     47 
     48  info(" window.innerWidth " + window.innerWidth);
     49 
     50  // Check that fourth double tap zooms out
     51  info("sending forth double tap");
     52  await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
     53  prev_resolution = resolution;
     54  resolution = await getResolution();
     55  ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
     56  ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");
     57 
     58 }
     59 
     60 waitUntilApzStable()
     61 .then(test)
     62 .then(subtestDone, subtestFailed);
     63 
     64  </script>
     65  <style>
     66 body, html {
     67  margin: 0;
     68 }
     69 .withafter {
     70  width: 200px;
     71  height: 200px;
     72  left: 0;
     73  background: green;
     74  position: relative;
     75 }
     76 .withafter::after {
     77  width: 20vw;
     78  height: 100px;
     79  background: blue;
     80  position: absolute;
     81  left: 80vw;
     82  content: 'after';
     83 }
     84 .placeholder {
     85  width: 20vw;
     86  height: 100px;
     87  background: blue;
     88  position: absolute;
     89  left: 80vw;
     90  top:0;
     91  z-index: -10;
     92 }
     93 </style>
     94 </head>
     95 <body>
     96 
     97 <div id="target" class="withafter">some text</div>
     98 <div id="placeholder" class="placeholder"></div>
     99 
    100 </body>
    101 </html>