From bbc692806cce9df7e1e3224434be41ec6d5c192f Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Fri, 8 Feb 2002 23:50:51 +0000 Subject: [PATCH] Bug 124298 - moving form submit/reset event firing into the content node. r=jkeiser, sr=attinasi git-svn-id: svn://10.0.0.236/trunk@114092 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsHTMLInputElement.cpp | 14 ++++++++++---- .../layout/forms/nsHTMLButtonControlFrame.cpp | 17 ++--------------- mozilla/layout/forms/nsImageControlFrame.cpp | 7 ++----- .../html/forms/src/nsHTMLButtonControlFrame.cpp | 17 ++--------------- .../html/forms/src/nsImageControlFrame.cpp | 7 ++----- 5 files changed, 18 insertions(+), 44 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index b991a0e2fc4..3c255aa7d28 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -1367,10 +1367,16 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, case NS_FORM_INPUT_SUBMIT: case NS_FORM_INPUT_IMAGE: { - // Tell the frame about the click - if (formControlFrame) { - formControlFrame->MouseClicked(aPresContext); - } + nsFormEvent event; + event.eventStructType = NS_FORM_EVENT; + event.message = (type == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT; + event.originator = this; + nsEventStatus status = nsEventStatus_eIgnore; + + nsCOMPtr presShell; + aPresContext->GetShell(getter_AddRefs(presShell)); + nsCOMPtr form(do_QueryInterface(mForm)); + presShell->HandleEventWithTarget(&event, nsnull, form, NS_EVENT_FLAG_INIT, &status); } break; diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index c0679950b86..b0f87591133 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -299,21 +299,8 @@ nsHTMLButtonControlFrame::IsSubmit(PRInt32 type) void nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) { - if ((nsnull != mFormFrame) && !nsFormFrame::GetDisabled(this)) { - PRInt32 type; - GetType(&type); - - if (IsReset(type) == PR_TRUE) { - // do Reset & Frame processing of event - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, - this, PR_FALSE, PR_FALSE); - } - else if (IsSubmit(type) == PR_TRUE) { - // do Submit & Frame processing of event - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, - this, PR_TRUE, PR_FALSE); - } - } +// This is no longer called; click events are handled in +// nsHTMLInputElement::HandleDOMEvent(). } void diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index f13bd1a8d11..47ef91efad9 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -436,11 +436,8 @@ nsImageControlFrame::GetCursor(nsIPresContext* aPresContext, void nsImageControlFrame::MouseClicked(nsIPresContext* aPresContext) { - if (nsnull != mFormFrame && !nsFormFrame::GetDisabled(this)) { - // Do Submit & DOM Processing - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, - mFormFrame, this, PR_TRUE, PR_TRUE); - } +// This is no longer called; click events are handled in +// nsHTMLInputElement::HandleDOMEvent(). } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index c0679950b86..b0f87591133 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -299,21 +299,8 @@ nsHTMLButtonControlFrame::IsSubmit(PRInt32 type) void nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) { - if ((nsnull != mFormFrame) && !nsFormFrame::GetDisabled(this)) { - PRInt32 type; - GetType(&type); - - if (IsReset(type) == PR_TRUE) { - // do Reset & Frame processing of event - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, - this, PR_FALSE, PR_FALSE); - } - else if (IsSubmit(type) == PR_TRUE) { - // do Submit & Frame processing of event - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, mFormFrame, - this, PR_TRUE, PR_FALSE); - } - } +// This is no longer called; click events are handled in +// nsHTMLInputElement::HandleDOMEvent(). } void diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index f13bd1a8d11..47ef91efad9 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -436,11 +436,8 @@ nsImageControlFrame::GetCursor(nsIPresContext* aPresContext, void nsImageControlFrame::MouseClicked(nsIPresContext* aPresContext) { - if (nsnull != mFormFrame && !nsFormFrame::GetDisabled(this)) { - // Do Submit & DOM Processing - nsFormControlHelper::DoManualSubmitOrReset(aPresContext, nsnull, - mFormFrame, this, PR_TRUE, PR_TRUE); - } +// This is no longer called; click events are handled in +// nsHTMLInputElement::HandleDOMEvent(). } NS_IMETHODIMP