if (NS_FAILED(aNode->GetParent(*getter_AddRefs(parent))))
if (NS_FAILED(aNode->GetParent(getter_AddRefs(parent))))
nsresult nsContentSubtreeIterator::GetTopAncestorInRange(                                       nsCOMPtr<nsIContent> aNode,                                       nsCOMPtr<nsIContent> *outAnestor){  if (!aNode)     return NS_ERROR_NULL_POINTER;  if (!outAnestor)     return NS_ERROR_NULL_POINTER;      // sanity check: aNode is itself in the range  PRBool nodeBefore, nodeAfter;  if (NS_FAILED(nsRange::CompareNodeToRange(aNode, mRange, &nodeBefore,                                            &nodeAfter)))    return NS_ERROR_FAILURE;  if (nodeBefore || nodeAfter)    return NS_ERROR_FAILURE;    nsCOMPtr<nsIContent> parent, tmp;  while (aNode)  {    if (NS_FAILED(aNode->GetParent(*getter_AddRefs(parent))))      return NS_ERROR_FAILURE;    if (!parent)    {      if (tmp)      {        *outAnestor = tmp;        return NS_OK;      }      else return NS_ERROR_FAILURE;    }    if (NS_FAILED(nsRange::CompareNodeToRange(parent, mRange, &nodeBefore,                                              &nodeAfter)))      return NS_ERROR_FAILURE;    if (nodeBefore || nodeAfter)    {      *outAnestor = aNode;      return NS_OK;    }    tmp = aNode;    aNode = parent;  }  return NS_ERROR_FAILURE;}