`,
runTests,
{
iframe: true,
remoteIframe: true,
// Ensure that all hittest elements are in view.
iframeAttrs: { style: "width: 600px; height: 600px; padding: 10px;" },
}
);
addAccessibleTask(
`
A
B
`,
async function (browser, accDoc) {
const a = findAccessibleChildByID(accDoc, "a");
const b = findAccessibleChildByID(accDoc, "b");
const dpr = await getContentDPR(browser);
// eslint-disable-next-line no-unused-vars
const [x, y, w, h] = Layout.getBounds(a, dpr);
// The point passed below will be made relative to `b`, but
// we'd like to test a point within `a`. Pass `a`s negative
// width for an x offset. Pass zero as a y offset,
// assuming the headings are on the same line.
await testChildAtPoint(dpr, -w, 0, b, null, null);
},
{
iframe: true,
remoteIframe: true,
// Ensure that all hittest elements are in view.
iframeAttrs: { style: "width: 600px; height: 600px; padding: 10px;" },
}
);
addAccessibleTask(
`
`,
async function (browser, accDoc) {
const a = findAccessibleChildByID(accDoc, "a");
const aa = findAccessibleChildByID(accDoc, "aa");
const dpr = await getContentDPR(browser);
const [, , w, h] = Layout.getBounds(a, dpr);
// test upper left of `a`
await testChildAtPoint(dpr, 1, 1, a, aa, aa);
// test upper right of `a`
await testChildAtPoint(dpr, w - 1, 1, a, a, a);
// test just outside upper left of `a`
await testChildAtPoint(dpr, 1, -1, a, null, null);
// test halfway down/left of `a`
await testChildAtPoint(dpr, 1, Math.round(h / 2), a, a, a);
},
{
chrome: true,
topLevel: true,
iframe: false,
remoteIframe: false,
// Ensure that all hittest elements are in view.
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(
`
abcde
fghij
`,
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 }
);
/**
* Verify that hit testing is appropriately fuzzy when working with generics.
* If we match on a generic which contains additional generics and a single text
* leaf, we should return the text leaf as the deepest match instead of the
* generic itself.
*/
addAccessibleTask(
`
I am some visible textI am some invisible text`,
async function (browser, docAcc) {
const link = findAccessibleChildByID(docAcc, "link");
const generic = findAccessibleChildByID(docAcc, "generic");
const invisible = findAccessibleChildByID(docAcc, "invisible");
const dpr = await getContentDPR(browser);
await testChildAtPoint(
dpr,
1,
1,
link,
generic, // Direct Child
invisible.firstChild // Deepest Child
);
await testOffsetAtPoint(
findAccessibleChildByID(docAcc, "invisible", [Ci.nsIAccessibleText]),
1,
1,
COORDTYPE_PARENT_RELATIVE,
0
);
},
{ chrome: false, iframe: true, remoteIframe: true }
);
/**
* Verify that hit testing is appropriately fuzzy when working with generics with siblings.
* We should return the deepest text leaf as the deepest match instead of the generic itself.
*/
addAccessibleTask(
`