content->GetDocument(getter_AddRefs(doc));
doc = content->GetDocument();
IsTargetFocused(nsIDOMEventTarget* aTarget){  // The event target could be either a content node or a document.  nsCOMPtr<nsIDocument> doc;  nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);  if (content)    content->GetDocument(getter_AddRefs(doc));  else    doc = do_QueryInterface(aTarget);  if (!doc)    return PR_FALSE;  nsCOMPtr<nsIPresShell> shell;  doc->GetShellAt(0, getter_AddRefs(shell));  if (!shell)    return PR_FALSE;  nsCOMPtr<nsIPresContext> presContext;  shell->GetPresContext(getter_AddRefs(presContext));  if (!presContext)    return PR_FALSE;  nsCOMPtr<nsIEventStateManager> esm;  presContext->GetEventStateManager(getter_AddRefs(esm));  if (!esm)    return PR_FALSE;  nsCOMPtr<nsIContent> focusedContent;  esm->GetFocusedContent(getter_AddRefs(focusedContent));  // focusedContent will be null in the case where the document has focus,  // and so will content.  return (focusedContent == content);}