Commit 80cb6ab5 authored by Morgan Rae Reschenberg's avatar Morgan Rae Reschenberg
Browse files

Bug 1825611: Add test for overflow:hidden hittesting and acc creation r=Jamie

parent e7373d87
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -232,3 +232,47 @@ addAccessibleTask(
    iframeAttrs: { style: "width: 600px; height: 600px; padding: 10px;" },
  }
);

/**
 * Verify that hit testing returns the proper accessible when one acc content
 * is partially hidden due to overflow:hidden;
 */
addAccessibleTask(
  `
  <style>
    div div {
      overflow: hidden;
      font-family: monospace;
      width: 2ch;
    }
  </style>
  <div id="container" style="display: flex; flex-direction: row-reverse;">
    <div id="aNode">abcde</div><div id="fNode">fghij</div>
  </div>`,
  async function(browser, docAcc) {
    const container = findAccessibleChildByID(docAcc, "container");
    const aNode = findAccessibleChildByID(docAcc, "aNode");
    const fNode = findAccessibleChildByID(docAcc, "fNode");
    const dpr = await getContentDPR(browser);
    const [, , containerWidth] = Layout.getBounds(container, dpr);
    const [, , aNodeWidth] = Layout.getBounds(aNode, dpr);

    await testChildAtPoint(
      dpr,
      containerWidth - 1,
      1,
      container,
      aNode,
      aNode.firstChild
    );
    await testChildAtPoint(
      dpr,
      containerWidth - aNodeWidth - 1,
      1,
      container,
      fNode,
      fNode.firstChild
    );
  },
  { chrome: true, iframe: true, remoteIframe: true }
);
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ prefs =
skip-if = true || (verify && !debug && (os == 'linux')) #Bug 1445513
[browser_browser_element.js]
[browser_css_content_visibility.js]
[browser_general.js]
[browser_lazy_tabs.js]
[browser_searchbar.js]
[browser_shadowdom.js]
+43 −0
Original line number Diff line number Diff line
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });

/**
 * Verify adding `overflow:hidden;` styling to a div causes it to
 * get an accessible.
 */
addAccessibleTask(`<p>hello world</p>`, async function(browser, docAcc) {
  const originalTree = { DOCUMENT: [{ PARAGRAPH: [{ TEXT_LEAF: [] }] }] };

  testAccessibleTree(docAcc, originalTree);
  info("Adding div element");
  await contentSpawnMutation(
    browser,
    { unexpected: [[EVENT_REORDER, docAcc]] },
    function() {
      const d = content.document.createElement("div");
      content.document.body.appendChild(d);
    }
  );

  testAccessibleTree(docAcc, originalTree);
  info("Adding overflow:hidden styling to div");
  await contentSpawnMutation(
    browser,
    { expected: [[EVENT_REORDER, docAcc]] },
    function() {
      content.document.body.lastElementChild.setAttribute(
        "style",
        "overflow:hidden;"
      );
    }
  );

  testAccessibleTree(docAcc, {
    DOCUMENT: [{ PARAGRAPH: [{ TEXT_LEAF: [] }] }, { SECTION: [] }],
  });
});