Bug 646369 - UpdateTree should rely on accessible tree walker rather than DOM tree traversal, r=davidb
This commit is contained in:
@@ -157,11 +157,12 @@ NotificationController::ScheduleContentInsertion(nsAccessible* aContainer,
|
||||
if (mTreeConstructedState == eTreeConstructionPending)
|
||||
return;
|
||||
|
||||
nsRefPtr<ContentInsertion> insertion =
|
||||
new ContentInsertion(mDocument, aContainer, aStartChildNode, aEndChildNode);
|
||||
|
||||
if (insertion && mContentInsertions.AppendElement(insertion))
|
||||
nsRefPtr<ContentInsertion> insertion = new ContentInsertion(mDocument,
|
||||
aContainer);
|
||||
if (insertion && insertion->InitChildList(aStartChildNode, aEndChildNode) &&
|
||||
mContentInsertions.AppendElement(insertion)) {
|
||||
ScheduleProcessing();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -681,15 +682,31 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
|
||||
// NotificationController: content inserted notification
|
||||
|
||||
NotificationController::ContentInsertion::
|
||||
ContentInsertion(nsDocAccessible* aDocument, nsAccessible* aContainer,
|
||||
nsIContent* aStartChildNode, nsIContent* aEndChildNode) :
|
||||
ContentInsertion(nsDocAccessible* aDocument, nsAccessible* aContainer) :
|
||||
mDocument(aDocument), mContainer(aContainer)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
NotificationController::ContentInsertion::
|
||||
InitChildList(nsIContent* aStartChildNode, nsIContent* aEndChildNode)
|
||||
{
|
||||
bool haveToUpdate = false;
|
||||
|
||||
nsIContent* node = aStartChildNode;
|
||||
while (node != aEndChildNode) {
|
||||
mInsertedContent.AppendElement(node);
|
||||
// Notification triggers for content insertion even if no content was
|
||||
// actually inserted, check if the given content has a frame to discard
|
||||
// this case early.
|
||||
if (node->GetPrimaryFrame()) {
|
||||
if (mInsertedContent.AppendElement(node))
|
||||
haveToUpdate = true;
|
||||
}
|
||||
|
||||
node = node->GetNextSibling();
|
||||
}
|
||||
|
||||
return haveToUpdate;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(NotificationController::ContentInsertion)
|
||||
|
||||
Reference in New Issue
Block a user