diff --git a/accessible/base/EventTree.cpp b/accessible/base/EventTree.cpp index 2f57758e346e..55b37c5bdfad 100644 --- a/accessible/base/EventTree.cpp +++ b/accessible/base/EventTree.cpp @@ -258,6 +258,24 @@ EventTree::FindOrInsert(Accessible* aContainer) // We got a match. if (parent->Parent() == node->mContainer) { + // Reject the node if it's contained by a show/hide event target + uint32_t evCount = node->mDependentEvents.Length(); + for (uint32_t idx = 0; idx < evCount; idx++) { + AccMutationEvent* ev = node->mDependentEvents[idx]; + if (ev->GetAccessible() == parent) { +#ifdef A11Y_LOG + if (logging::IsEnabledAll(logging::eEventTree | + logging::eVerbose)) { + logging::MsgBegin("EVENTS_TREE", + "Rejecting node since contained by show/hide target"); + logging::AccessibleInfo("Container", aContainer); + logging::MsgEnd(); + } +#endif + return nullptr; + } + } + return node->FindOrInsert(aContainer); } diff --git a/accessible/tests/mochitest/events/test_coalescence.html b/accessible/tests/mochitest/events/test_coalescence.html index aaa88d2b665b..58bf6a82393a 100644 --- a/accessible/tests/mochitest/events/test_coalescence.html +++ b/accessible/tests/mochitest/events/test_coalescence.html @@ -446,6 +446,47 @@ } } + /** + * Insert accessibles with a child node moved by aria-owns + * Markup: + *
+ *
+ *
+ *
+ */ + function test6() + { + this.parent = getNode("t6"); + this.fc = document.createElement("div"); + this.fc.setAttribute("id", "t6_fc"); + this.owns = document.createElement("div"); + this.owns.setAttribute("id", "t6_owns"); + this.sc = document.createElement("div"); + this.sc.setAttribute("id", "t6_sc"); + + this.eventSeq = [ + new invokerChecker(EVENT_SHOW, this.fc), + new invokerChecker(EVENT_SHOW, this.sc), + new invokerChecker(EVENT_REORDER, this.parent), + new unexpectedInvokerChecker(EVENT_REORDER, this.fc), + new unexpectedInvokerChecker(EVENT_REORDER, this.sc), + new unexpectedInvokerChecker(EVENT_HIDE, this.owns), + new unexpectedInvokerChecker(EVENT_SHOW, this.owns) + ]; + + this.invoke = function test6_invoke() + { + getNode("t6").appendChild(this.fc); + getNode("t6_fc").appendChild(this.owns); + getNode("t6").appendChild(this.sc); + getNode("t6_sc").setAttribute("aria-owns", "t6_owns"); + }; + + this.getID = function test6_getID() { + return "Insert accessibles with a child node moved by aria-owns"; + }; + } + //////////////////////////////////////////////////////////////////////////// // Do tests. @@ -477,6 +518,7 @@ gQueue.push(new test3()); gQueue.push(new test4()); gQueue.push(new test5()); + gQueue.push(new test6()); gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -567,5 +609,8 @@
opt
+ +
+