Bug 26945: Image input onclick fires but doesn't allow cancel via return false; r=harishd

git-svn-id: svn://10.0.0.236/trunk@75524 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pollmann%netscape.com
2000-08-03 22:17:14 +00:00
parent f8929164c8
commit f0c8471679
4 changed files with 6 additions and 30 deletions

View File

@@ -999,6 +999,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
case NS_FORM_INPUT_BUTTON:
case NS_FORM_INPUT_RESET:
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_IMAGE:
{
// Tell the frame about the click
nsIFormControlFrame* formControlFrame = nsnull;

View File

@@ -287,29 +287,16 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
*aEventStatus = nsEventStatus_eIgnore;
switch (aEvent->message) {
case NS_MOUSE_LEFT_BUTTON_DOWN:
case NS_MOUSE_LEFT_BUTTON_UP:
{
// Store click point for GetNamesValues
// Do this on MouseUp because the specs don't say and that's what IE does.
float t2p;
aPresContext->GetTwipsToPixels(&t2p);
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
mLastMouseState = eMouseDown;
mGotFocus = PR_TRUE;
*aEventStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK;
break;
}
case NS_MOUSE_LEFT_BUTTON_UP:
{
if (eMouseDown == mLastMouseState) {
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
MouseClicked(aPresContext);
}
}
mLastMouseState = eMouseUp;
*aEventStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK;
break;
}

View File

@@ -999,6 +999,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
case NS_FORM_INPUT_BUTTON:
case NS_FORM_INPUT_RESET:
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_IMAGE:
{
// Tell the frame about the click
nsIFormControlFrame* formControlFrame = nsnull;

View File

@@ -287,29 +287,16 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
*aEventStatus = nsEventStatus_eIgnore;
switch (aEvent->message) {
case NS_MOUSE_LEFT_BUTTON_DOWN:
case NS_MOUSE_LEFT_BUTTON_UP:
{
// Store click point for GetNamesValues
// Do this on MouseUp because the specs don't say and that's what IE does.
float t2p;
aPresContext->GetTwipsToPixels(&t2p);
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
mLastMouseState = eMouseDown;
mGotFocus = PR_TRUE;
*aEventStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK;
break;
}
case NS_MOUSE_LEFT_BUTTON_UP:
{
if (eMouseDown == mLastMouseState) {
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
MouseClicked(aPresContext);
}
}
mLastMouseState = eMouseUp;
*aEventStatus = nsEventStatus_eConsumeNoDefault;
return NS_OK;
break;
}