Bug 1260494 - rebuild child indexes by AutoTreeMutation guard, r=yzen

This commit is contained in:
Alexander Surkov
2016-04-01 10:53:52 -04:00
parent 103698a9ce
commit f593fda2fd
5 changed files with 110 additions and 127 deletions

View File

@@ -88,7 +88,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
return;
bool treeChanged = false;
AutoTreeMutation mut(this);
AutoTreeMutation mt(this);
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
// Remove areas that are not a valid part of the image map anymore.
@@ -103,6 +103,7 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
reorderEvent->AddSubMutationEvent(event);
}
mt.BeforeRemoval(area);
RemoveChild(area);
treeChanged = true;
}
@@ -121,6 +122,8 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
break;
}
mt.AfterInsertion(area);
if (aDoFireEvents) {
RefPtr<AccShowEvent> event = new AccShowEvent(area);
mDoc->FireDelayedEvent(event);
@@ -131,12 +134,11 @@ HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
}
}
mt.Done();
// Fire reorder event if needed.
if (treeChanged && aDoFireEvents)
mDoc->FireDelayedEvent(reorderEvent);
if (!treeChanged)
mut.mInvalidationRequired = false;
}
Accessible*