if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))))
if (NS_FAILED(cN->GetParent(getter_AddRefs(parent))))
nsresult nsGeneratedContentIterator::NextNode(nsCOMPtr<nsIContent> *ioNextNode){  if (!ioNextNode)    return NS_ERROR_NULL_POINTER;      if (mGenIter)  {    if (mGenIter->IsDone())      mGenIter = 0;    else       return mGenIter->Next();    if (nsIPresShell::After == mIterType)//answer is parent    {      //*ioNextNode = parent; leave it the same      return NS_OK;    }    nsCOMPtr<nsIContent>cN;    (*ioNextNode)->ChildAt(0,*getter_AddRefs(cN));    if (cN)    {      *ioNextNode=GetDeepFirstChild(cN);      return NS_OK;    }  }  {    nsCOMPtr<nsIContent> cN = *ioNextNode;    nsCOMPtr<nsIContent> cSibling;    nsCOMPtr<nsIContent> parent;    PRInt32              indx;      // get next sibling if there is one    if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))))      return NS_ERROR_FAILURE;    if (!parent || NS_FAILED(parent->IndexOf(cN, indx)))    {      // a little noise to catch some iterator usage bugs.      NS_NOTREACHED("nsGeneratedContentIterator::NextNode() : no parent found");      return NS_ERROR_FAILURE;    }    if (NS_SUCCEEDED(parent->ChildAt(++indx,*getter_AddRefs(cSibling))) && cSibling)    {      // next node is siblings "deep left" child      *ioNextNode = GetDeepFirstChild(cSibling);       return NS_OK;    }      //CHECK FOR AFTERSTUFF    if (mGenIter)//we allready had an afteriter. it must be done!    {      mGenIter = 0;    }    else//check for after node.    {      nsresult result = NS_ERROR_FAILURE;      if (mPresShell)        result = mPresShell->GetGeneratedContentIterator(parent,nsIPresShell::After,getter_AddRefs(mGenIter));      if (NS_SUCCEEDED(result) && mGenIter)      { //ok we have a generated iter all bets are off        mGenIter->First();        mIterType = nsIPresShell::After;      }      else        mGenIter = 0;    }    // else it's the parent    *ioNextNode = parent;  }  return NS_OK;}