Bug 1581589 - Return null in GetAccessibleOrContainer for text leafs of unrendered maps. r=Jamie

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2019-09-26 01:51:45 +00:00
parent b428602d25
commit b591abf5e0
2 changed files with 30 additions and 0 deletions

View File

@ -1193,6 +1193,16 @@ Accessible* DocAccessible::GetAccessibleOrContainer(
}
}
// Check if node is in zero-sized map
if (aNoContainerIfPruned && currNode->IsHTMLElement(nsGkAtoms::map)) {
if (nsIFrame* frame = currNode->AsContent()->GetPrimaryFrame()) {
if (nsLayoutUtils::GetAllInFlowRectsUnion(frame, frame->GetParent())
.IsEmpty()) {
return nullptr;
}
}
}
if (Accessible* accessible = GetAccessible(currNode)) {
return accessible;
}

View File

@ -135,6 +135,18 @@
};
}
function dontCreateMapWhiteSpace() {
const tree = { SECTION: [ { role: ROLE_TEXT_LEAF, name: "x" }, { TABLE: [ { ROW: [] }] } ] };
testAccessibleTree("container3", tree);
getNode("b").align = "Right";
document.body.offsetTop; // Flush layout.
window.windowUtils.advanceTimeAndRefresh(100);
testAccessibleTree("container3", tree);
window.windowUtils.restoreNormalRefresh();
}
// //////////////////////////////////////////////////////////////////////////
// Test
@ -144,6 +156,8 @@
var gQueue = null;
function doTest() {
dontCreateMapWhiteSpace();
gQueue = new eventQueue();
gQueue.push(new removeImg());
@ -175,6 +189,12 @@
<div id="container1"><img src="../moz.png"> <img id="img1" src="../moz.png"> <img src="../moz.png"></div>
<div><a id="container2"></a> <a><img src="../moz.png"></a></div>
<div id="container3">
<div id="c3_inner" role="presentation">
x<map> </map><table id="b"><tr></tr></table>
</div>
</div>
<div id="eventdump"></div>
</body>
</html>