gecko-dev/dom/events/GlobalKeyListener.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

187 строки
6.1 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2000-09-22 09:02:20 +04:00
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
#ifndef mozilla_GlobalKeyListener_h_
#define mozilla_GlobalKeyListener_h_
2000-09-22 09:02:20 +04:00
#include "mozilla/EventForwards.h"
#include "mozilla/layers/KeyboardMap.h"
#include "nsIDOMEventListener.h"
#include "nsIWeakReferenceUtils.h"
2000-09-22 09:02:20 +04:00
class nsAtom;
2000-09-22 09:02:20 +04:00
namespace mozilla {
class EventListenerManager;
class WidgetKeyboardEvent;
struct IgnoreModifierState;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
namespace layers {
class KeyboardMap;
}
namespace dom {
class Element;
class EventTarget;
class KeyboardEvent;
} // namespace dom
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
class KeyEventHandler;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
/**
* A generic listener for key events.
*
* Maintains a list of shortcut handlers and is registered as a listener for DOM
* key events from a target. Responsible for executing the appropriate handler
* when a keyboard event is received.
*/
class GlobalKeyListener : public nsIDOMEventListener {
2000-09-22 09:02:20 +04:00
public:
explicit GlobalKeyListener(dom::EventTarget* aTarget);
void InstallKeyboardEventListenersTo(
EventListenerManager* aEventListenerManager);
void RemoveKeyboardEventListenersFrom(
EventListenerManager* aEventListenerManager);
2000-09-22 09:02:20 +04:00
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
2000-09-22 09:02:20 +04:00
protected:
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
virtual ~GlobalKeyListener() = default;
MOZ_CAN_RUN_SCRIPT
void WalkHandlers(dom::KeyboardEvent* aKeyEvent);
2000-09-22 09:02:20 +04:00
// walk the handlers, looking for one to handle the event
MOZ_CAN_RUN_SCRIPT
bool WalkHandlersInternal(dom::KeyboardEvent* aKeyEvent, bool aExecute,
bool* aOutReservedForChrome = nullptr);
2000-09-22 09:02:20 +04:00
// walk the handlers for aEvent, aCharCode and aIgnoreModifierState. Execute
// it if aExecute = true.
MOZ_CAN_RUN_SCRIPT
bool WalkHandlersAndExecute(dom::KeyboardEvent* aKeyEvent, uint32_t aCharCode,
const IgnoreModifierState& aIgnoreModifierState,
bool aExecute,
bool* aOutReservedForChrome = nullptr);
// HandleEvent function for the capturing phase in the default event group.
MOZ_CAN_RUN_SCRIPT
void HandleEventOnCaptureInDefaultEventGroup(dom::KeyboardEvent* aEvent);
// HandleEvent function for the capturing phase in the system event group.
MOZ_CAN_RUN_SCRIPT
void HandleEventOnCaptureInSystemEventGroup(dom::KeyboardEvent* aEvent);
// Check if any handler would handle the given event. Optionally returns
// whether the command handler for the event is marked with the "reserved"
// attribute.
MOZ_CAN_RUN_SCRIPT
bool HasHandlerForEvent(dom::KeyboardEvent* aEvent,
bool* aOutReservedForChrome = nullptr);
// Returns true if the key would be reserved for the given handler. A reserved
// key is not sent to a content process or single-process equivalent.
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
bool IsReservedKey(WidgetKeyboardEvent* aKeyEvent, KeyEventHandler* aHandler);
// lazily load the handlers. Overridden to handle being attached
// to a particular element rather than the document
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
virtual void EnsureHandlers() = 0;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-05 19:51:27 +03:00
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
virtual bool CanHandle(KeyEventHandler* aHandler, bool aWillExecute) const {
return true;
}
virtual bool IsDisabled() const { return false; }
virtual already_AddRefed<dom::EventTarget> GetHandlerTarget(
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
KeyEventHandler* aHandler) {
return do_AddRef(mTarget);
}
dom::EventTarget* mTarget; // weak ref;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
KeyEventHandler* mHandler; // Linked list of event handlers.
};
/**
* A listener for shortcut keys defined in XUL keyset elements.
*
* Listens for keyboard events from the document object and triggers the
* appropriate XUL key elements.
*/
class XULKeySetGlobalKeyListener final : public GlobalKeyListener {
public:
explicit XULKeySetGlobalKeyListener(dom::Element* aElement,
dom::EventTarget* aTarget);
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
static void AttachKeyHandler(dom::Element* aElementTarget);
static void DetachKeyHandler(dom::Element* aElementTarget);
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
protected:
virtual ~XULKeySetGlobalKeyListener();
// Returns the element which was passed as a parameter to the constructor,
// unless the element has been removed from the document. Optionally returns
// whether the disabled attribute is set on the element (assuming the element
// is non-null).
dom::Element* GetElement(bool* aIsDisabled = nullptr) const;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
virtual void EnsureHandlers() override;
virtual bool CanHandle(KeyEventHandler* aHandler,
bool aWillExecute) const override;
virtual bool IsDisabled() const override;
virtual already_AddRefed<dom::EventTarget> GetHandlerTarget(
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
KeyEventHandler* aHandler) override;
/**
* GetElementForHandler() retrieves an element for the handler. The element
* may be a command element or a key element.
*
* @param aHandler The handler.
* @param aElementForHandler Must not be nullptr. The element is returned to
* this.
* @return true if the handler is valid. Otherwise, false.
*/
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
bool GetElementForHandler(KeyEventHandler* aHandler,
dom::Element** aElementForHandler) const;
/**
* IsExecutableElement() returns true if aElement is executable.
* Otherwise, false. aElement should be a command element or a key element.
*/
bool IsExecutableElement(dom::Element* aElement) const;
// Using weak pointer to the DOM Element.
nsWeakPtr mWeakPtrForElement;
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
};
/**
* Listens for built-in shortcut keys.
*
* Listens to DOM keyboard events from the window or text input and runs the
* built-in shortcuts (see dom/events/keyevents) as necessary.
*/
class RootWindowGlobalKeyListener final : public GlobalKeyListener {
public:
explicit RootWindowGlobalKeyListener(dom::EventTarget* aTarget);
static void AttachKeyHandler(dom::EventTarget* aTarget);
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
static layers::KeyboardMap CollectKeyboardShortcuts();
protected:
// Is an HTML editable element focused
static bool IsHTMLEditorFocused();
virtual void EnsureHandlers() override;
2000-09-22 09:02:20 +04:00
};
Bug 1550058: Move most keyboard shortcut handling out of XBL. r=masayuki Most of our keyboard shortcut handling is handled by nsXBLWindowKeyHandler along with nsXBLPrototypeHandler. With the impending removal of XBL this needs to change. This patch moves nsXBLWindowKeyHandler to dom/events/GlobalKeyListener and copies nsXBLPrototypeHandler to dom/events/KeyEventHandler. Windows, text elements and XUL <keyset> are changed to use the new copies and anything unnecessary for those is stripped out. XBL handler elements still remain using the existing nsXBLPrototypeHandler path. Some of the code is ripped out there to make it compile. There is probably a lot more that can be removed but since the whole of XBL is likely gone soon I'm not sure it is worth cleaning that up much. Differential Revision: https://phabricator.services.mozilla.com/D42336 --HG-- rename : dom/xbl/nsXBLWindowKeyHandler.cpp => dom/events/GlobalKeyListener.cpp rename : dom/xbl/nsXBLWindowKeyHandler.h => dom/events/GlobalKeyListener.h rename : dom/xbl/nsXBLPrototypeHandler.cpp => dom/events/KeyEventHandler.cpp rename : dom/xbl/nsXBLPrototypeHandler.h => dom/events/KeyEventHandler.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h => dom/events/ShortcutKeyDefinitionsForBrowserCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h => dom/events/ShortcutKeyDefinitionsForEditorCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForInputCommon.h rename : dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h => dom/events/ShortcutKeyDefinitionsForTextAreaCommon.h rename : dom/xbl/builtin/ShortcutKeys.cpp => dom/events/ShortcutKeys.cpp rename : dom/xbl/builtin/ShortcutKeys.h => dom/events/ShortcutKeys.h rename : dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp => dom/events/android/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/android/moz.build rename : dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp => dom/events/emacs/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/emacs/moz.build rename : dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp => dom/events/mac/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/mac/moz.build rename : dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp => dom/events/unix/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/unix/moz.build rename : dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp => dom/events/win/ShortcutKeyDefinitions.cpp rename : dom/xbl/builtin/android/moz.build => dom/events/win/moz.build extra : moz-landing-system : lando
2019-09-06 20:10:40 +03:00
} // namespace mozilla
2000-09-22 09:02:20 +04:00
#endif