nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent = do_QueryInterface(aKeyEvent); if(nsUIEvent) { PRBool defaultPrevented; nsUIEvent->GetPreventDefault(&defaultPrevented); if(defaultPrevented) return NS_OK; }
nsTextInputListener::KeyPress(nsIDOMEvent* aKeyEvent){  if (!mFrame)    return NS_OK;  nsCOMPtr<nsIDOMKeyEvent>keyEvent;  keyEvent = do_QueryInterface(aKeyEvent);  if (!keyEvent)   {    //non-key event passed to keydown.  bad things.    return NS_OK;  }    nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aKeyEvent);  if(privateEvent)   {    PRBool dispatchStopped;    privateEvent->IsDispatchStopped(&dispatchStopped);    if(dispatchStopped)      return NS_OK;  }  mFrame->SetValueChanged(PR_TRUE);  return NS_OK;}