Bug 936933 XBL should get the command controller directly from the window root r=mrbkap

This commit is contained in:
Neil Rashbrook 2013-11-27 20:11:36 +00:00
parent d4bfe37616
commit cfb09faacc

View File

@ -16,7 +16,6 @@
#include "nsIDOMElement.h"
#include "nsINativeKeyBindings.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsFocusManager.h"
#include "nsPIWindowRoot.h"
#include "nsIURI.h"
@ -287,13 +286,13 @@ GetEditorKeyBindings()
static void
DoCommandCallback(const char *aCommand, void *aData)
{
nsIControllers *controllers = static_cast<nsIControllers*>(aData);
if (!controllers) {
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(static_cast<EventTarget*>(aData));
if (!root) {
return;
}
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
root->GetControllerForCommand(aCommand, getter_AddRefs(controller));
if (!controller) {
return;
}
@ -353,13 +352,6 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
// bindings? I.e., should we call WalkHandlersInternal() after this
// block?
if (isEditor && GetEditorKeyBindings()) {
// get the DOM window we're attached to
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mTarget);
if (root) {
root->GetControllers(getter_AddRefs(controllers));
}
WidgetKeyboardEvent* keyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
MOZ_ASSERT(keyEvent,
@ -369,17 +361,17 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
case NS_KEY_PRESS:
handled = sNativeEditorBindings->KeyPress(*keyEvent,
DoCommandCallback,
controllers);
mTarget);
break;
case NS_KEY_UP:
handled = sNativeEditorBindings->KeyUp(*keyEvent,
DoCommandCallback,
controllers);
mTarget);
break;
case NS_KEY_DOWN:
handled = sNativeEditorBindings->KeyDown(*keyEvent,
DoCommandCallback,
controllers);
mTarget);
break;
default:
MOZ_CRASH("Unknown key message");