summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/reftest/zoom-to-focus-input-oopif.html
blob: 3198625007ec99d5c671bca272c936c8ef112123 (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
<!DOCTYPE html>
<html class="reftest-wait">
<meta name="viewport" content="width=device-width">
<style>
iframe {
  position: absolute;
  width: 1600px;
  height: 2000px;
  top: 200px;
  left: 100px;
}
</style>
<iframe src="http://example.org/zoom-to-focus-input-subframe.html"></iframe>
<script>
document.addEventListener('MozReftestInvalidate', async () => {
  const transformEndPromise = new Promise(resolve => {
    SpecialPowers.Services.obs.addObserver(function observer() {
      SpecialPowers.Services.obs.removeObserver(observer, "APZ:TransformEnd");
      resolve();
    }, "APZ:TransformEnd");
  });

  const iframe = document.querySelector("iframe");
  await SpecialPowers.spawn(iframe, [], () => {
    const input = content.document.querySelector("input");
    input.focus();
    SpecialPowers.DOMWindowUtils.zoomToFocusedInput();
  });

  await transformEndPromise;

  document.documentElement.classList.remove('reftest-wait');
});
</script>
</html>