summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_zoomToFocusedInput_nested_position_fixed.html
blob: 053c17e29b0016c54425d3ff35eb8f9654c15a43 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Tests that zoomToFocuedInput doesn't reset the scroll position for nested 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, textarea {
    bottom: 10px;
    height: 100px;
    width: calc(100% - 30px);
    position: fixed;
  }
  html {
    height: 500vh;
  }
  </style>
</head>
<body>
<div class="container">
  <textarea></textarea>
</div>
<script>
async function test() {
  window.scrollTo(0, document.documentElement.scrollHeight);
  const expectedScrollPosition = window.scrollY;

  document.querySelector("textarea").focus();
  is(window.scrollY, expectedScrollPosition);

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

  is(window.scrollY, expectedScrollPosition);
}

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