зеркало из https://github.com/mozilla/gecko-dev.git
bug 1270916 - switch to use the new mutation event queue system r=davidb
This puts events in the queue instead of the event tree, and then fires them based on the queue. Some tests need to be adjusted to make sure they check constraints on event order correctly.
This commit is contained in:
Родитель
4e7e9203c9
Коммит
446c2b1395
|
@ -63,18 +63,14 @@ TreeMutation::AfterInsertion(Accessible* aChild)
|
|||
mStartIdx = aChild->mIndexInParent + 1;
|
||||
}
|
||||
|
||||
if (!mEventTree) {
|
||||
mEventTree = Controller()->QueueMutation(mParent);
|
||||
if (!mEventTree) {
|
||||
mEventTree = kNoEventTree;
|
||||
}
|
||||
if (!mQueueEvents) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEventTree != kNoEventTree) {
|
||||
RefPtr<AccShowEvent> ev = new AccShowEvent(aChild);
|
||||
mEventTree->Mutated(ev);
|
||||
Controller()->QueueNameChange(aChild);
|
||||
}
|
||||
RefPtr<AccShowEvent> ev = new AccShowEvent(aChild);
|
||||
DebugOnly<bool> added = Controller()->QueueMutationEvent(ev);
|
||||
MOZ_ASSERT(added);
|
||||
aChild->SetShowEventTarget(true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -86,17 +82,13 @@ TreeMutation::BeforeRemoval(Accessible* aChild, bool aNoShutdown)
|
|||
mStartIdx = aChild->mIndexInParent;
|
||||
}
|
||||
|
||||
if (!mEventTree) {
|
||||
mEventTree = Controller()->QueueMutation(mParent);
|
||||
if (!mEventTree) {
|
||||
mEventTree = kNoEventTree;
|
||||
}
|
||||
if (!mQueueEvents) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEventTree != kNoEventTree) {
|
||||
RefPtr<AccHideEvent> ev = new AccHideEvent(aChild, !aNoShutdown);
|
||||
mEventTree->Mutated(ev);
|
||||
Controller()->QueueNameChange(aChild);
|
||||
RefPtr<AccHideEvent> ev = new AccHideEvent(aChild, !aNoShutdown);
|
||||
if (Controller()->QueueMutationEvent(ev)) {
|
||||
aChild->SetHideEventTarget(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -802,9 +802,9 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
|||
// events causes script to run.
|
||||
mObservingState = eRefreshProcessing;
|
||||
|
||||
RefPtr<DocAccessible> deathGrip(mDocument);
|
||||
mEventTree.Process(deathGrip);
|
||||
deathGrip = nullptr;
|
||||
CoalesceMutationEvents();
|
||||
ProcessMutationEvents();
|
||||
mEventGeneration = 0;
|
||||
|
||||
// Now that we are done with them get rid of the events we fired.
|
||||
RefPtr<AccTreeMutationEvent> mutEvent = Move(mFirstMutationEvent);
|
||||
|
|
|
@ -2158,10 +2158,9 @@ Accessible::MoveChild(uint32_t aNewIndex, Accessible* aChild)
|
|||
"No move, same index");
|
||||
MOZ_ASSERT(aNewIndex <= mChildren.Length(), "Wrong new index was given");
|
||||
|
||||
EventTree* eventTree = mDoc->Controller()->QueueMutation(this);
|
||||
if (eventTree) {
|
||||
RefPtr<AccHideEvent> event = new AccHideEvent(aChild, false);
|
||||
eventTree->Mutated(event);
|
||||
RefPtr<AccHideEvent> hideEvent = new AccHideEvent(aChild, false);
|
||||
if (mDoc->Controller()->QueueMutationEvent(hideEvent)) {
|
||||
aChild->SetHideEventTarget(true);
|
||||
}
|
||||
|
||||
mEmbeddedObjCollector = nullptr;
|
||||
|
@ -2193,11 +2192,10 @@ Accessible::MoveChild(uint32_t aNewIndex, Accessible* aChild)
|
|||
mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1;
|
||||
}
|
||||
|
||||
if (eventTree) {
|
||||
RefPtr<AccShowEvent> event = new AccShowEvent(aChild);
|
||||
eventTree->Mutated(event);
|
||||
mDoc->Controller()->QueueNameChange(aChild);
|
||||
}
|
||||
RefPtr<AccShowEvent> showEvent = new AccShowEvent(aChild);
|
||||
DebugOnly<bool> added = mDoc->Controller()->QueueMutationEvent(showEvent);
|
||||
MOZ_ASSERT(added);
|
||||
aChild->SetShowEventTarget(true);
|
||||
}
|
||||
|
||||
Accessible*
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
// related show event.
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_SHOW, this.menuNode),
|
||||
new asyncInvokerChecker(EVENT_MENUPOPUP_START, this.menuNode),
|
||||
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID))
|
||||
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID)),
|
||||
new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode)
|
||||
];
|
||||
|
||||
this.invoke = function showMenu_invoke()
|
||||
|
|
|
@ -419,8 +419,8 @@
|
|||
this.lb = getAccessible("t5_lb");
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, this.o),
|
||||
new invokerChecker(EVENT_HIDE, this.b),
|
||||
new invokerChecker(EVENT_HIDE, this.o),
|
||||
new invokerChecker(EVENT_REORDER, "t5"),
|
||||
new unexpectedInvokerChecker(EVENT_HIDE, this.ofc),
|
||||
new unexpectedInvokerChecker(EVENT_REORDER, this.o),
|
||||
|
@ -539,8 +539,8 @@
|
|||
new invokerChecker(EVENT_HIDE, getNode('t8_c1_child')),
|
||||
new invokerChecker(EVENT_HIDE, 't8_c2_moved'),
|
||||
new invokerChecker(EVENT_SHOW, 't8_c2_moved'),
|
||||
new invokerChecker(EVENT_REORDER, 't8_c2'),
|
||||
new invokerChecker(EVENT_REORDER, 't8_c1'),
|
||||
new invokerChecker(EVENT_REORDER, 't8_c2')
|
||||
];
|
||||
|
||||
this.invoke = function test8_invoke()
|
||||
|
@ -578,13 +578,13 @@
|
|||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode('t9_c1_child')),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t9_c2_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 invokerChecker(EVENT_REORDER, 't9_c2'),
|
||||
new invokerChecker(EVENT_REORDER, 't9_c1'),
|
||||
new unexpectedInvokerChecker(EVENT_SHOW, 't9_c3_moved')
|
||||
];
|
||||
|
||||
|
@ -624,12 +624,12 @@
|
|||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode('t10_c1_child')),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t10_c2_child')),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t10_c2_moved')),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t10_c3_moved')),
|
||||
new invokerChecker(EVENT_SHOW, getNode('t10_c2_moved')),
|
||||
new invokerChecker(EVENT_REORDER, 't10_c1'),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t10_c2_child')),
|
||||
new invokerChecker(EVENT_REORDER, 't10_c2'),
|
||||
new invokerChecker(EVENT_REORDER, 't10_c1'),
|
||||
new invokerChecker(EVENT_REORDER, 't10_c3')
|
||||
];
|
||||
|
||||
|
@ -659,9 +659,11 @@
|
|||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode('t11_c1_child')),
|
||||
new invokerChecker(EVENT_SHOW, 't11_c2_child'),
|
||||
new invokerChecker(EVENT_HIDE, getNode('t11_c2')),
|
||||
new invokerChecker(EVENT_SHOW, 't11_c2'),
|
||||
new orderChecker(),
|
||||
new asyncInvokerChecker(EVENT_SHOW, 't11_c2_child'),
|
||||
new asyncInvokerChecker(EVENT_SHOW, 't11_c2'),
|
||||
new orderChecker(),
|
||||
new invokerChecker(EVENT_REORDER, 't11'),
|
||||
new unexpectedInvokerChecker(EVENT_HIDE, 't11_c2_child'),
|
||||
new unexpectedInvokerChecker(EVENT_REORDER, 't11_c1'),
|
||||
|
@ -689,7 +691,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests.
|
||||
|
||||
//gA11yEventDumpToConsole = true; // debug stuff
|
||||
gA11yEventDumpToConsole = true; // debug stuff
|
||||
//enableLogging("eventTree");
|
||||
|
||||
var gQueue = null;
|
||||
|
|
|
@ -341,8 +341,8 @@
|
|||
this.containerNode = getNode(aContainerID);
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_SHOW, function(aNode) { return aNode.lastChild; }, this.containerNode),
|
||||
new invokerChecker(EVENT_SHOW, function(aNode) { return aNode.firstChild; }, this.containerNode),
|
||||
new invokerChecker(EVENT_SHOW, function(aNode) { return aNode.lastChild; }, this.containerNode),
|
||||
new invokerChecker(EVENT_REORDER, this.containerNode)
|
||||
];
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_subdiv")),
|
||||
// no hide for t1_subdiv because it is contained by hidden t1_checkbox
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_checkbox")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_checkbox")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_REORDER, getNode("t1_container"))
|
||||
];
|
||||
|
||||
|
@ -73,10 +73,12 @@
|
|||
function removeARIAOwns()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_subdiv")),
|
||||
new orderChecker(),
|
||||
new asyncInvokerChecker(EVENT_SHOW, getNode("t1_button")),
|
||||
new asyncInvokerChecker(EVENT_SHOW, getNode("t1_subdiv")),
|
||||
new orderChecker(),
|
||||
new invokerChecker(EVENT_REORDER, getNode("t1_container")),
|
||||
new unexpectedInvokerChecker(EVENT_REORDER, getNode("t1_checkbox"))
|
||||
];
|
||||
|
@ -108,8 +110,8 @@
|
|||
function setARIAOwns()
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_HIDE, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_button")),
|
||||
new invokerChecker(EVENT_SHOW, getNode("t1_subdiv")),
|
||||
new invokerChecker(EVENT_REORDER, getNode("t1_container"))
|
||||
|
@ -447,6 +449,9 @@
|
|||
this.eventSeq = [];
|
||||
for (var id of aIdList) {
|
||||
this.eventSeq.push(new invokerChecker(EVENT_HIDE, getNode(id)));
|
||||
}
|
||||
|
||||
for (var id of aIdList) {
|
||||
this.eventSeq.push(new invokerChecker(EVENT_SHOW, getNode(id)));
|
||||
}
|
||||
this.eventSeq.push(new invokerChecker(EVENT_REORDER, getNode(aContainer)));
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
this.containerNode = getNode("outerDiv");
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, getNode("child")),
|
||||
new invokerChecker(EVENT_HIDE, getNode("childDoc")),
|
||||
new invokerChecker(EVENT_SHOW, "newChildDoc"),
|
||||
new invokerChecker(EVENT_HIDE, getNode("child")),
|
||||
new invokerChecker(EVENT_REORDER, this.containerNode)
|
||||
];
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
|
||||
//enableLogging("tree");
|
||||
//gA11yEventDumpToConsole = true;
|
||||
gA11yEventDumpToConsole = true;
|
||||
var gQueue = null;
|
||||
function doTest()
|
||||
{
|
||||
|
|
|
@ -101,8 +101,9 @@
|
|||
this.imgNode.setAttribute("src", "../moz.png");
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.imgNode),
|
||||
new invokerChecker(EVENT_SHOW, getAccessible, this.textNode),
|
||||
new asyncInvokerChecker(EVENT_SHOW, getAccessible, this.textNode),
|
||||
new asyncInvokerChecker(EVENT_SHOW, getAccessible, this.imgNode),
|
||||
new orderChecker(),
|
||||
new invokerChecker(EVENT_REORDER, this.topNode)
|
||||
];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче