Set state of checkbox and Radio button on MouseUp instead of MouseDown so JavaScript onclick

event handlers can retreive the correct state of the form element. bug 15366; r=rods@netscape.com

Submit the form when a text field is clicked on only if the JavaScript event handler
has not consumed the event. bug 15949; r=rods@netscape.com
This commit is contained in:
kmcclusk%netscape.com 1999-10-12 22:44:23 +00:00
Родитель c9453ff07e
Коммит 4482aee25c
5 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -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));
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}
}
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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();