Bug 1772609: Support cached hittesting on image maps r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D148556
This commit is contained in:
Morgan Rae Reschenberg 2022-06-13 22:28:36 +00:00
parent 2fbf4cf4f2
commit 894d3bd827
2 changed files with 25 additions and 12 deletions

View File

@ -3248,6 +3248,22 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
acc = acc->LocalParent();
}
if (acc->IsImageMap()) {
// Layout doesn't walk image maps, so we do that
// manually here. We do this before adding the map itself
// so the children come earlier in the hittesting order.
for (uint32_t i = 0; i < acc->ChildCount(); i++) {
LocalAccessible* child = acc->LocalChildAt(i);
MOZ_ASSERT(child);
if (inViewAccs.EnsureInserted(child)) {
viewportCache.AppendElement(
child->IsDoc()
? 0
: reinterpret_cast<uint64_t>(child->UniqueID()));
}
}
}
if (inViewAccs.EnsureInserted(acc)) {
viewportCache.AppendElement(
acc->IsDoc() ? 0 : reinterpret_cast<uint64_t>(acc->UniqueID()));

View File

@ -129,19 +129,16 @@ async function runTests(browser, accDoc) {
const area = findAccessibleChildByID(accDoc, "area");
await testChildAtPoint(dpr, 1, 1, area, area, area);
todo(
false,
"Test image maps. Their children are not in the layout tree. See bug 1772609"
info("Test image maps. Their children are not in the layout tree.");
const imgmap = findAccessibleChildByID(accDoc, "imgmap");
const theLetterA = imgmap.firstChild;
await hitTest(browser, imgmap, theLetterA, theLetterA);
await hitTest(
browser,
findAccessibleChildByID(accDoc, "container"),
imgmap,
theLetterA
);
// const imgmap = findAccessibleChildByID(accDoc, "imgmap");
// const theLetterA = imgmap.firstChild;
// await hitTest(browser, imgmap, theLetterA, theLetterA);
// await hitTest(
// browser,
// findAccessibleChildByID(accDoc, "container"),
// imgmap,
// theLetterA
// );
info("hit testing for element contained by zero-width element");
const container2Input = findAccessibleChildByID(accDoc, "container2_input");