nsCOMPtr<nsIContent> rootContent; mDocument->GetRootContent(getter_AddRefs(rootContent)); bodyNode = do_QueryInterface(rootContent);
bodyNode = do_QueryInterface(mDocument->GetRootContent());
NS_IMETHODIMP DocumentViewerImpl::SelectAll(){  // XXX this is a temporary implementation copied from nsWebShell  // for now. I think nsDocument and friends should have some helper  // functions to make this easier.  nsCOMPtr<nsISelection> selection;  nsresult rv;  rv = GetDocumentSelection(getter_AddRefs(selection));  if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIDOMHTMLDocument> htmldoc = do_QueryInterface(mDocument);  nsCOMPtr<nsIDOMNode> bodyNode;  if (htmldoc)  {    nsCOMPtr<nsIDOMHTMLElement>bodyElement;    rv = htmldoc->GetBody(getter_AddRefs(bodyElement));    if (NS_FAILED(rv) || !bodyElement) return rv;    bodyNode = do_QueryInterface(bodyElement);  }  else if (mDocument)  {    nsCOMPtr<nsIContent> rootContent;    mDocument->GetRootContent(getter_AddRefs(rootContent));    bodyNode = do_QueryInterface(rootContent);  }  if (!bodyNode) return NS_ERROR_FAILURE;  rv = selection->RemoveAllRanges();  if (NS_FAILED(rv)) return rv;  rv = selection->SelectAllChildren(bodyNode);  return rv;}