author James Teh <>
Wed, 01 Feb 2023 05:02:01 +0000
changeset 651150 dd0fdd1daa69783be36acd5c50544f3694eaa8f9
parent 572521 ed5c38a59629d53b960a6973b4d16b8b959884f8
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">
  <title>Test for Bug 1277814</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">
    async function test() {
      // Trigger the buggy scenario
      var subframe = document.getElementById("bug1277814-div");

      // The transform change is animated, so let's step through 1s of animation
      var utils = SpecialPowers.getDOMWindowUtils(window);
      for (var i = 0; i < 60; i++) {

      // Wait for the layer tree with any updated dispatch-to-content region to
      // get pushed over to the APZ
      await promiseAllPaintsDone();
      await promiseOnlyApzControllerFlushed();

      // Trigger layerization of the subframe by scrolling the wheel over it
      await promiseMoveMouseAndScrollWheelOver(subframe, 10, 10);

      // Give APZ the chance to compute a displayport, and content
      // to render based on it.
      await promiseApzFlushedRepaints();

      // Examine the content-side APZ test data
      var contentTestData = utils.getContentAPZTestData();

      // Test that the scroll frame for the div 'bug1277814-div' appears in
      // the APZ test data. The bug this test is for causes the displayport
      // calculation for this scroll frame to go wrong, causing it not to
      // become layerized.
      contentTestData = convertTestData(contentTestData);
      var foundIt = false;
      for (var seqNo in contentTestData.paints) {
        var paint = contentTestData.paints[seqNo];
        for (var scrollId in paint) {
          var scrollFrame = paint[scrollId];
          if ("contentDescription" in scrollFrame &&
              scrollFrame.contentDescription.includes("bug1277814-div")) {
            foundIt = true;
      SimpleTest.ok(foundIt, "expected to find APZ test data for bug1277814-div");

    if (isApzEnabled()) {

      pushPrefs([["apz.test.logging_enabled", true]])
        .then(SimpleTest.finish, SimpleTest.finishWithFailure);
      position: absolute;
      left: 0;
      top: 0;
      padding: .5em;
      overflow: auto;
      color: white;
      background: green;
      max-width: 30em;
      max-height: 6em;
      visibility: hidden;
      transform: scaleY(0);
      transition: transform .15s ease-out, visibility 0s ease .15s;
      visibility: visible;
      transform: scaleY(1);
      transition: transform .15s ease-out;
  <!-- Use a unique id because we'll be checking for it in the content
       description logged in the APZ test data -->
  <div id="bug1277814-div">
  <button>click me</button>