case NS_FOCUS_CONTENT: { nsIFormControlFrame* formControlFrame = nsnull; nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) { formControlFrame->SetFocus(PR_TRUE, PR_TRUE); return NS_OK; }  } break;
nsHTMLInputElement::HandleDOMEvent(nsIPresContext& aPresContext,                            nsEvent* aEvent,                            nsIDOMEvent** aDOMEvent,                            PRUint32 aFlags,                            nsEventStatus& aEventStatus){  // Try script event handlers first  nsresult ret = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,                               aFlags, aEventStatus);  if ((NS_OK == ret) && (nsEventStatus_eIgnore == aEventStatus)) {    switch (aEvent->message) {      case NS_KEY_PRESS:      {        nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent;        if (keyEvent->keyCode == NS_VK_RETURN || keyEvent->charCode == 0x20) {          PRInt32 type;          GetType(&type);          switch(type) {          case NS_FOCUS_CONTENT:                                                              {                                                                                     nsIFormControlFrame* formControlFrame = nsnull;                                     nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);            if (NS_SUCCEEDED(rv)) {                                                               formControlFrame->SetFocus(PR_TRUE, PR_TRUE);                                       return NS_OK;                                                                     }                                                                                   //SetFocus(&aPresContext);                                                        }                                                                                   break;                     case NS_FORM_INPUT_CHECKBOX:            {              PRBool checked;              GetChecked(&checked);              SetChecked(!checked);            }            break;          case NS_FORM_INPUT_RADIO:            SetChecked(PR_TRUE);            break;          case NS_FORM_INPUT_BUTTON:          case NS_FORM_INPUT_RESET:          case NS_FORM_INPUT_SUBMIT:            {              //Checkboxes and radio trigger off return or space but buttons              //just trigger off space, go figure.              if (keyEvent->charCode == 0x20) {                //XXX We should just be able to call Click() here but then                //Click wouldn't have a PresContext.                nsIFormControlFrame* formControlFrame = nsnull;                if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) {                  if (formControlFrame) {                    formControlFrame->MouseClicked(&aPresContext);                  }                }              }            }            break;          }        }      }    }  }  return ret;}