gfx/layers/apz/test/mochitest/helper_zoomToFocusedInput_nozoom.html
author James Teh <jteh@mozilla.com>
Wed, 01 Feb 2023 05:02:01 +0000
changeset 651150 dd0fdd1daa69783be36acd5c50544f3694eaa8f9
parent 648893 1d4f355a9db6f1349385846c290c3878801b3c67
permissions -rw-r--r--
Bug 1813980: Check IsDoc before Parent in RemoteAccessibleBase::ApplyCrossDocOffset. r=morgan We call this function on every ancestor when calculating bounds. RemoteParent() currently requires a hash lookup, so it's more efficient to early return for !IsDoc() first. This is a micro-optimisation, but it might have some impact given that we call this on every ancestor, especially when hit testing, where we call Bounds() a lot. As a bit of drive-by cleanup, use RemoteParent() rather than calling Parent() and IsRemote/AsRemote(). Differential Revision: https://phabricator.services.mozilla.com/D168346

<!DOCTYPE>
<html>
  <head>
  <title>Checking zoomToFocusedInput does not zoom if meta viewport does not allow it</title>
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=0.5 minimum-scale=0.5, maximum-scale=1, user-scalable=no" />
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  </head>
<body>
<input id="input1" type="text" style="border: 5px solid black"/>
<script type="application/javascript">
async function test() {
  let utils = SpecialPowers.getDOMWindowUtils(window);

  let resolution = await getResolution();
  ok(resolution > 0,
     "The initial_resolution is " + resolution + ", which is some sane value");

  document.getElementById('input1').focus();
  await waitToClearOutAnyPotentialScrolls(window);
  await promiseApzFlushedRepaints();
  let prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution == prev_resolution, "focusing input did not change resolution " + resolution);

  let transformEndPromise = promiseTransformEnd();
  utils.zoomToFocusedInput();
  await waitToClearOutAnyPotentialScrolls(window);
  await transformEndPromise;
  await promiseApzFlushedRepaints();
  resolution = await getResolution();
  ok(resolution == prev_resolution, "zoomToFocusedInput input did not change resolution " + resolution);
}

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