зеркало из https://github.com/mozilla/gecko-dev.git
Bug 26945: Image input onclick fires but doesn't allow cancel via return false; r=harishd
This commit is contained in:
Родитель
720e6eebc6
Коммит
c0143af2df
|
@ -999,6 +999,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
case NS_FORM_INPUT_BUTTON:
|
case NS_FORM_INPUT_BUTTON:
|
||||||
case NS_FORM_INPUT_RESET:
|
case NS_FORM_INPUT_RESET:
|
||||||
case NS_FORM_INPUT_SUBMIT:
|
case NS_FORM_INPUT_SUBMIT:
|
||||||
|
case NS_FORM_INPUT_IMAGE:
|
||||||
{
|
{
|
||||||
// Tell the frame about the click
|
// Tell the frame about the click
|
||||||
nsIFormControlFrame* formControlFrame = nsnull;
|
nsIFormControlFrame* formControlFrame = nsnull;
|
||||||
|
|
|
@ -287,29 +287,16 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
*aEventStatus = nsEventStatus_eIgnore;
|
*aEventStatus = nsEventStatus_eIgnore;
|
||||||
|
|
||||||
switch (aEvent->message) {
|
switch (aEvent->message) {
|
||||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||||
{
|
{
|
||||||
// Store click point for GetNamesValues
|
// Store click point for GetNamesValues
|
||||||
|
// Do this on MouseUp because the specs don't say and that's what IE does.
|
||||||
float t2p;
|
float t2p;
|
||||||
aPresContext->GetTwipsToPixels(&t2p);
|
aPresContext->GetTwipsToPixels(&t2p);
|
||||||
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
|
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
|
||||||
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
|
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
|
||||||
|
|
||||||
mLastMouseState = eMouseDown;
|
|
||||||
mGotFocus = PR_TRUE;
|
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;
|
return NS_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -999,6 +999,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
case NS_FORM_INPUT_BUTTON:
|
case NS_FORM_INPUT_BUTTON:
|
||||||
case NS_FORM_INPUT_RESET:
|
case NS_FORM_INPUT_RESET:
|
||||||
case NS_FORM_INPUT_SUBMIT:
|
case NS_FORM_INPUT_SUBMIT:
|
||||||
|
case NS_FORM_INPUT_IMAGE:
|
||||||
{
|
{
|
||||||
// Tell the frame about the click
|
// Tell the frame about the click
|
||||||
nsIFormControlFrame* formControlFrame = nsnull;
|
nsIFormControlFrame* formControlFrame = nsnull;
|
||||||
|
|
|
@ -287,29 +287,16 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||||
*aEventStatus = nsEventStatus_eIgnore;
|
*aEventStatus = nsEventStatus_eIgnore;
|
||||||
|
|
||||||
switch (aEvent->message) {
|
switch (aEvent->message) {
|
||||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||||
{
|
{
|
||||||
// Store click point for GetNamesValues
|
// Store click point for GetNamesValues
|
||||||
|
// Do this on MouseUp because the specs don't say and that's what IE does.
|
||||||
float t2p;
|
float t2p;
|
||||||
aPresContext->GetTwipsToPixels(&t2p);
|
aPresContext->GetTwipsToPixels(&t2p);
|
||||||
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
|
mLastClickPoint.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
|
||||||
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
|
mLastClickPoint.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
|
||||||
|
|
||||||
mLastMouseState = eMouseDown;
|
|
||||||
mGotFocus = PR_TRUE;
|
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;
|
return NS_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче