button and input button content nodes now cancel all mouse click events except mouse up/down

b=38083


git-svn-id: svn://10.0.0.236/trunk@68233 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com 2000-05-04 13:57:35 +00:00
parent a46fddc03d
commit 6951fd7de5
4 changed files with 62 additions and 4 deletions

View File

@ -455,8 +455,17 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
break;
case NS_MOUSE_MIDDLE_BUTTON_DOWN: // cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_MIDDLE_DOUBLECLICK:
case NS_MOUSE_RIGHT_DOUBLECLICK:
case NS_MOUSE_RIGHT_BUTTON_DOWN:
// XXX Bring up a contextual menu provided by the application
case NS_MOUSE_RIGHT_BUTTON_UP:
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
(*aDOMEvent)->PreventBubble();
} else {
ret = NS_ERROR_FAILURE;
}
break;
case NS_MOUSE_ENTER_SYNTH:

View File

@ -56,6 +56,7 @@
#include "nsDOMError.h"
#include "nsIPresState.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMHTMLCollection.h"
@ -789,9 +790,28 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
} break;// NS_KEY_PRESS
case NS_MOUSE_MIDDLE_BUTTON_DOWN: // cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_MIDDLE_DOUBLECLICK:
case NS_MOUSE_RIGHT_DOUBLECLICK:
case NS_MOUSE_RIGHT_BUTTON_DOWN:
case NS_MOUSE_RIGHT_BUTTON_UP: {
PRInt32 type;
GetType(&type);
if (type == NS_FORM_INPUT_BUTTON ||
type == NS_FORM_INPUT_RESET ||
type == NS_FORM_INPUT_SUBMIT ) {
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
(*aDOMEvent)->PreventBubble();
} else {
ret = NS_ERROR_FAILURE;
}
}
} break;
case NS_MOUSE_LEFT_BUTTON_DOWN:
mDidMouseDown = PR_TRUE;
break;// NS_KEY_PRESS
break;
case NS_MOUSE_LEFT_BUTTON_UP:
{

View File

@ -455,8 +455,17 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
break;
case NS_MOUSE_MIDDLE_BUTTON_DOWN: // cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_MIDDLE_DOUBLECLICK:
case NS_MOUSE_RIGHT_DOUBLECLICK:
case NS_MOUSE_RIGHT_BUTTON_DOWN:
// XXX Bring up a contextual menu provided by the application
case NS_MOUSE_RIGHT_BUTTON_UP:
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
(*aDOMEvent)->PreventBubble();
} else {
ret = NS_ERROR_FAILURE;
}
break;
case NS_MOUSE_ENTER_SYNTH:

View File

@ -56,6 +56,7 @@
#include "nsDOMError.h"
#include "nsIPresState.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMHTMLCollection.h"
@ -789,9 +790,28 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
} break;// NS_KEY_PRESS
case NS_MOUSE_MIDDLE_BUTTON_DOWN: // cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_MIDDLE_DOUBLECLICK:
case NS_MOUSE_RIGHT_DOUBLECLICK:
case NS_MOUSE_RIGHT_BUTTON_DOWN:
case NS_MOUSE_RIGHT_BUTTON_UP: {
PRInt32 type;
GetType(&type);
if (type == NS_FORM_INPUT_BUTTON ||
type == NS_FORM_INPUT_RESET ||
type == NS_FORM_INPUT_SUBMIT ) {
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
(*aDOMEvent)->PreventBubble();
} else {
ret = NS_ERROR_FAILURE;
}
}
} break;
case NS_MOUSE_LEFT_BUTTON_DOWN:
mDidMouseDown = PR_TRUE;
break;// NS_KEY_PRESS
break;
case NS_MOUSE_LEFT_BUTTON_UP:
{