result = child->GetParent(*getter_AddRefs(parent));
result = child->GetParent(getter_AddRefs(parent));
nsSelection::GetRootForContentSubtree(nsIContent *aContent, nsIContent **aParent){  // This method returns the root of the sub-tree containing aContent.  // We do this by searching up through the parent hierarchy, and stopping  // when there are no more parents, or we hit a situation where the  // parent/child relationship becomes invalid.  //  // An example of an invalid parent/child relationship is anonymous content.  // Anonymous content has a pointer to it's parent, but it is not listed  // as a child of it's parent. In this case, the anonymous content would  // be considered the root of the subtree.  nsresult result = NS_OK;  if (!aContent || !aParent)    return NS_ERROR_NULL_POINTER;  *aParent = 0;  nsCOMPtr<nsIContent> parent = do_QueryInterface(aContent);  nsCOMPtr<nsIContent> child = parent;  while (child)  {    result = child->GetParent(*getter_AddRefs(parent));    if (NS_FAILED(result))      return result;    if (!parent)      break;    PRInt32 childIndex = 0;    PRInt32 childCount = 0;    result = parent->ChildCount(childCount);    if (NS_FAILED(result))      return result;    if (childCount < 1)      break;    result = parent->IndexOf(child, childIndex);    if (NS_FAILED(result))      return result;    if (childIndex < 0 || childIndex >= childCount)      break;    child = parent;  }  *aParent = child;  NS_IF_ADDREF(*aParent);  return result;}