mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 936933 XBL should get the command controller directly from the window root r=mrbkap
This commit is contained in:
parent
d4bfe37616
commit
cfb09faacc
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user