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

Differential Revision: https://phabricator.services.mozilla.com/D175196
This commit is contained in:
Morgan Rae Reschenberg 2023-04-19 22:55:39 +00:00
Родитель 3963d05927
Коммит 623f4ac2d3
3 изменённых файлов: 88 добавлений и 0 удалений

Просмотреть файл

@ -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 }
);

Просмотреть файл

@ -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]

Просмотреть файл

@ -0,0 +1,43 @@
/* 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: [] }],
});
});