diff --git a/layout/html/forms/src/nsCheckboxControlFrame.cpp b/layout/html/forms/src/nsCheckboxControlFrame.cpp
index cd1e667a508e..78767e09d99a 100644
--- a/layout/html/forms/src/nsCheckboxControlFrame.cpp
+++ b/layout/html/forms/src/nsCheckboxControlFrame.cpp
@@ -189,7 +189,7 @@ nsCheckboxControlFrame::AttributeChanged(nsIPresContext* aPresContext,
void
-nsCheckboxControlFrame::MouseClicked(nsIPresContext* aPresContext)
+nsCheckboxControlFrame::MouseUp(nsIPresContext* aPresContext)
{
if ( IsTristateCheckbox() ) {
CheckState newState = eOn;
@@ -272,9 +272,14 @@ NS_METHOD nsCheckboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
{
if (nsEventStatus_eConsumeNoDefault == aEventStatus)
return NS_OK;
+
if (nsFormFrame::GetDisabled(this))
return NS_OK;
+ if (NS_MOUSE_LEFT_BUTTON_UP == aEvent->message) {
+ MouseUp(&aPresContext);
+ }
+
return(nsNativeFormControlFrame::HandleEvent(aPresContext, aEvent, aEventStatus));
}
diff --git a/layout/html/forms/src/nsCheckboxControlFrame.h b/layout/html/forms/src/nsCheckboxControlFrame.h
index 6ef1c7f1bc51..3518887b9574 100644
--- a/layout/html/forms/src/nsCheckboxControlFrame.h
+++ b/layout/html/forms/src/nsCheckboxControlFrame.h
@@ -71,7 +71,7 @@ public:
virtual PRInt32 GetMaxNumValues();
virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
nsString* aValues, nsString* aNames);
- virtual void MouseClicked(nsIPresContext* aPresContext);
+ virtual void MouseUp(nsIPresContext* aPresContext);
// nsFormControlFrame overrides
nsresult RequiresWidget(PRBool &aHasWidget);
diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp
index 327234436688..a7544d6fc778 100644
--- a/layout/html/forms/src/nsGfxTextControlFrame.cpp
+++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp
@@ -315,18 +315,20 @@ nsGfxTextControlFrame::EnterPressed(nsIPresContext& aPresContext)
if (mFormFrame && mFormFrame->CanSubmit(*this)) {
nsIContent *formContent = nsnull;
+ nsEventStatus status = nsEventStatus_eIgnore;
+
mFormFrame->GetContent(&formContent);
if (nsnull != formContent) {
nsEvent event;
- nsEventStatus status = nsEventStatus_eIgnore;
-
event.eventStructType = NS_EVENT;
event.message = NS_FORM_SUBMIT;
formContent->HandleDOMEvent(aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
NS_RELEASE(formContent);
}
- mFormFrame->OnSubmit(&aPresContext, this);
+ if (nsEventStatus_eConsumeNoDefault != status) {
+ mFormFrame->OnSubmit(&aPresContext, this);
+ }
}
}
diff --git a/layout/html/forms/src/nsRadioControlFrame.cpp b/layout/html/forms/src/nsRadioControlFrame.cpp
index 17dae2e5170e..3e796068feac 100644
--- a/layout/html/forms/src/nsRadioControlFrame.cpp
+++ b/layout/html/forms/src/nsRadioControlFrame.cpp
@@ -82,7 +82,7 @@ nsRadioControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoord& aWi
}
void
-nsRadioControlFrame::MouseClicked(nsIPresContext* aPresContext)
+nsRadioControlFrame::MouseUp(nsIPresContext* aPresContext)
{
SetRadioControlFrameState(NS_STRING_TRUE);
@@ -201,6 +201,11 @@ nsRadioControlFrame::HandleEvent(nsIPresContext& aPresContext,
}
}
break;
+ case NS_MOUSE_LEFT_BUTTON_UP:
+ MouseUp(&aPresContext);
+ break;
+
+
default:
break;
}
diff --git a/layout/html/forms/src/nsRadioControlFrame.h b/layout/html/forms/src/nsRadioControlFrame.h
index 4f0c4610cdc4..2ef054322266 100644
--- a/layout/html/forms/src/nsRadioControlFrame.h
+++ b/layout/html/forms/src/nsRadioControlFrame.h
@@ -59,7 +59,7 @@ public:
virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
nsString* aValues, nsString* aNames);
- virtual void MouseClicked(nsIPresContext* aPresContext);
+ virtual void MouseUp(nsIPresContext* aPresContext);
virtual void Reset();
virtual const nsIID& GetCID();