Commit be23bbe9 authored by criss's avatar criss
Browse files

Merge mozilla-central to autoland on a CLOSED TREE

parents b9731554 d7d5c89e
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -327,10 +327,6 @@ class DocAccessibleParent : public RemoteAccessible,
  nsTHashMap<uint64_t, nsTHashMap<uint64_t, nsTArray<uint64_t>>>
      mReverseRelations;

  // Computed from the viewport cache, the accs referenced by these ids
  // are currently on screen (making any acc not in this list offscreen).
  nsTHashSet<uint64_t> mOnScreenAccessibles;

  static DocAccessibleParent* GetFrom(dom::BrowsingContext* aBrowsingContext);

 private:
+0 −2
Original line number Diff line number Diff line
@@ -939,8 +939,6 @@ uint64_t RemoteAccessibleBase<Derived>::State() {
    auto* cbc = mDoc->GetBrowsingContext();
    if (cbc && !cbc->IsActive()) {
      state |= states::OFFSCREEN;
    } else if (!mDoc->mOnScreenAccessibles.Contains(ID())) {
      state |= states::OFFSCREEN;
    }
  }
  auto* browser = static_cast<dom::BrowserParent*>(Document()->Manager());
+0 −12
Original line number Diff line number Diff line
@@ -258,18 +258,6 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {

  void ApplyCache(CacheUpdateType aUpdateType, AccAttributes* aFields) {
    const nsTArray<bool> relUpdatesNeeded = PreProcessRelations(aFields);
    if (auto maybeViewportCache =
            aFields->GetAttribute<nsTArray<uint64_t>>(nsGkAtoms::viewport)) {
      // Updating the viewport cache means the offscreen state of this
      // document's accessible has changed. Update the HashSet we use for
      // checking offscreen state here.
      MOZ_ASSERT(IsDoc(),
                 "Fetched the viewport cache from a non-doc accessible?");
      for (auto id : *maybeViewportCache) {
        AsDoc()->mOnScreenAccessibles.Insert(id);
      }
    }

    if (aUpdateType == CacheUpdateType::Initial) {
      mCachedFields = aFields;
    } else {
+4 −0
Original line number Diff line number Diff line
@@ -13,3 +13,7 @@ skip-if = verify
https_first_disabled = true
skip-if =
  os == 'win' && bits == 64 && !debug # bug 1652192
[browser_offscreen_element_in_out_of_process_iframe.js]
skip-if =
  os == 'win' # bug 1580706
  apple_catalina # high frequency intermittent
+98 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

const parentURL =
  "data:text/html;charset=utf-8," +
  '<div id="scroller" style="width: 300px; height: 300px; overflow-y: scroll; overflow-x: hidden;">' +
  '  <div style="width: 100%; height: 1000px;"></div>' +
  '  <iframe frameborder="0"/>' +
  "</div>";
const iframeURL =
  "data:text/html;charset=utf-8," +
  "<style>" +
  " html,body {" +
  "   /* Convenient for calculation of element positions */" +
  "   margin: 0;" +
  "   padding: 0;" +
  " }" +
  "</style>" +
  '<div id="target" style="width: 100px; height: 100px;">target</div>';

add_task(async function() {
  const win = await BrowserTestUtils.openNewBrowserWindow({
    fission: true,
  });

  try {
    const browser = win.gBrowser.selectedTab.linkedBrowser;

    BrowserTestUtils.loadURI(browser, parentURL);
    await BrowserTestUtils.browserLoaded(browser, false, parentURL);

    async function setup(url) {
      const iframe = content.document.querySelector("iframe");

      iframe.contentWindow.location = url;
      await new Promise(resolve => {
        iframe.addEventListener("load", resolve, { once: true });
      });

      return iframe.browsingContext;
    }

    async function scrollTo(x, y) {
      await SpecialPowers.spawn(browser, [x, y], async (scrollX, scrollY) => {
        const scroller = content.document.getElementById("scroller");
        scroller.scrollTo(scrollX, scrollY);
        await new Promise(resolve => {
          scroller.addEventListener("scroll", resolve, { once: true });
        });
      });
      await waitForIFrameUpdates();
    }

    // Setup an out-of-process iframe which is initially scrolled out.
    const iframe = await SpecialPowers.spawn(browser, [iframeURL], setup);

    await waitForIFrameA11yReady(iframe);
    await spawnTestStates(
      iframe,
      "target",
      nsIAccessibleStates.STATE_OFFSCREEN,
      nsIAccessibleStates.STATE_INVISIBLE
    );

    // Scroll the iframe into view and the target element is also visible but
    // the visible area height is 11px.
    await scrollTo(0, 711);
    await spawnTestStates(
      iframe,
      "target",
      nsIAccessibleStates.STATE_OFFSCREEN,
      nsIAccessibleStates.STATE_INVISIBLE
    );

    // Scroll to a position where the visible height is 13px.
    await scrollTo(0, 713);
    await spawnTestStates(
      iframe,
      "target",
      0,
      nsIAccessibleStates.STATE_OFFSCREEN
    );

    // Scroll the iframe out again.
    await scrollTo(0, 0);
    await spawnTestStates(
      iframe,
      "target",
      nsIAccessibleStates.STATE_OFFSCREEN,
      nsIAccessibleStates.STATE_INVISIBLE
    );
  } finally {
    await BrowserTestUtils.closeWindow(win);
  }
});
Loading