Bug 485808. Create an iterator class to do forward iteration over the result of GetChildArray(). r+sr=sicking

This commit is contained in:
Boris Zbarsky
2009-04-09 21:36:41 -04:00
parent bbad7f051a
commit 214a757b65
6 changed files with 138 additions and 157 deletions

View File

@@ -173,6 +173,8 @@ NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
PRInt32 nsIContent::sTabFocusModel = eTabFocus_any;
PRBool nsIContent::sTabFocusModelAppliesToXUL = PR_FALSE;
PRUint32 nsMutationGuard::sMutationCount = 0;
nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult);
//----------------------------------------------------------------------
@@ -5123,17 +5125,10 @@ TryMatchingElementsInSubtree(nsINode* aRoot,
char databuf[2 * sizeof(RuleProcessorData)];
RuleProcessorData* prevSibling = nsnull;
RuleProcessorData* data = reinterpret_cast<RuleProcessorData*>(databuf);
PRUint32 count;
nsIContent * const * kidSlot = aRoot->GetChildArray(&count);
nsIContent * const * end = kidSlot + count;
#ifdef DEBUG
nsMutationGuard debugMutationGuard;
#endif
PRBool continueIteration = PR_TRUE;
for (; kidSlot != end; ++kidSlot) {
nsIContent* kid = *kidSlot;
for (nsINode::ChildIterator iter(aRoot); !iter.IsDone(); iter.Next()) {
nsIContent* kid = iter;
if (!kid->IsNodeOfType(nsINode::eELEMENT)) {
continue;
}
@@ -5193,10 +5188,6 @@ TryMatchingElementsInSubtree(nsINode* aRoot,
prevSibling->~RuleProcessorData();
}
#ifdef DEBUG
NS_ASSERTION(!debugMutationGuard.Mutated(0), "Unexpected mutations happened");
#endif
return continueIteration;
}