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

b=38083
This commit is contained in:
rods%netscape.com 2000-05-04 13:57:35 +00:00
Родитель 52e88bcad4
Коммит 9a59e55f40
4 изменённых файлов: 62 добавлений и 4 удалений

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

@ -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:

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

@ -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:
{

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

@ -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:

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

@ -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:
{