summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_zoomToFocusedInput_zoom_in_position_fixed.html
blob: 946ffffa5814a7c0d3bb03b64156f158652568d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=2100,initial-scale=0.4"/>
  <title>Tests that zoomToFocuedInput zooms in element in position:fixed element</title>
  <script src="apz_test_native_event_utils.js"></script>
  <script src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <style>
  .container {
    top: 0px;
    height: 100px;
    width: calc(100% - 30px);
    position: fixed;
  }
  html {
    height: 500vh;
  }
  </style>
</head>
<body>
<div class="container">
  <input>
</div>
<script>
async function test() {
  const initial_resolution = await getResolution();
  ok(initial_resolution > 0,
     "The initial_resolution is " + initial_resolution + ", which is some sane value");

  document.querySelector("input").focus();

  const transformEndPromise = promiseTransformEnd();
  SpecialPowers.DOMWindowUtils.zoomToFocusedInput();
  await transformEndPromise;

  let resolution = await getResolution();
  ok(resolution > initial_resolution, "zoomToFocusedInput zooms in to " + resolution);
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
</body>
</html>