Bug 1294853 part2 - hide should preceed a parent show if event tree is trimmed, r=yzen

This commit is contained in:
Alexander Surkov 2016-09-30 10:46:05 -04:00
Родитель 63e52fcef6
Коммит 33530da7cc
2 изменённых файлов: 111 добавлений и 0 удалений

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

@ -484,6 +484,59 @@ EventTree::Mutated(AccMutationEvent* aEv)
Accessible* cntr = (*node)->mContainer;
while (cntr != mContainer) {
if (cntr == aEv->mAccessible) {
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eEventTree)) {
logging::MsgBegin("EVENTS_TREE", "Trim subtree");
logging::AccessibleInfo("Show/hide container", aEv->mAccessible);
logging::AccessibleInfo("Trimmed subtree root", (*node)->mContainer);
logging::MsgEnd();
}
#endif
// If the new hide is part of a move and it contains existing child
// shows, then move preceding events from the child shows to the buffer,
// so the ongoing show event will pick them up.
if (aEv->IsHide()) {
AccHideEvent* hideEv = downcast_accEvent(aEv);
if (!hideEv->mNeedsShutdown) {
for (uint32_t i = 0; i < (*node)->mDependentEvents.Length(); i++) {
AccMutationEvent* childEv = (*node)->mDependentEvents[i];
if (childEv->IsShow()) {
AccShowEvent* childShowEv = downcast_accEvent(childEv);
if (childShowEv->mPrecedingEvents.Length() > 0) {
Controller(mContainer)->StorePrecedingEvents(
mozilla::Move(childShowEv->mPrecedingEvents));
}
}
}
}
}
// If the new show contains existing child shows, then move preceding
// events from the child shows to the new show.
else if (aEv->IsShow()) {
AccShowEvent* showEv = downcast_accEvent(aEv);
for (uint32_t i = 0; (*node)->mDependentEvents.Length(); i++) {
AccMutationEvent* childEv = (*node)->mDependentEvents[i];
if (childEv->IsShow()) {
AccShowEvent* showChildEv = downcast_accEvent(childEv);
if (showChildEv->mPrecedingEvents.Length() > 0) {
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eEventTree)) {
logging::MsgBegin("EVENTS_TREE", "Adopt preceding events");
logging::AccessibleInfo("Parent", aEv->mAccessible);
for (uint32_t j = 0; j < showChildEv->mPrecedingEvents.Length(); j++) {
logging::AccessibleInfo("Adoptee",
showChildEv->mPrecedingEvents[i]->mAccessible);
}
logging::MsgEnd();
}
#endif
showEv->mPrecedingEvents.AppendElements(showChildEv->mPrecedingEvents);
}
}
}
}
*node = Move((*node)->mNext);
break;
}

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

@ -558,6 +558,52 @@
};
}
/**
* Move 't9_c2_moved' node by aria-owns, and then move 't9_c3_moved' node
* under 't9_c2_moved' (same as test9 but has different aria-owns
* ordering), the eventing looks same way as in test9:
* reorder for 't9_c1'
* hide for 't9_c1_child'
* show for 't9_c2_moved'
* reorder for 't9_c2'
* hide for 't9_c2_moved'
* reorder for 't9_c3'
* hide for 't9_c3_moved'
*
* The hide events for 't9_c2_moved' and 't9_c3_moved' should be delivered
* before the show event for 't9_c2_moved'.
*/
function test9()
{
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t9_c1_child')),
new invokerChecker(EVENT_HIDE, 't9_c3_moved'),
new invokerChecker(EVENT_HIDE, 't9_c2_moved'),
new invokerChecker(EVENT_SHOW, 't9_c2_moved'),
new invokerChecker(EVENT_REORDER, 't9_c1'),
new invokerChecker(EVENT_HIDE, getNode('t9_c2_child')),
new invokerChecker(EVENT_REORDER, 't9_c2'),
new invokerChecker(EVENT_REORDER, 't9_c3'),
new unexpectedInvokerChecker(EVENT_SHOW, 't9_c3_moved')
];
this.invoke = function test9_invoke()
{
// Remove child nodes from 't9_c1' and 't9_c2' containers to give
// the event tree a needed structure ('t9_c1' and 't9_c2' nodes go
// first in the event tree),
getNode('t9_c1_child').remove();
getNode('t9_c2_child').remove();
// then do aria-owns magic.
getNode('t9_c2_moved').setAttribute('aria-owns', 't9_c3_moved');
getNode('t9_c1').setAttribute('aria-owns', 't9_c2_moved');
};
this.getID = function test9_getID() {
return "Move node #1 by aria-owns and then move node #2 into node #1";
};
}
////////////////////////////////////////////////////////////////////////////
// Do tests.
@ -592,6 +638,7 @@
gQueue.push(new test6());
gQueue.push(new test7());
gQueue.push(new test8());
gQueue.push(new test9());
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -699,5 +746,16 @@
<div id="t8_c2_moved"></div>
</div>
</div>
<div id="t9">
<div id="t9_c1"><div id="t9_c1_child"></div></div>
<div id="t9_c2">
<div id="t9_c2_child"></div>
<div id="t9_c2_moved"></div>
</div>
<div id="t9_c3">
<div id="t9_c3_moved"></div>
</div>
</div>
</body>
</html>