Bug 1415960 - Use flattened tree parent when returning GetContainerAccessible. r=Jamie

This fixes an inconsistency where CacheChildrenInSubtree uses the
flattened tree via DOM child iterators, but ProcessInvalidationList uses
GetContainerAccessible that doesn't currently use the flattened tree.

Differential Revision: https://phabricator.services.mozilla.com/D108980
This commit is contained in:
Eitan Isaacson 2021-03-22 16:21:08 +00:00
Родитель dcef02cab1
Коммит 30b42bba1c
3 изменённых файлов: 33 добавлений и 3 удалений

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

@ -1362,6 +1362,11 @@ LocalAccessible* DocAccessible::GetAccessibleOrContainer(
return nullptr;
}
LocalAccessible* DocAccessible::GetContainerAccessible(nsINode* aNode) const {
return aNode ? GetAccessibleOrContainer(aNode->GetFlattenedTreeParentNode())
: nullptr;
}
LocalAccessible* DocAccessible::GetAccessibleOrDescendant(
nsINode* aNode) const {
LocalAccessible* acc = GetAccessible(aNode);

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

@ -277,9 +277,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
/**
* Return a container accessible for the given DOM node.
*/
LocalAccessible* GetContainerAccessible(nsINode* aNode) const {
return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
}
LocalAccessible* GetContainerAccessible(nsINode* aNode) const;
/**
* Return an accessible for the given node if any, or an immediate accessible

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

@ -168,7 +168,18 @@
(container, host) => {
host.shadowRoot.getElementById("slot").remove();
}, { SECTION: [{ SECTION: [{ name: "green"} ] }] });
}
function shadowProcessInvalidation() {
testAccessibleTree("shadowProcessInvalidation",
{ SECTION: [{
SECTION: [{
SECTION: [{ TEXT_LEAF: { name: "Hello "} },
{ TEXT: [{ TEXT_LEAF: { name: "World"} }] },
{ PUSHBUTTON: { name: "World"} }]
}]
}]
});
}
async function doTest() {
@ -202,6 +213,8 @@
await shadowReassignDynamic_4();
shadowProcessInvalidation();
SimpleTest.finish();
}
@ -462,6 +475,20 @@
</script>
</div>
<div id="shadowProcessInvalidation">
<template class="shadowtree">
<div id="shadowdiv">
<slot></slot>
</div>
</template>
<section class="host">Hello <span id="c">World</span><button aria-labelledby="c"></button></section>
<script>
document.querySelector("#shadowProcessInvalidation > .host")
.attachShadow({ mode: "open" })
.appendChild(document.querySelector("#shadowProcessInvalidation > .shadowtree").content.cloneNode(true));
</script>
</div>
<div id="eventdump"></div>
</body>
</html>