nsIContent *nextNode = GetNextSibling(mCurNode, nsnull); NS_ASSERTION(nextNode, "No next sibling!?! This could mean deadlock!");   PRInt32 i = mEndNodes.IndexOf(nextNode); while (i != -1) {   nextNode = nextNode->GetChildAt(0); NS_ASSERTION(nextNode, "Iterator error, expected a child node!");      i = mEndNodes.IndexOf(nextNode); }  mCurNode = nextNode;     mIsDone = mCurNode == nsnull;  return;
mCurNode = NextNode(mCurNode, &mIndexes);
nsContentSubtreeIterator::Next(){  if (mIsDone || !mCurNode)     return;  if (mCurNode == mLast)   {    mIsDone = PR_TRUE;    return;  }  nsIContent *nextNode = GetNextSibling(mCurNode, nsnull);  NS_ASSERTION(nextNode, "No next sibling!?! This could mean deadlock!");/*  nextNode = GetDeepFirstChild(nextNode);  return GetTopAncestorInRange(nextNode, address_of(mCurNode));*/  PRInt32 i = mEndNodes.IndexOf(nextNode);  while (i != -1)  {    // as long as we are finding ancestors of the endpoint of the range,    // dive down into their children    nextNode = nextNode->GetChildAt(0);    NS_ASSERTION(nextNode, "Iterator error, expected a child node!");    // should be impossible to get a null pointer.  If we went all the way    // down the child chain to the bottom without finding an interior node,     // then the previous node should have been the last, which was    // was tested at top of routine.    i = mEndNodes.IndexOf(nextNode);  }  mCurNode = nextNode;  // This shouldn't be needed, but since our selection code can put us  // in a situation where mLast is in generated content, we need this  // to stop the iterator when we've walked past past the last node!  mIsDone = mCurNode == nsnull;  return;}