ret = formMan->OnSubmit(aPresContext, nsnull);
nsIFrame *originatingFrame = nsnull;   if (aEvent) { if (NS_FORM_EVENT == aEvent->eventStructType) { nsIContent *originator = ((nsFormEvent *)aEvent)->originator; if (originator) { shell->GetPrimaryFrameFor(originator, &originatingFrame); } } }  ret = formMan->OnSubmit(aPresContext, originatingFrame);
nsHTMLFormElement::HandleDOMEvent(nsIPresContext* aPresContext,                                  nsEvent* aEvent,                                  nsIDOMEvent** aDOMEvent,                                  PRUint32 aFlags,                                  nsEventStatus* aEventStatus){  nsresult ret = nsGenericHTMLContainerElement::HandleDOMEvent(aPresContext,                                                               aEvent,                                                               aDOMEvent,                                                               aFlags,                                                               aEventStatus);  if ((NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) &&      !(aFlags & NS_EVENT_FLAG_CAPTURE)) {    switch (aEvent->message) {      case NS_FORM_RESET:      case NS_FORM_SUBMIT:      {        // Make sure the presentation is up-to-date        nsCOMPtr<nsIDocument> doc;        GetDocument(*getter_AddRefs(doc));        if (doc) {          doc->FlushPendingNotifications();        }        nsCOMPtr<nsIPresShell> shell;        aPresContext->GetShell(getter_AddRefs(shell));        if (shell) {          nsIFrame* frame;          shell->GetPrimaryFrameFor(this, &frame);          if (frame) {            nsIFormManager* formMan = nsnull;            ret = frame->QueryInterface(NS_GET_IID(nsIFormManager),                                        (void**)&formMan);            if (formMan) {              if (NS_FORM_RESET == aEvent->message) {                ret = formMan->OnReset(aPresContext);              }              else {                ret = formMan->OnSubmit(aPresContext, nsnull);              }            }          }        }      }      break;    }  }  return ret;}