nsCOMPtr<nsIDOMWindowInternal> domWin(do_QueryInterface(globalObj));
nsCOMPtr<nsIDOMWindowInternal> domWin(do_QueryInterface(win));
nsHTMLInputElement::SetFocus(nsIPresContext* aPresContext){  NS_ENSURE_ARG_POINTER(aPresContext);  // We can't be focus'd if we don't have a document  if (! mDocument)    return NS_OK;  // first see if we are disabled or not. If disabled then do nothing.  nsAutoString disabled;  if (NS_CONTENT_ATTR_HAS_VALUE == GetAttr(kNameSpaceID_None,                                           nsHTMLAtoms::disabled, disabled)) {    return NS_OK;  }   // If the window is not active, do not allow the focus to bring the  // window to the front.  We update the focus controller, but do  // nothing else.  nsCOMPtr<nsIFocusController> focusController;  nsCOMPtr<nsIScriptGlobalObject> globalObj;  mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));  nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(globalObj));  win->GetRootFocusController(getter_AddRefs(focusController));  PRBool isActive = PR_FALSE;  focusController->GetActive(&isActive);  if (!isActive) {    nsCOMPtr<nsIDOMWindowInternal> domWin(do_QueryInterface(globalObj));    focusController->SetFocusedWindow(domWin);    focusController->SetFocusedElement(this);    return NS_OK;  }  nsCOMPtr<nsIEventStateManager> esm;  aPresContext->GetEventStateManager(getter_AddRefs(esm));  if (esm) {    esm->SetContentState(this, NS_EVENT_STATE_FOCUS);  }  nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);  if (formControlFrame) {    formControlFrame->SetFocus(PR_TRUE, PR_TRUE);    formControlFrame->ScrollIntoView(aPresContext);    // Could call SelectAll(aPresContext) here to automatically    // select text when we receive focus - only for text and password!  }  return NS_OK;}