Bug 1261425 - coalesce mutation events by a tree structure, r=yzen

This commit is contained in:
Alexander Surkov
2016-04-07 09:30:22 -04:00
parent 86f2dea987
commit 82d8b8a6d2
29 changed files with 896 additions and 562 deletions

View File

@@ -87,9 +87,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
if (!imageMapObj)
return;
bool treeChanged = false;
AutoTreeMutation mt(this);
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
TreeMutation mt(this, TreeMutation::kNoEvents & !aDoFireEvents);
// Remove areas that are not a valid part of the image map anymore.
for (int32_t childIdx = mChildren.Length() - 1; childIdx >= 0; childIdx--) {
@@ -97,15 +95,8 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
if (area->GetContent()->GetPrimaryFrame())
continue;
if (aDoFireEvents) {
RefPtr<AccHideEvent> event = new AccHideEvent(area, area->GetContent());
mDoc->FireDelayedEvent(event);
reorderEvent->AddSubMutationEvent(event);
}
mt.BeforeRemoval(area);
RemoveChild(area);
treeChanged = true;
}
// Insert new areas into the tree.
@@ -123,22 +114,10 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
}
mt.AfterInsertion(area);
if (aDoFireEvents) {
RefPtr<AccShowEvent> event = new AccShowEvent(area);
mDoc->FireDelayedEvent(event);
reorderEvent->AddSubMutationEvent(event);
}
treeChanged = true;
}
}
mt.Done();
// Fire reorder event if needed.
if (treeChanged && aDoFireEvents)
mDoc->FireDelayedEvent(reorderEvent);
}
Accessible*