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

  <meta charset="utf-8">
  <meta name="viewport" content="width=400px">
  <title>Test for Bug 1637135</title>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
    #target {
      margin-left: 450px;
      width: 100px;
      height: 100px;
  <div id="target">
  <script type="application/javascript">

async function test() {
  // Tap the target element, which is located beyond x=400.
  // The bug occurs when we cannot hit it because the viewport
  // width of x=400 causes us to be unable to hit elements
  // beyond that point.
  let target = document.getElementById("target");
  let mouseDownEvent = null;
  let mouseDownPromise = new Promise(resolve => {
    target.addEventListener("mousedown", function(e) {
      mouseDownEvent = e;

  await synthesizeNativeTap(target, 10, 10);
  await mouseDownPromise;

  is(, target, "mousedown event targeted the correct element");

if (getPlatform() == "android") {
  .then(subtestDone, subtestFailed);
} else {
  // The fix for bug 1637135 is limited to Android, because
  // it breaks the ability to target scrollbars, so we can
  // only run this test on Android.
  ok(true, "This subtest is only run on Android");