Bug 606924, part2 - create initial tree, r=davidb, a=blocking2.0Final+

This commit is contained in:
Alexander Surkov
2011-01-24 10:58:00 +08:00
parent b26e914f8a
commit f80177173d
2 changed files with 27 additions and 1 deletions

View File

@@ -54,8 +54,10 @@
NotificationController::NotificationController(nsDocAccessible* aDocument,
nsIPresShell* aPresShell) :
mObservingState(eNotObservingRefresh), mDocument(aDocument),
mPresShell(aPresShell)
mPresShell(aPresShell), mTreeConstructedState(eTreeConstructionPending)
{
// Schedule initial accessible tree construction.
ScheduleProcessing();
}
NotificationController::~NotificationController()
@@ -129,6 +131,10 @@ NotificationController::ScheduleContentInsertion(nsAccessible* aContainer,
nsIContent* aStartChildNode,
nsIContent* aEndChildNode)
{
// Ignore content insertions until we constructed accessible tree.
if (mTreeConstructedState == eTreeConstructionPending)
return;
nsRefPtr<ContentInsertion> insertion =
new ContentInsertion(mDocument, aContainer, aStartChildNode, aEndChildNode);
@@ -177,6 +183,15 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
// insertions or generic notifications.
mObservingState = eRefreshProcessingForUpdate;
// Initial accessible tree construction.
if (mTreeConstructedState == eTreeConstructionPending) {
mTreeConstructedState = eTreeConstructed;
mDocument->CacheChildrenInSubtree(mDocument);
NS_ASSERTION(mContentInsertions.Length() == 0,
"Pending content insertions while initial accessible tree isn't created!");
}
// Process content inserted notifications to update the tree. Process other
// notifications like DOM events and then flush event queue. If any new
// notifications are queued during this processing then they will be processed