Bug 1580292 - Check for pruned descendants of reframed body. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D45423

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2019-09-11 18:32:07 +00:00
parent 4b3b42e7be
commit db60a948f1
2 changed files with 54 additions and 0 deletions

View file

@ -1206,6 +1206,11 @@ Accessible* DocAccessible::GetAccessibleOrDescendant(nsINode* aNode) const {
if (acc) return acc;
acc = GetContainerAccessible(aNode);
if (acc == this && aNode == mContent) {
// The body node is the doc's content node.
return acc;
}
if (acc) {
uint32_t childCnt = acc->ChildCount();
for (uint32_t idx = 0; idx < childCnt; idx++) {

View file

@ -213,6 +213,49 @@
window.windowUtils.restoreNormalRefresh();
}
// Check to see that a reframed body gets its children pruned correctly.
async function bodyReframe(argument) {
// Load sub-document in iframe.
let event = waitForEvent(EVENT_REORDER, "iframe", "bodyReframe");
getNode("iframe").src =
`data:text/html,<div>Hello</div><div style="display: none">World</div>`;
await event;
// Initial tree should have one section leaf.
testAccessibleTree("c10",{ SECTION: [
{ INTERNAL_FRAME: [
{ DOCUMENT: [
{ SECTION: [
{ role: ROLE_TEXT_LEAF, name: "Hello" }
] }
]}
] }
] });
let iframeDoc = getNode("iframe").contentWindow.document;
// Trigger coalesced reframing. Both the body node and its children
// will need reframing.
event = waitForEvent(EVENT_REORDER, iframeDoc, "bodyReframe");
iframeDoc.body.style.display = "inline-block";
iframeDoc.querySelector("div:first-child").style.display = "none";
iframeDoc.querySelector("div:last-child").style.display = "block";
await event;
// Only the second section should be showing
testAccessibleTree("c10",{ SECTION: [
{ INTERNAL_FRAME: [
{ DOCUMENT: [
{ SECTION: [
{ role: ROLE_TEXT_LEAF, name: "World" }
] }
]}
] }
] });
}
async function doTest() {
await hideDivFromInsideSpan();
@ -234,6 +277,8 @@
listItemReframe();
await bodyReframe();
SimpleTest.finish();
}
@ -293,6 +338,10 @@
</ul>
</div>
<div id="c10">
<iframe id="iframe"></iframe>
</div>
<div id="eventdump"></div>
</body>
</html>