if (theEvent->eventStructType & NS_GUI_EVENT) { nsGUIEvent* focusEvent = (nsGUIEvent *)theEvent; nsEventStatus rv = ProcessEvent(*focusEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aFocusEvent->PreventDefault(); aFocusEvent->PreventBubble(); return NS_ERROR_FAILURE; }
nsGUIEvent focusEvent; memset(&focusEvent, 0, sizeof(focusEvent)); focusEvent.message = theEvent->message; nsEventStatus rv = ProcessEvent(focusEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aFocusEvent->PreventDefault(); aFocusEvent->PreventBubble(); return NS_ERROR_FAILURE;
nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent){#ifndef XP_WIN    // on Windows, events are sent directly to plugins through child windows  nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aFocusEvent));  if (privateEvent) {    nsEvent * theEvent;    privateEvent->GetInternalNSEvent(&theEvent);    if (theEvent) {      if (theEvent->eventStructType & NS_GUI_EVENT) {        nsGUIEvent* focusEvent = (nsGUIEvent *)theEvent;        nsEventStatus rv = ProcessEvent(*focusEvent);        if (nsEventStatus_eConsumeNoDefault == rv) {          aFocusEvent->PreventDefault();          aFocusEvent->PreventBubble();          return NS_ERROR_FAILURE; // means consume event        }      }    }    else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::DispatchFocusToPlugin failed, focusEvent null");     }  else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::DispatchFocusToPlugin failed, privateEvent null");       return NS_OK;#else  return NS_ERROR_FAILURE; // means consume event#endif}    