author James Teh <>
Wed, 01 Feb 2023 05:02:01 +0000
changeset 651150 dd0fdd1daa69783be36acd5c50544f3694eaa8f9
parent 596912 021e9580239e0776de13703af595ab88fd69132f
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:

  <title>A hit testing test involving a scenario with a scale transform</title>
  <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>
  <meta name="viewport" content="width=device-width"/>
    body, html {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
    #layer1 {
      position: absolute;
      top: 0px;
      left: 0px;
      width: 100px;
      height: 100px;
      background: red;
      overflow: scroll;
      transform: scale(2.0);
      transform-origin: 0 0;
 <!-- Neither the root nor layer1 actually have room to scroll -->
 <div id="layer1"></div>
<script type="application/javascript">

async function test() {
  var config = getHitTestConfig();
  var utils = config.utils;

  // Force an APZC for layer1 in spite of it having no scroll range.
  utils.setDisplayPortForElement(0, 0, 100, 100, layer1, 1);
  await promiseApzFlushedRepaints();

  // Hit an area on layer1 that would be on the root if layer1 weren't transformed.
  checkHitResult(hitTest({x: 150, y: 150}),

.then(subtestDone, subtestFailed);