rv = GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) {
rv = GetPrimaryFrame(this, formControlFrame, PR_TRUE, PR_FALSE);  if (formControlFrame) {
nsHTMLInputElement::Select(){  nsresult rv = NS_OK;  // first see if we are disabled or not. If disabled then do nothing.  nsAutoString disabled;  if (NS_CONTENT_ATTR_HAS_VALUE ==      nsGenericHTMLLeafFormElement::GetAttr(kNameSpaceID_HTML,                                            nsHTMLAtoms::disabled,                                            disabled)) {    return rv;  }  // see what type of input we are.  Only select for texts and passwords  PRInt32 type;  GetType(&type);  if (NS_FORM_INPUT_PASSWORD == type ||      NS_FORM_INPUT_TEXT == type) {    // XXX Bug?  We have to give the input focus before contents can be    // selected    nsCOMPtr<nsIPresContext> presContext;    GetPresContext(this, getter_AddRefs(presContext));     // If the window is not active, do not allow the select to bring the    // window to the front.  We update the focus controller, but do    // nothing else.    nsCOMPtr<nsIScriptGlobalObject> globalObj;    mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));    nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(globalObj));    nsCOMPtr<nsIFocusController> focusController;    win->GetRootFocusController(getter_AddRefs(focusController));    PRBool isActive = PR_FALSE;    focusController->GetActive(&isActive);    if (!isActive) {      focusController->SetFocusedElement(this);      SelectAll(presContext);      return NS_OK;    }    // Just like SetFocus() but without the ScrollIntoView()!    nsEventStatus status = nsEventStatus_eIgnore;    nsEvent event;    event.eventStructType = NS_EVENT;    event.message = NS_FORM_SELECTED;    rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,                        &status);    // If the DOM event was not canceled (e.g. by a JS event handler    // returning false)    if (status == nsEventStatus_eIgnore) {      nsCOMPtr<nsIEventStateManager> esm;      if (NS_OK == presContext->GetEventStateManager(getter_AddRefs(esm))) {        esm->SetContentState(this, NS_EVENT_STATE_FOCUS);      }      nsIFormControlFrame* formControlFrame = nsnull;      rv = GetPrimaryFrame(this, formControlFrame);      if (NS_SUCCEEDED(rv)) {        formControlFrame->SetFocus(PR_TRUE, PR_TRUE);        // Now Select all the text!        SelectAll(presContext);      }    }  }  return rv;}