зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1301770 - dismiss mutation events if their container has been shown or hidden afterwards, r=yzen
This commit is contained in:
Родитель
91bfa8067c
Коммит
898680fc8e
|
@ -445,9 +445,16 @@ EventTree::Mutated(AccMutationEvent* aEv)
|
|||
// discard those subtree mutations as we are no longer interested in them.
|
||||
UniquePtr<EventTree>* node = &mFirst;
|
||||
while (*node) {
|
||||
if ((*node)->mContainer == aEv->mAccessible) {
|
||||
*node = Move((*node)->mNext);
|
||||
break;
|
||||
Accessible* cntr = (*node)->mContainer;
|
||||
while (cntr != mContainer) {
|
||||
if (cntr == aEv->mAccessible) {
|
||||
*node = Move((*node)->mNext);
|
||||
break;
|
||||
}
|
||||
cntr = cntr->Parent();
|
||||
}
|
||||
if (cntr == aEv->mAccessible) {
|
||||
continue;
|
||||
}
|
||||
node = &(*node)->mNext;
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ function eventQueue(aEventType)
|
|||
if (matchIdx == -1 || eventSeq.length > 0)
|
||||
matchIdx = scnIdx;
|
||||
|
||||
// Report everythign is ok.
|
||||
// Report everything is ok.
|
||||
for (var idx = 0; idx < eventSeq.length; idx++) {
|
||||
var checker = eventSeq[idx];
|
||||
|
||||
|
@ -346,15 +346,15 @@ function eventQueue(aEventType)
|
|||
"' succeed. ";
|
||||
|
||||
if (checker.unexpected) {
|
||||
if (checker.todo) {
|
||||
todo(false, "Event " + typeStr + " event is still missing");
|
||||
}
|
||||
else {
|
||||
ok(true, msg + "There's no unexpected " + typeStr + " event.");
|
||||
}
|
||||
ok(true, msg + `There's no unexpected '${typeStr}' event.`);
|
||||
}
|
||||
else {
|
||||
ok(true, msg + "Event " + typeStr + " was handled.");
|
||||
if (checker.todo) {
|
||||
todo(false, `Todo event '${typeStr}' was caught`);
|
||||
}
|
||||
else {
|
||||
ok(true, `${msg} Event '${typeStr}' was handled.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,15 +378,13 @@ function eventQueue(aEventType)
|
|||
ok(false, msg + "Dupe " + typeStr + " event.");
|
||||
|
||||
if (checker.unexpected) {
|
||||
if (checker.todo) {
|
||||
todo(checker.wasCaught,
|
||||
"Event " + typeStr + " event is still missing");
|
||||
}
|
||||
else if (checker.wasCaught) {
|
||||
if (checker.wasCaught) {
|
||||
ok(false, msg + "There's unexpected " + typeStr + " event.");
|
||||
}
|
||||
} else if (!checker.wasCaught) {
|
||||
ok(false, msg + typeStr + " event was missed.");
|
||||
}
|
||||
else if (!checker.wasCaught) {
|
||||
var rf = checker.todo ? todo : ok;
|
||||
rf(false, `${msg} '${typeStr} event is missed.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -596,6 +594,7 @@ function eventQueue(aEventType)
|
|||
|
||||
while (aEventSeq.idx < aEventSeq.length &&
|
||||
(aEventSeq[aEventSeq.idx].unexpected ||
|
||||
aEventSeq[aEventSeq.idx].todo ||
|
||||
aEventSeq[aEventSeq.idx].async ||
|
||||
aEventSeq[aEventSeq.idx].wasCaught > 0)) {
|
||||
aEventSeq.idx++;
|
||||
|
@ -612,7 +611,8 @@ function eventQueue(aEventType)
|
|||
// Check if we have unhandled async (can be anywhere in the sequance) or
|
||||
// sync expcected events yet.
|
||||
for (var idx = 0; idx < aEventSeq.length; idx++) {
|
||||
if (!aEventSeq[idx].unexpected && !aEventSeq[idx].wasCaught)
|
||||
if (!aEventSeq[idx].unexpected && !aEventSeq[idx].todo &&
|
||||
!aEventSeq[idx].wasCaught)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ function eventQueue(aEventType)
|
|||
for (var scnIdx = 0; scnIdx < this.mScenarios.length; scnIdx++) {
|
||||
var eventSeq = this.mScenarios[scnIdx];
|
||||
for (var idx = 0; idx < eventSeq.length; idx++) {
|
||||
if (eventSeq[idx].unexpected)
|
||||
if (eventSeq[idx].unexpected || eventSeq[idx].todo)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ function eventQueue(aEventType)
|
|||
function eventQueue_isUnexpectedEventsScenario(aScenario)
|
||||
{
|
||||
for (var idx = 0; idx < aScenario.length; idx++) {
|
||||
if (!aScenario[idx].unexpected)
|
||||
if (!aScenario[idx].unexpected && !aScenario[idx].todo)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1686,8 +1686,6 @@ function todo_invokerChecker(aEventType, aTargetOrFunc, aTargetFuncArg)
|
|||
{
|
||||
this.__proto__ = new invokerChecker(aEventType, aTargetOrFunc,
|
||||
aTargetFuncArg, true);
|
||||
|
||||
this.unexpected = true;
|
||||
this.todo = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -487,6 +487,41 @@
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert text nodes under direct and grand children, and then hide
|
||||
* their container by means of aria-owns.
|
||||
*
|
||||
* Markup:
|
||||
* <div id="t7_moveplace" aria-owns="t7_c"></div>
|
||||
* <div id="t7_c">
|
||||
* <div id="t7_c_directchild">ha</div>
|
||||
* <div><div id="t7_c_grandchild">ha</div></div>
|
||||
* </div>
|
||||
*/
|
||||
function test7()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new todo_invokerChecker(EVENT_HIDE, getNode('t7_c')),
|
||||
new invokerChecker(EVENT_SHOW, getNode('t7_c')),
|
||||
new invokerChecker(EVENT_REORDER, getNode('t7')),
|
||||
new unexpectedInvokerChecker(EVENT_REORDER, getNode('t7_c_directchild')),
|
||||
new unexpectedInvokerChecker(EVENT_REORDER, getNode('t7_c_grandchild')),
|
||||
new unexpectedInvokerChecker(EVENT_SHOW, () => getNode('t7_c_directchild').firstChild),
|
||||
new unexpectedInvokerChecker(EVENT_SHOW, () => getNode('t7_c_grandchild').firstChild)
|
||||
];
|
||||
|
||||
this.invoke = function test7_invoke()
|
||||
{
|
||||
getNode('t7_c_directchild').textContent = 'ha';
|
||||
getNode('t7_c_grandchild').textContent = 'ha';
|
||||
getNode('t7_moveplace').setAttribute('aria-owns', 't7_c');
|
||||
};
|
||||
|
||||
this.getID = function test7_getID() {
|
||||
return "Show child accessibles and then hide their container";
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests.
|
||||
|
||||
|
@ -519,6 +554,7 @@
|
|||
gQueue.push(new test4());
|
||||
gQueue.push(new test5());
|
||||
gQueue.push(new test6());
|
||||
gQueue.push(new test7());
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
@ -612,5 +648,13 @@
|
|||
|
||||
<div id="t6">
|
||||
</div>
|
||||
|
||||
<div id="t7">
|
||||
<div id="t7_moveplace"></div>
|
||||
<div id="t7_c">
|
||||
<div><div id="t7_c_grandchild"></div></div>
|
||||
<div id="t7_c_directchild"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче