зеркало из https://github.com/mozilla/pjs.git
Fix arrow keys in input fields. r=danm
This commit is contained in:
Родитель
6a3fa517a6
Коммит
d3ee2d1b2d
|
@ -32,7 +32,8 @@
|
|||
#define nsIXBLPrototypeHandler_h__
|
||||
|
||||
class nsIContent;
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMMouseEvent;
|
||||
class nsIDOMKeyEvent;
|
||||
|
||||
// {921812E7-A044-4bd8-B49E-69BB0A607202}
|
||||
#define NS_IXBLPROTOTYPEHANDLER_IID \
|
||||
|
@ -43,7 +44,9 @@ class nsIXBLPrototypeHandler : public nsISupports
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXBLPROTOTYPEHANDLER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD EventMatched(nsIDOMEvent* aEvent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD MouseEventMatched(nsIDOMMouseEvent* aEvent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD KeyEventMatched(nsIDOMKeyEvent* aEvent, PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetHandlerElement(nsIContent** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetNextHandler(nsIXBLPrototypeHandler** aResult) = 0;
|
||||
|
|
|
@ -171,8 +171,10 @@ nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keyup"), aKeyEvent);
|
||||
|
@ -185,8 +187,10 @@ nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keydown"), aKeyEvent);
|
||||
|
@ -199,8 +203,10 @@ nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keypress"), aKeyEvent);
|
||||
|
@ -213,8 +219,10 @@ nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mousedown"), aMouseEvent);
|
||||
|
@ -227,8 +235,10 @@ nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseup"), aMouseEvent);
|
||||
|
@ -241,8 +251,10 @@ nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("click"), aMouseEvent);
|
||||
|
@ -255,8 +267,10 @@ nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("dblclick"), aMouseEvent);
|
||||
|
@ -269,8 +283,10 @@ nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseover"), aMouseEvent);
|
||||
|
@ -283,8 +299,10 @@ nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseout"), aMouseEvent);
|
||||
|
|
|
@ -106,22 +106,6 @@ nsXBLPrototypeHandler::~nsXBLPrototypeHandler()
|
|||
|
||||
NS_IMPL_ISUPPORTS1(nsXBLPrototypeHandler, nsIXBLPrototypeHandler)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::EventMatched(nsIDOMEvent* aEvent, PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aEvent));
|
||||
if (mouse)
|
||||
*aResult = MouseEventMatched(mouse);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
|
||||
if (key)
|
||||
*aResult = KeyEventMatched(key);
|
||||
else *aResult = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::GetHandlerElement(nsIContent** aResult)
|
||||
{
|
||||
|
@ -172,14 +156,18 @@ nsXBLPrototypeHandler::InitAccessKey()
|
|||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent, PRBool* aResult)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
*aResult = PR_TRUE;
|
||||
|
||||
if (!mHandlerElement) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mDetail == 0 && mDetail2 == 0 && mKeyMask == 0)
|
||||
return PR_TRUE; // No filters set up. It's generic.
|
||||
return NS_OK; // No filters set up. It's generic.
|
||||
|
||||
// Get the keycode and charcode of the key event.
|
||||
PRUint32 keyCode, charCode;
|
||||
|
@ -188,33 +176,47 @@ nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
|
||||
PRBool keyMatched = (mDetail == (mDetail2 ? charCode : keyCode));
|
||||
|
||||
if (!keyMatched)
|
||||
return PR_FALSE;
|
||||
if (!keyMatched) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Now check modifier keys
|
||||
return ModifiersMatchMask(aKeyEvent);
|
||||
PRBool result = ModifiersMatchMask(aKeyEvent);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent, PRBool* aResult)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
*aResult = PR_TRUE;
|
||||
|
||||
if (!mHandlerElement) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mDetail == 0 && mDetail2 == 0 && mKeyMask == 0)
|
||||
return PR_TRUE; // No filters set up. It's generic.
|
||||
return NS_OK; // No filters set up. It's generic.
|
||||
|
||||
unsigned short button;
|
||||
aMouseEvent->GetButton(&button);
|
||||
if (mDetail != 0 && (button != mDetail))
|
||||
return PR_FALSE;
|
||||
if (mDetail != 0 && (button != mDetail)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 clickcount;
|
||||
aMouseEvent->GetDetail(&clickcount);
|
||||
if (mDetail2 != 0 && (clickcount != mDetail2))
|
||||
return PR_FALSE;
|
||||
if (mDetail2 != 0 && (clickcount != mDetail2)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ModifiersMatchMask(aMouseEvent);
|
||||
PRBool result = ModifiersMatchMask(aMouseEvent);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
|
@ -44,7 +44,9 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD EventMatched(nsIDOMEvent* aEvent, PRBool* aResult);
|
||||
NS_IMETHOD MouseEventMatched(nsIDOMMouseEvent* aEvent, PRBool* aResult);
|
||||
NS_IMETHOD KeyEventMatched(nsIDOMKeyEvent* aEvent, PRBool* aResult);
|
||||
|
||||
NS_IMETHOD GetHandlerElement(nsIContent** aResult);
|
||||
|
||||
NS_IMETHOD GetNextHandler(nsIXBLPrototypeHandler** aResult);
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
#define nsIXBLPrototypeHandler_h__
|
||||
|
||||
class nsIContent;
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMMouseEvent;
|
||||
class nsIDOMKeyEvent;
|
||||
|
||||
// {921812E7-A044-4bd8-B49E-69BB0A607202}
|
||||
#define NS_IXBLPROTOTYPEHANDLER_IID \
|
||||
|
@ -43,7 +44,9 @@ class nsIXBLPrototypeHandler : public nsISupports
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXBLPROTOTYPEHANDLER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD EventMatched(nsIDOMEvent* aEvent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD MouseEventMatched(nsIDOMMouseEvent* aEvent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD KeyEventMatched(nsIDOMKeyEvent* aEvent, PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetHandlerElement(nsIContent** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetNextHandler(nsIXBLPrototypeHandler** aResult) = 0;
|
||||
|
|
|
@ -171,8 +171,10 @@ nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keyup"), aKeyEvent);
|
||||
|
@ -185,8 +187,10 @@ nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keydown"), aKeyEvent);
|
||||
|
@ -199,8 +203,10 @@ nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aKeyEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aKeyEvent));
|
||||
mProtoHandler->KeyEventMatched(key, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("keypress"), aKeyEvent);
|
||||
|
@ -213,8 +219,10 @@ nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mousedown"), aMouseEvent);
|
||||
|
@ -227,8 +235,10 @@ nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseup"), aMouseEvent);
|
||||
|
@ -241,8 +251,10 @@ nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("click"), aMouseEvent);
|
||||
|
@ -255,8 +267,10 @@ nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("dblclick"), aMouseEvent);
|
||||
|
@ -269,8 +283,10 @@ nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseover"), aMouseEvent);
|
||||
|
@ -283,8 +299,10 @@ nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
|
||||
PRBool matched = PR_FALSE;
|
||||
if (mProtoHandler)
|
||||
mProtoHandler->EventMatched(aMouseEvent, &matched);
|
||||
if (mProtoHandler) {
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aMouseEvent));
|
||||
mProtoHandler->MouseEventMatched(mouse, &matched);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
ExecuteHandler(NS_LITERAL_STRING("mouseout"), aMouseEvent);
|
||||
|
|
|
@ -106,22 +106,6 @@ nsXBLPrototypeHandler::~nsXBLPrototypeHandler()
|
|||
|
||||
NS_IMPL_ISUPPORTS1(nsXBLPrototypeHandler, nsIXBLPrototypeHandler)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::EventMatched(nsIDOMEvent* aEvent, PRBool* aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aEvent));
|
||||
if (mouse)
|
||||
*aResult = MouseEventMatched(mouse);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
|
||||
if (key)
|
||||
*aResult = KeyEventMatched(key);
|
||||
else *aResult = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::GetHandlerElement(nsIContent** aResult)
|
||||
{
|
||||
|
@ -172,14 +156,18 @@ nsXBLPrototypeHandler::InitAccessKey()
|
|||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent, PRBool* aResult)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
*aResult = PR_TRUE;
|
||||
|
||||
if (!mHandlerElement) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mDetail == 0 && mDetail2 == 0 && mKeyMask == 0)
|
||||
return PR_TRUE; // No filters set up. It's generic.
|
||||
return NS_OK; // No filters set up. It's generic.
|
||||
|
||||
// Get the keycode and charcode of the key event.
|
||||
PRUint32 keyCode, charCode;
|
||||
|
@ -188,33 +176,47 @@ nsXBLPrototypeHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
|
||||
PRBool keyMatched = (mDetail == (mDetail2 ? charCode : keyCode));
|
||||
|
||||
if (!keyMatched)
|
||||
return PR_FALSE;
|
||||
if (!keyMatched) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Now check modifier keys
|
||||
return ModifiersMatchMask(aKeyEvent);
|
||||
PRBool result = ModifiersMatchMask(aKeyEvent);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent, PRBool* aResult)
|
||||
{
|
||||
if (!mHandlerElement)
|
||||
return PR_FALSE;
|
||||
*aResult = PR_TRUE;
|
||||
|
||||
if (!mHandlerElement) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mDetail == 0 && mDetail2 == 0 && mKeyMask == 0)
|
||||
return PR_TRUE; // No filters set up. It's generic.
|
||||
return NS_OK; // No filters set up. It's generic.
|
||||
|
||||
unsigned short button;
|
||||
aMouseEvent->GetButton(&button);
|
||||
if (mDetail != 0 && (button != mDetail))
|
||||
return PR_FALSE;
|
||||
if (mDetail != 0 && (button != mDetail)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 clickcount;
|
||||
aMouseEvent->GetDetail(&clickcount);
|
||||
if (mDetail2 != 0 && (clickcount != mDetail2))
|
||||
return PR_FALSE;
|
||||
if (mDetail2 != 0 && (clickcount != mDetail2)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ModifiersMatchMask(aMouseEvent);
|
||||
PRBool result = ModifiersMatchMask(aMouseEvent);
|
||||
*aResult = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
|
@ -44,7 +44,9 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD EventMatched(nsIDOMEvent* aEvent, PRBool* aResult);
|
||||
NS_IMETHOD MouseEventMatched(nsIDOMMouseEvent* aEvent, PRBool* aResult);
|
||||
NS_IMETHOD KeyEventMatched(nsIDOMKeyEvent* aEvent, PRBool* aResult);
|
||||
|
||||
NS_IMETHOD GetHandlerElement(nsIContent** aResult);
|
||||
|
||||
NS_IMETHOD GetNextHandler(nsIXBLPrototypeHandler** aResult);
|
||||
|
|
Загрузка…
Ссылка в новой задаче