From e93a72a5c9f1a2440f6d77e303576ba8fc0281a2 Mon Sep 17 00:00:00 2001 From: "arik%netscape.com" Date: Sat, 28 Apr 2001 02:32:14 +0000 Subject: [PATCH] moved the spacebar handling code from js to c++ so that spacebar works for embedding apps. fixed bug 71760, r=brendan, sr=hyatt, a=blizzard. --- content/xbl/builtin/htmlBindings.xml | 38 +---------------------- content/xbl/src/nsXBLPrototypeHandler.cpp | 16 +++++++++- content/xbl/src/nsXBLPrototypeHandler.h | 1 + 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/content/xbl/builtin/htmlBindings.xml b/content/xbl/builtin/htmlBindings.xml index eb601745d650..f29efb68aad2 100644 --- a/content/xbl/builtin/htmlBindings.xml +++ b/content/xbl/builtin/htmlBindings.xml @@ -30,43 +30,7 @@ Can't yet put script tags in XBL (hyatt has the bug) --> - - - + diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 0999710e4916..7119efe3fe9e 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -194,7 +194,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEven nsCOMPtr tag; mHandlerElement->GetTag(*getter_AddRefs(tag)); PRBool isXULKey = (tag.get() == nsXULAtoms::key); - + PRBool isReceiverCommandElement = PR_FALSE; nsCOMPtr content(do_QueryInterface(aReceiver)); if (isXULKey && content && content.get() != mHandlerElement) @@ -862,6 +862,20 @@ PRInt32 nsXBLPrototypeHandler::KeyToMask(PRInt32 key) return cControl; // for warning avoidance } +void +nsXBLPrototypeHandler::GetEventType(nsAWritableString &type) +{ + mHandlerElement->GetAttribute(kNameSpaceID_None, kTypeAtom, type); + + if (type.IsEmpty()) { + // If we're a XUL key element, let's assume that we're "keypress". + nsCOMPtr tag; + mHandlerElement->GetTag(*getter_AddRefs(tag)); + if (tag.get() == kKeyAtom) + type = NS_LITERAL_STRING("keypress"); + } +} + void nsXBLPrototypeHandler::ConstructMask() { diff --git a/content/xbl/src/nsXBLPrototypeHandler.h b/content/xbl/src/nsXBLPrototypeHandler.h index b9d8139309e7..c31c659114bf 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.h +++ b/content/xbl/src/nsXBLPrototypeHandler.h @@ -84,6 +84,7 @@ protected: inline PRInt32 GetMatchingKeyCode(const nsString& aKeyName); void ConstructMask(); + void GetEventType(nsAWritableString& type); PRBool ModifiersMatchMask(nsIDOMUIEvent* aEvent); inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);