Bug 665599: Remove AddRemoveEventListenerByIID from nsXBLWindowKeyHandler. r=jst

This commit is contained in:
Jonas Sicking 2011-06-24 16:12:34 -07:00
Родитель 7ba664e7f8
Коммит 693c5b0749
2 изменённых файлов: 11 добавлений и 29 удалений

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

@ -201,8 +201,7 @@ nsXBLWindowKeyHandler::~nsXBLWindowKeyHandler()
}
}
NS_IMPL_ISUPPORTS2(nsXBLWindowKeyHandler,
nsIDOMKeyListener,
NS_IMPL_ISUPPORTS1(nsXBLWindowKeyHandler,
nsIDOMEventListener)
static void
@ -393,28 +392,20 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
return NS_OK;
}
nsresult nsXBLWindowKeyHandler::KeyUp(nsIDOMEvent* aEvent)
NS_IMETHODIMP
nsXBLWindowKeyHandler::HandleEvent(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
return WalkHandlers(keyEvent, nsGkAtoms::keyup);
}
nsresult nsXBLWindowKeyHandler::KeyDown(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
return WalkHandlers(keyEvent, nsGkAtoms::keydown);
}
nsAutoString eventType;
aEvent->GetType(eventType);
nsCOMPtr<nsIAtom> eventTypeAtom = do_GetAtom(eventType);
NS_ENSURE_TRUE(eventTypeAtom, NS_ERROR_OUT_OF_MEMORY);
nsresult nsXBLWindowKeyHandler::KeyPress(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
return WalkHandlers(keyEvent, nsGkAtoms::keypress);
return WalkHandlers(keyEvent, eventTypeAtom);
}
//
// EventMatched
//

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

@ -41,7 +41,7 @@
#define nsXBLWindowKeyHandler_h__
#include "nsWeakPtr.h"
#include "nsIDOMKeyListener.h"
#include "nsIDOMEventListener.h"
class nsIAtom;
class nsIDOMElement;
@ -52,23 +52,14 @@ class nsIXBLDocumentInfo;
class nsXBLSpecialDocInfo;
class nsXBLPrototypeHandler;
class nsXBLWindowKeyHandler : public nsIDOMKeyListener
class nsXBLWindowKeyHandler : public nsIDOMEventListener
{
public:
nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventTarget* aTarget);
virtual ~nsXBLWindowKeyHandler();
// nsIDOMetc.
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent)
{
return NS_OK;
}
NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent);
NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent);
NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
// release globals
static NS_HIDDEN_(void) ShutDown();