Bug 1436508 part 11. Remove the use of the nsIDOMKeyEvent::DOM_VK* constants in C++. r=masayuki

MozReview-Commit-ID: Honw0NrVMuV
This commit is contained in:
Boris Zbarsky 2018-02-09 11:17:09 -05:00
Родитель fce30e834b
Коммит 92bbd744e1
19 изменённых файлов: 382 добавлений и 571 удалений

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

@ -31,7 +31,6 @@
#include "XULDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULLabelElement.h"
@ -85,6 +84,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/TreeWalker.h"
using namespace mozilla;
@ -262,13 +262,13 @@ Accessible::AccessKey() const
switch (Preferences::GetInt("ui.key.generalAccessKey", -1)) {
case -1:
break;
case nsIDOMKeyEvent::DOM_VK_SHIFT:
case dom::KeyboardEventBinding::DOM_VK_SHIFT:
return KeyBinding(key, KeyBinding::kShift);
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case dom::KeyboardEventBinding::DOM_VK_CONTROL:
return KeyBinding(key, KeyBinding::kControl);
case nsIDOMKeyEvent::DOM_VK_ALT:
case dom::KeyboardEventBinding::DOM_VK_ALT:
return KeyBinding(key, KeyBinding::kAlt);
case nsIDOMKeyEvent::DOM_VK_META:
case dom::KeyboardEventBinding::DOM_VK_META:
return KeyBinding(key, KeyBinding::kMeta);
default:
return KeyBinding();

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

@ -19,7 +19,6 @@
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMKeyEvent.h"
#include "nsIServiceManager.h"
#include "nsIPresShell.h"
#include "nsIContent.h"
@ -29,6 +28,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyboardEventBinding.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -175,16 +175,16 @@ XULMenuitemAccessible::AccessKey() const
}
switch (gMenuAccesskeyModifier) {
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case dom::KeyboardEventBinding::DOM_VK_CONTROL:
modifierKey = KeyBinding::kControl;
break;
case nsIDOMKeyEvent::DOM_VK_ALT:
case dom::KeyboardEventBinding::DOM_VK_ALT:
modifierKey = KeyBinding::kAlt;
break;
case nsIDOMKeyEvent::DOM_VK_META:
case dom::KeyboardEventBinding::DOM_VK_META:
modifierKey = KeyBinding::kMeta;
break;
case nsIDOMKeyEvent::DOM_VK_WIN:
case dom::KeyboardEventBinding::DOM_VK_WIN:
modifierKey = KeyBinding::kOS;
break;
}

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

@ -12,13 +12,13 @@
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIMutableArray.h"
#include "nsIServiceManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyboardEventBinding.h"
using namespace mozilla;
using namespace mozilla::a11y;

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

@ -52,6 +52,7 @@
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/IDTracker.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/NodeBinding.h"
#include "mozilla/dom/Promise.h"
@ -8626,28 +8627,28 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
}
// If location flag isn't set, choose the location from keycode.
switch (aKeyCode) {
case nsIDOMKeyEvent::DOM_VK_NUMPAD0:
case nsIDOMKeyEvent::DOM_VK_NUMPAD1:
case nsIDOMKeyEvent::DOM_VK_NUMPAD2:
case nsIDOMKeyEvent::DOM_VK_NUMPAD3:
case nsIDOMKeyEvent::DOM_VK_NUMPAD4:
case nsIDOMKeyEvent::DOM_VK_NUMPAD5:
case nsIDOMKeyEvent::DOM_VK_NUMPAD6:
case nsIDOMKeyEvent::DOM_VK_NUMPAD7:
case nsIDOMKeyEvent::DOM_VK_NUMPAD8:
case nsIDOMKeyEvent::DOM_VK_NUMPAD9:
case nsIDOMKeyEvent::DOM_VK_MULTIPLY:
case nsIDOMKeyEvent::DOM_VK_ADD:
case nsIDOMKeyEvent::DOM_VK_SEPARATOR:
case nsIDOMKeyEvent::DOM_VK_SUBTRACT:
case nsIDOMKeyEvent::DOM_VK_DECIMAL:
case nsIDOMKeyEvent::DOM_VK_DIVIDE:
case KeyboardEventBinding::DOM_VK_NUMPAD0:
case KeyboardEventBinding::DOM_VK_NUMPAD1:
case KeyboardEventBinding::DOM_VK_NUMPAD2:
case KeyboardEventBinding::DOM_VK_NUMPAD3:
case KeyboardEventBinding::DOM_VK_NUMPAD4:
case KeyboardEventBinding::DOM_VK_NUMPAD5:
case KeyboardEventBinding::DOM_VK_NUMPAD6:
case KeyboardEventBinding::DOM_VK_NUMPAD7:
case KeyboardEventBinding::DOM_VK_NUMPAD8:
case KeyboardEventBinding::DOM_VK_NUMPAD9:
case KeyboardEventBinding::DOM_VK_MULTIPLY:
case KeyboardEventBinding::DOM_VK_ADD:
case KeyboardEventBinding::DOM_VK_SEPARATOR:
case KeyboardEventBinding::DOM_VK_SUBTRACT:
case KeyboardEventBinding::DOM_VK_DECIMAL:
case KeyboardEventBinding::DOM_VK_DIVIDE:
event.mLocation = eKeyLocationNumpad;
break;
case nsIDOMKeyEvent::DOM_VK_SHIFT:
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case nsIDOMKeyEvent::DOM_VK_ALT:
case nsIDOMKeyEvent::DOM_VK_META:
case KeyboardEventBinding::DOM_VK_SHIFT:
case KeyboardEventBinding::DOM_VK_CONTROL:
case KeyboardEventBinding::DOM_VK_ALT:
case KeyboardEventBinding::DOM_VK_META:
event.mLocation = eKeyLocationLeft;
break;
default:

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

@ -6,12 +6,12 @@
// IWYU pragma: private, include "mozilla/KeyTextEvents.h"
/**
* This header file defines all DOM keys which are defined in nsIDOMKeyEvent.
* This header file defines all DOM keys which are defined in KeyboardEvent.
* You must define NS_DEFINE_VK macro before including this.
*
* It must have two arguments, (aDOMKeyName, aDOMKeyCode)
* aDOMKeyName is a key name in DOM.
* aDOMKeyCode is one of nsIDOMKeyEvent::DOM_VK_*.
* aDOMKeyCode is one of mozilla::dom::KeyboardEventBinding::DOM_VK_*.
*
* Optionally, you can define NS_DISALLOW_SAME_KEYCODE.
*
@ -20,11 +20,11 @@
*/
#define DEFINE_VK_INTERNAL(aKeyName) \
NS_DEFINE_VK(VK##aKeyName, nsIDOMKeyEvent::DOM_VK##aKeyName)
NS_DEFINE_VK(VK##aKeyName, mozilla::dom::KeyboardEventBinding::DOM_VK##aKeyName)
// Some keycode may have different name in nsIDOMKeyEvent from its key name.
// Some keycode may have different name in KeyboardEvent from its key name.
#define DEFINE_VK_INTERNAL2(aKeyName, aKeyCodeName) \
NS_DEFINE_VK(VK##aKeyName, nsIDOMKeyEvent::DOM_VK##aKeyCodeName)
NS_DEFINE_VK(VK##aKeyName, mozilla::dom::KeyboardEventBinding::DOM_VK##aKeyCodeName)
DEFINE_VK_INTERNAL(_CANCEL)
DEFINE_VK_INTERNAL(_HELP)

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

@ -8,220 +8,4 @@
[builtinclass, uuid(2e52eb99-670d-469a-b51f-8efee2dd091d)]
interface nsIDOMKeyEvent : nsIDOMUIEvent
{
const unsigned long DOM_VK_CANCEL = 0x03;
const unsigned long DOM_VK_HELP = 0x06;
const unsigned long DOM_VK_BACK_SPACE = 0x08;
const unsigned long DOM_VK_TAB = 0x09;
const unsigned long DOM_VK_CLEAR = 0x0C;
const unsigned long DOM_VK_RETURN = 0x0D;
// DOM_VK_ENTER has been never used for representing native key events.
// Therefore, it's removed for preventing developers being confused.
// const unsigned long DOM_VK_ENTER = 0x0E;
const unsigned long DOM_VK_SHIFT = 0x10;
const unsigned long DOM_VK_CONTROL = 0x11;
const unsigned long DOM_VK_ALT = 0x12;
const unsigned long DOM_VK_PAUSE = 0x13;
const unsigned long DOM_VK_CAPS_LOCK = 0x14;
const unsigned long DOM_VK_KANA = 0x15;
const unsigned long DOM_VK_HANGUL = 0x15;
const unsigned long DOM_VK_EISU = 0x16; // Japanese Mac keyboard only
const unsigned long DOM_VK_JUNJA = 0x17;
const unsigned long DOM_VK_FINAL = 0x18;
const unsigned long DOM_VK_HANJA = 0x19;
const unsigned long DOM_VK_KANJI = 0x19;
const unsigned long DOM_VK_ESCAPE = 0x1B;
const unsigned long DOM_VK_CONVERT = 0x1C;
const unsigned long DOM_VK_NONCONVERT = 0x1D;
const unsigned long DOM_VK_ACCEPT = 0x1E;
const unsigned long DOM_VK_MODECHANGE = 0x1F;
const unsigned long DOM_VK_SPACE = 0x20;
const unsigned long DOM_VK_PAGE_UP = 0x21;
const unsigned long DOM_VK_PAGE_DOWN = 0x22;
const unsigned long DOM_VK_END = 0x23;
const unsigned long DOM_VK_HOME = 0x24;
const unsigned long DOM_VK_LEFT = 0x25;
const unsigned long DOM_VK_UP = 0x26;
const unsigned long DOM_VK_RIGHT = 0x27;
const unsigned long DOM_VK_DOWN = 0x28;
const unsigned long DOM_VK_SELECT = 0x29;
const unsigned long DOM_VK_PRINT = 0x2A;
const unsigned long DOM_VK_EXECUTE = 0x2B;
const unsigned long DOM_VK_PRINTSCREEN = 0x2C;
const unsigned long DOM_VK_INSERT = 0x2D;
const unsigned long DOM_VK_DELETE = 0x2E;
// DOM_VK_0 - DOM_VK_9 match their ascii values
const unsigned long DOM_VK_0 = 0x30;
const unsigned long DOM_VK_1 = 0x31;
const unsigned long DOM_VK_2 = 0x32;
const unsigned long DOM_VK_3 = 0x33;
const unsigned long DOM_VK_4 = 0x34;
const unsigned long DOM_VK_5 = 0x35;
const unsigned long DOM_VK_6 = 0x36;
const unsigned long DOM_VK_7 = 0x37;
const unsigned long DOM_VK_8 = 0x38;
const unsigned long DOM_VK_9 = 0x39;
const unsigned long DOM_VK_COLON = 0x3A;
const unsigned long DOM_VK_SEMICOLON = 0x3B;
const unsigned long DOM_VK_LESS_THAN = 0x3C;
const unsigned long DOM_VK_EQUALS = 0x3D;
const unsigned long DOM_VK_GREATER_THAN = 0x3E;
const unsigned long DOM_VK_QUESTION_MARK = 0x3F;
const unsigned long DOM_VK_AT = 0x40;
// DOM_VK_A - DOM_VK_Z match their ascii values
const unsigned long DOM_VK_A = 0x41;
const unsigned long DOM_VK_B = 0x42;
const unsigned long DOM_VK_C = 0x43;
const unsigned long DOM_VK_D = 0x44;
const unsigned long DOM_VK_E = 0x45;
const unsigned long DOM_VK_F = 0x46;
const unsigned long DOM_VK_G = 0x47;
const unsigned long DOM_VK_H = 0x48;
const unsigned long DOM_VK_I = 0x49;
const unsigned long DOM_VK_J = 0x4A;
const unsigned long DOM_VK_K = 0x4B;
const unsigned long DOM_VK_L = 0x4C;
const unsigned long DOM_VK_M = 0x4D;
const unsigned long DOM_VK_N = 0x4E;
const unsigned long DOM_VK_O = 0x4F;
const unsigned long DOM_VK_P = 0x50;
const unsigned long DOM_VK_Q = 0x51;
const unsigned long DOM_VK_R = 0x52;
const unsigned long DOM_VK_S = 0x53;
const unsigned long DOM_VK_T = 0x54;
const unsigned long DOM_VK_U = 0x55;
const unsigned long DOM_VK_V = 0x56;
const unsigned long DOM_VK_W = 0x57;
const unsigned long DOM_VK_X = 0x58;
const unsigned long DOM_VK_Y = 0x59;
const unsigned long DOM_VK_Z = 0x5A;
const unsigned long DOM_VK_WIN = 0x5B;
const unsigned long DOM_VK_CONTEXT_MENU = 0x5D;
const unsigned long DOM_VK_SLEEP = 0x5F;
// Numpad keys
const unsigned long DOM_VK_NUMPAD0 = 0x60;
const unsigned long DOM_VK_NUMPAD1 = 0x61;
const unsigned long DOM_VK_NUMPAD2 = 0x62;
const unsigned long DOM_VK_NUMPAD3 = 0x63;
const unsigned long DOM_VK_NUMPAD4 = 0x64;
const unsigned long DOM_VK_NUMPAD5 = 0x65;
const unsigned long DOM_VK_NUMPAD6 = 0x66;
const unsigned long DOM_VK_NUMPAD7 = 0x67;
const unsigned long DOM_VK_NUMPAD8 = 0x68;
const unsigned long DOM_VK_NUMPAD9 = 0x69;
const unsigned long DOM_VK_MULTIPLY = 0x6A;
const unsigned long DOM_VK_ADD = 0x6B;
const unsigned long DOM_VK_SEPARATOR = 0x6C;
const unsigned long DOM_VK_SUBTRACT = 0x6D;
const unsigned long DOM_VK_DECIMAL = 0x6E;
const unsigned long DOM_VK_DIVIDE = 0x6F;
const unsigned long DOM_VK_F1 = 0x70;
const unsigned long DOM_VK_F2 = 0x71;
const unsigned long DOM_VK_F3 = 0x72;
const unsigned long DOM_VK_F4 = 0x73;
const unsigned long DOM_VK_F5 = 0x74;
const unsigned long DOM_VK_F6 = 0x75;
const unsigned long DOM_VK_F7 = 0x76;
const unsigned long DOM_VK_F8 = 0x77;
const unsigned long DOM_VK_F9 = 0x78;
const unsigned long DOM_VK_F10 = 0x79;
const unsigned long DOM_VK_F11 = 0x7A;
const unsigned long DOM_VK_F12 = 0x7B;
const unsigned long DOM_VK_F13 = 0x7C;
const unsigned long DOM_VK_F14 = 0x7D;
const unsigned long DOM_VK_F15 = 0x7E;
const unsigned long DOM_VK_F16 = 0x7F;
const unsigned long DOM_VK_F17 = 0x80;
const unsigned long DOM_VK_F18 = 0x81;
const unsigned long DOM_VK_F19 = 0x82;
const unsigned long DOM_VK_F20 = 0x83;
const unsigned long DOM_VK_F21 = 0x84;
const unsigned long DOM_VK_F22 = 0x85;
const unsigned long DOM_VK_F23 = 0x86;
const unsigned long DOM_VK_F24 = 0x87;
const unsigned long DOM_VK_NUM_LOCK = 0x90;
const unsigned long DOM_VK_SCROLL_LOCK = 0x91;
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
// for compatibility with the other web browsers on Windows.
const unsigned long DOM_VK_WIN_OEM_FJ_JISHO = 0x92;
const unsigned long DOM_VK_WIN_OEM_FJ_MASSHOU = 0x93;
const unsigned long DOM_VK_WIN_OEM_FJ_TOUROKU = 0x94;
const unsigned long DOM_VK_WIN_OEM_FJ_LOYA = 0x95;
const unsigned long DOM_VK_WIN_OEM_FJ_ROYA = 0x96;
const unsigned long DOM_VK_CIRCUMFLEX = 0xA0;
const unsigned long DOM_VK_EXCLAMATION = 0xA1;
const unsigned long DOM_VK_DOUBLE_QUOTE = 0xA2;
const unsigned long DOM_VK_HASH = 0xA3;
const unsigned long DOM_VK_DOLLAR = 0xA4;
const unsigned long DOM_VK_PERCENT = 0xA5;
const unsigned long DOM_VK_AMPERSAND = 0xA6;
const unsigned long DOM_VK_UNDERSCORE = 0xA7;
const unsigned long DOM_VK_OPEN_PAREN = 0xA8;
const unsigned long DOM_VK_CLOSE_PAREN = 0xA9;
const unsigned long DOM_VK_ASTERISK = 0xAA;
const unsigned long DOM_VK_PLUS = 0xAB;
const unsigned long DOM_VK_PIPE = 0xAC;
const unsigned long DOM_VK_HYPHEN_MINUS = 0xAD;
const unsigned long DOM_VK_OPEN_CURLY_BRACKET = 0xAE;
const unsigned long DOM_VK_CLOSE_CURLY_BRACKET = 0xAF;
const unsigned long DOM_VK_TILDE = 0xB0;
const unsigned long DOM_VK_VOLUME_MUTE = 0xB5;
const unsigned long DOM_VK_VOLUME_DOWN = 0xB6;
const unsigned long DOM_VK_VOLUME_UP = 0xB7;
const unsigned long DOM_VK_COMMA = 0xBC;
const unsigned long DOM_VK_PERIOD = 0xBE;
const unsigned long DOM_VK_SLASH = 0xBF;
const unsigned long DOM_VK_BACK_QUOTE = 0xC0;
const unsigned long DOM_VK_OPEN_BRACKET = 0xDB; // square bracket
const unsigned long DOM_VK_BACK_SLASH = 0xDC;
const unsigned long DOM_VK_CLOSE_BRACKET = 0xDD; // square bracket
const unsigned long DOM_VK_QUOTE = 0xDE; // Apostrophe
const unsigned long DOM_VK_META = 0xE0;
const unsigned long DOM_VK_ALTGR = 0xE1;
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
// for compatibility with the other web browsers on Windows.
const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3;
const unsigned long DOM_VK_WIN_ICO_00 = 0xE4;
const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6;
const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9;
const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA;
const unsigned long DOM_VK_WIN_OEM_PA1 = 0xEB;
const unsigned long DOM_VK_WIN_OEM_PA2 = 0xEC;
const unsigned long DOM_VK_WIN_OEM_PA3 = 0xED;
const unsigned long DOM_VK_WIN_OEM_WSCTRL = 0xEE;
const unsigned long DOM_VK_WIN_OEM_CUSEL = 0xEF;
const unsigned long DOM_VK_WIN_OEM_ATTN = 0xF0;
const unsigned long DOM_VK_WIN_OEM_FINISH = 0xF1;
const unsigned long DOM_VK_WIN_OEM_COPY = 0xF2;
const unsigned long DOM_VK_WIN_OEM_AUTO = 0xF3;
const unsigned long DOM_VK_WIN_OEM_ENLW = 0xF4;
const unsigned long DOM_VK_WIN_OEM_BACKTAB = 0xF5;
// Following keys are not used on most keyboards. However, for compatibility
// with other browsers on Windows, we should define them.
const unsigned long DOM_VK_ATTN = 0xF6;
const unsigned long DOM_VK_CRSEL = 0xF7;
const unsigned long DOM_VK_EXSEL = 0xF8;
const unsigned long DOM_VK_EREOF = 0xF9;
const unsigned long DOM_VK_PLAY = 0xFA;
const unsigned long DOM_VK_ZOOM = 0xFB;
const unsigned long DOM_VK_PA1 = 0xFD;
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
// for compatibility with the other web browsers on Windows.
const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE;
};

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

@ -50,6 +50,7 @@
#include "mozilla/dom/EventHandlerBinding.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/layers/KeyboardMap.h"
#include "xpcpublic.h"
@ -240,7 +241,7 @@ nsXBLPrototypeHandler::InitAccessKeys()
#ifdef XP_MACOSX
kMenuAccessKey = 0;
#else
kMenuAccessKey = nsIDOMKeyEvent::DOM_VK_ALT;
kMenuAccessKey = KeyboardEventBinding::DOM_VK_ALT;
#endif
// Get the menu access key value from prefs, overriding the default:
@ -529,7 +530,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
aEvent->PreventDefault();
if (mEventName == nsGkAtoms::keypress &&
mDetail == nsIDOMKeyEvent::DOM_VK_SPACE &&
mDetail == KeyboardEventBinding::DOM_VK_SPACE &&
mMisc == 1) {
// get the focused element so that we can pageDown only at
// certain times.
@ -794,16 +795,16 @@ int32_t nsXBLPrototypeHandler::KeyToMask(int32_t key)
{
switch (key)
{
case nsIDOMKeyEvent::DOM_VK_META:
case KeyboardEventBinding::DOM_VK_META:
return cMeta | cMetaMask;
case nsIDOMKeyEvent::DOM_VK_WIN:
case KeyboardEventBinding::DOM_VK_WIN:
return cOS | cOSMask;
case nsIDOMKeyEvent::DOM_VK_ALT:
case KeyboardEventBinding::DOM_VK_ALT:
return cAlt | cAltMask;
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case KeyboardEventBinding::DOM_VK_CONTROL:
default:
return cControl | cControlMask;
}
@ -816,13 +817,13 @@ nsXBLPrototypeHandler::AccelKeyMask()
{
switch (WidgetInputEvent::AccelModifier()) {
case MODIFIER_ALT:
return KeyToMask(nsIDOMKeyEvent::DOM_VK_ALT);
return KeyToMask(KeyboardEventBinding::DOM_VK_ALT);
case MODIFIER_CONTROL:
return KeyToMask(nsIDOMKeyEvent::DOM_VK_CONTROL);
return KeyToMask(KeyboardEventBinding::DOM_VK_CONTROL);
case MODIFIER_META:
return KeyToMask(nsIDOMKeyEvent::DOM_VK_META);
return KeyToMask(KeyboardEventBinding::DOM_VK_META);
case MODIFIER_OS:
return KeyToMask(nsIDOMKeyEvent::DOM_VK_WIN);
return KeyToMask(KeyboardEventBinding::DOM_VK_WIN);
default:
MOZ_CRASH("Handle the new result of WidgetInputEvent::AccelModifier()");
return 0;

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

@ -40,6 +40,7 @@
#include "mozilla/Services.h"
#include "mozilla/TextEditor.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/Selection.h"
#include "mozInlineSpellWordUtil.h"
#include "mozISpellI18NManager.h"
@ -1874,16 +1875,18 @@ mozInlineSpellChecker::OnKeyPress(nsIDOMEvent* aKeyEvent)
// we only care about navigation keys that moved selection
switch (keyCode)
{
case nsIDOMKeyEvent::DOM_VK_RIGHT:
case nsIDOMKeyEvent::DOM_VK_LEFT:
HandleNavigationEvent(false, keyCode == nsIDOMKeyEvent::DOM_VK_RIGHT ? 1 : -1);
case KeyboardEventBinding::DOM_VK_RIGHT:
case KeyboardEventBinding::DOM_VK_LEFT:
HandleNavigationEvent(false,
keyCode == KeyboardEventBinding::DOM_VK_RIGHT ?
1 : -1);
break;
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
case nsIDOMKeyEvent::DOM_VK_HOME:
case nsIDOMKeyEvent::DOM_VK_END:
case nsIDOMKeyEvent::DOM_VK_PAGE_UP:
case nsIDOMKeyEvent::DOM_VK_PAGE_DOWN:
case KeyboardEventBinding::DOM_VK_UP:
case KeyboardEventBinding::DOM_VK_DOWN:
case KeyboardEventBinding::DOM_VK_HOME:
case KeyboardEventBinding::DOM_VK_END:
case KeyboardEventBinding::DOM_VK_PAGE_UP:
case KeyboardEventBinding::DOM_VK_PAGE_DOWN:
HandleNavigationEvent(true /* force a spelling correction */);
break;
}

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

@ -8,6 +8,7 @@
#include "mozilla/dom/MenuBoxObjectBinding.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/Element.h"
#include "nsIFrame.h"
#include "nsMenuBarFrame.h"
@ -104,10 +105,10 @@ bool MenuBoxObject::HandleKeyPress(KeyboardEvent& keyEvent)
uint32_t keyCode = keyEvent.KeyCode();
switch (keyCode) {
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
case nsIDOMKeyEvent::DOM_VK_HOME:
case nsIDOMKeyEvent::DOM_VK_END:
case KeyboardEventBinding::DOM_VK_UP:
case KeyboardEventBinding::DOM_VK_DOWN:
case KeyboardEventBinding::DOM_VK_HOME:
case KeyboardEventBinding::DOM_VK_END:
{
nsNavigationDirection theDirection;
theDirection = NS_DIRECTION_FROM_KEY_CODE(popupFrame, keyCode);

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

@ -23,6 +23,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
using namespace mozilla;
using mozilla::dom::KeyboardEvent;
@ -148,22 +149,32 @@ void nsMenuBarListener::InitAccessKey()
mAccessKey = 0;
mAccessKeyMask = 0;
#else
mAccessKey = nsIDOMKeyEvent::DOM_VK_ALT;
mAccessKey = dom::KeyboardEventBinding::DOM_VK_ALT;
mAccessKeyMask = MODIFIER_ALT;
#endif
// Get the menu access key value from prefs, overriding the default:
mAccessKey = Preferences::GetInt("ui.key.menuAccessKey", mAccessKey);
if (mAccessKey == nsIDOMKeyEvent::DOM_VK_SHIFT)
switch (mAccessKey) {
case dom::KeyboardEventBinding::DOM_VK_SHIFT:
mAccessKeyMask = MODIFIER_SHIFT;
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_CONTROL)
break;
case dom::KeyboardEventBinding::DOM_VK_CONTROL:
mAccessKeyMask = MODIFIER_CONTROL;
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_ALT)
break;
case dom::KeyboardEventBinding::DOM_VK_ALT:
mAccessKeyMask = MODIFIER_ALT;
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_META)
break;
case dom::KeyboardEventBinding::DOM_VK_META:
mAccessKeyMask = MODIFIER_META;
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_WIN)
break;
case dom::KeyboardEventBinding::DOM_VK_WIN:
mAccessKeyMask = MODIFIER_OS;
break;
default:
// Don't touch mAccessKeyMask.
break;
}
}
void

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

@ -110,7 +110,7 @@ protected:
bool mAccessKeyDownCanceled;
// Does the access key by itself focus the menubar?
static bool mAccessKeyFocuses;
// See nsIDOMKeyEvent.h for sample values.
// See KeyboardEvent for sample values (DOM_VK_* constants).
static int32_t mAccessKey;
// Modifier mask for the access key.
static mozilla::Modifiers mAccessKeyMask;

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

@ -56,6 +56,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/PopupBoxObject.h"
#include <algorithm>
@ -2106,7 +2107,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(KeyboardEvent* aKeyEvent, bool& doAction)
DOMTimeStamp keyTime = aKeyEvent->TimeStamp();
if (charCode == 0) {
if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
if (keyCode == dom::KeyboardEventBinding::DOM_VK_BACK_SPACE) {
if (!isMenu && !mIncrementalString.IsEmpty()) {
mIncrementalString.SetLength(mIncrementalString.Length() - 1);
return nullptr;

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

@ -37,6 +37,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
@ -48,29 +49,34 @@
using namespace mozilla;
using namespace mozilla::dom;
static_assert(nsIDOMKeyEvent::DOM_VK_HOME == nsIDOMKeyEvent::DOM_VK_END + 1 &&
nsIDOMKeyEvent::DOM_VK_LEFT == nsIDOMKeyEvent::DOM_VK_END + 2 &&
nsIDOMKeyEvent::DOM_VK_UP == nsIDOMKeyEvent::DOM_VK_END + 3 &&
nsIDOMKeyEvent::DOM_VK_RIGHT == nsIDOMKeyEvent::DOM_VK_END + 4 &&
nsIDOMKeyEvent::DOM_VK_DOWN == nsIDOMKeyEvent::DOM_VK_END + 5,
static_assert(KeyboardEventBinding::DOM_VK_HOME ==
KeyboardEventBinding::DOM_VK_END + 1 &&
KeyboardEventBinding::DOM_VK_LEFT ==
KeyboardEventBinding::DOM_VK_END + 2 &&
KeyboardEventBinding::DOM_VK_UP ==
KeyboardEventBinding::DOM_VK_END + 3 &&
KeyboardEventBinding::DOM_VK_RIGHT ==
KeyboardEventBinding::DOM_VK_END + 4 &&
KeyboardEventBinding::DOM_VK_DOWN ==
KeyboardEventBinding::DOM_VK_END + 5,
"nsXULPopupManager assumes some keyCode values are consecutive");
const nsNavigationDirection DirectionFromKeyCodeTable[2][6] = {
{
eNavigationDirection_Last, // nsIDOMKeyEvent::DOM_VK_END
eNavigationDirection_First, // nsIDOMKeyEvent::DOM_VK_HOME
eNavigationDirection_Start, // nsIDOMKeyEvent::DOM_VK_LEFT
eNavigationDirection_Before, // nsIDOMKeyEvent::DOM_VK_UP
eNavigationDirection_End, // nsIDOMKeyEvent::DOM_VK_RIGHT
eNavigationDirection_After // nsIDOMKeyEvent::DOM_VK_DOWN
eNavigationDirection_Last, // KeyboardEventBinding::DOM_VK_END
eNavigationDirection_First, // KeyboardEventBinding::DOM_VK_HOME
eNavigationDirection_Start, // KeyboardEventBinding::DOM_VK_LEFT
eNavigationDirection_Before, // KeyboardEventBinding::DOM_VK_UP
eNavigationDirection_End, // KeyboardEventBinding::DOM_VK_RIGHT
eNavigationDirection_After // KeyboardEventBinding::DOM_VK_DOWN
},
{
eNavigationDirection_Last, // nsIDOMKeyEvent::DOM_VK_END
eNavigationDirection_First, // nsIDOMKeyEvent::DOM_VK_HOME
eNavigationDirection_End, // nsIDOMKeyEvent::DOM_VK_LEFT
eNavigationDirection_Before, // nsIDOMKeyEvent::DOM_VK_UP
eNavigationDirection_Start, // nsIDOMKeyEvent::DOM_VK_RIGHT
eNavigationDirection_After // nsIDOMKeyEvent::DOM_VK_DOWN
eNavigationDirection_Last, // KeyboardEventBinding::DOM_VK_END
eNavigationDirection_First, // KeyboardEventBinding::DOM_VK_HOME
eNavigationDirection_End, // KeyboardEventBinding::DOM_VK_LEFT
eNavigationDirection_Before, // KeyboardEventBinding::DOM_VK_UP
eNavigationDirection_Start, // KeyboardEventBinding::DOM_VK_RIGHT
eNavigationDirection_After // KeyboardEventBinding::DOM_VK_DOWN
}
};
@ -2187,8 +2193,8 @@ nsXULPopupManager::HandleKeyboardNavigation(uint32_t aKeyCode)
return false;
nsNavigationDirection theDirection;
NS_ASSERTION(aKeyCode >= nsIDOMKeyEvent::DOM_VK_END &&
aKeyCode <= nsIDOMKeyEvent::DOM_VK_DOWN, "Illegal key code");
NS_ASSERTION(aKeyCode >= KeyboardEventBinding::DOM_VK_END &&
aKeyCode <= KeyboardEventBinding::DOM_VK_DOWN, "Illegal key code");
theDirection = NS_DIRECTION_FROM_KEY_CODE(itemFrame, aKeyCode);
bool selectFirstItem = true;
@ -2337,7 +2343,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
// Escape should close panels, but the other keys should have no effect.
if (aTopVisibleMenuItem &&
aTopVisibleMenuItem->PopupType() != ePopupTypeMenu) {
if (keyCode == nsIDOMKeyEvent::DOM_VK_ESCAPE) {
if (keyCode == KeyboardEventBinding::DOM_VK_ESCAPE) {
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
aKeyEvent->StopPropagation();
aKeyEvent->StopCrossProcessForwarding();
@ -2348,8 +2354,8 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
bool consume = (aTopVisibleMenuItem || mActiveMenuBar);
switch (keyCode) {
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
case KeyboardEventBinding::DOM_VK_UP:
case KeyboardEventBinding::DOM_VK_DOWN:
#ifndef XP_MACOSX
// roll up the popup when alt+up/down are pressed within a menulist.
if (aKeyEvent->AltKey() &&
@ -2361,21 +2367,22 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
MOZ_FALLTHROUGH;
#endif
case nsIDOMKeyEvent::DOM_VK_LEFT:
case nsIDOMKeyEvent::DOM_VK_RIGHT:
case nsIDOMKeyEvent::DOM_VK_HOME:
case nsIDOMKeyEvent::DOM_VK_END:
case KeyboardEventBinding::DOM_VK_LEFT:
case KeyboardEventBinding::DOM_VK_RIGHT:
case KeyboardEventBinding::DOM_VK_HOME:
case KeyboardEventBinding::DOM_VK_END:
HandleKeyboardNavigation(keyCode);
break;
case nsIDOMKeyEvent::DOM_VK_PAGE_DOWN:
case nsIDOMKeyEvent::DOM_VK_PAGE_UP:
case KeyboardEventBinding::DOM_VK_PAGE_DOWN:
case KeyboardEventBinding::DOM_VK_PAGE_UP:
if (aTopVisibleMenuItem) {
aTopVisibleMenuItem->Frame()->ChangeByPage(keyCode == nsIDOMKeyEvent::DOM_VK_PAGE_UP);
aTopVisibleMenuItem->Frame()->ChangeByPage(
keyCode == KeyboardEventBinding::DOM_VK_PAGE_UP);
}
break;
case nsIDOMKeyEvent::DOM_VK_ESCAPE:
case KeyboardEventBinding::DOM_VK_ESCAPE:
// Pressing Escape hides one level of menus only. If no menu is open,
// check if a menubar is active and inform it that a menu closed. Even
// though in this latter case, a menu didn't actually close, the effect
@ -2387,9 +2394,9 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
}
break;
case nsIDOMKeyEvent::DOM_VK_TAB:
case KeyboardEventBinding::DOM_VK_TAB:
#ifndef XP_MACOSX
case nsIDOMKeyEvent::DOM_VK_F10:
case KeyboardEventBinding::DOM_VK_F10:
#endif
if (aTopVisibleMenuItem &&
!aTopVisibleMenuItem->Frame()->GetContent()->AsElement()->AttrValueIs(
@ -2405,7 +2412,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
// Intentional fall-through to RETURN case
MOZ_FALLTHROUGH;
case nsIDOMKeyEvent::DOM_VK_RETURN: {
case KeyboardEventBinding::DOM_VK_RETURN: {
// If there is a popup open, check if the current item needs to be opened.
// Otherwise, tell the active menubar, if any, to activate the menu. The
// Enter method will return a menu if one needs to be opened as a result.
@ -2700,13 +2707,13 @@ nsXULPopupManager::KeyDown(KeyboardEvent* aKeyEvent)
uint32_t theChar = aKeyEvent->KeyCode();
if (theChar == (uint32_t)menuAccessKey) {
bool ctrl = (menuAccessKey != nsIDOMKeyEvent::DOM_VK_CONTROL &&
bool ctrl = (menuAccessKey != KeyboardEventBinding::DOM_VK_CONTROL &&
aKeyEvent->CtrlKey());
bool alt = (menuAccessKey != nsIDOMKeyEvent::DOM_VK_ALT &&
bool alt = (menuAccessKey != KeyboardEventBinding::DOM_VK_ALT &&
aKeyEvent->AltKey());
bool shift = (menuAccessKey != nsIDOMKeyEvent::DOM_VK_SHIFT &&
bool shift = (menuAccessKey != KeyboardEventBinding::DOM_VK_SHIFT &&
aKeyEvent->ShiftKey());
bool meta = (menuAccessKey != nsIDOMKeyEvent::DOM_VK_META &&
bool meta = (menuAccessKey != KeyboardEventBinding::DOM_VK_META &&
aKeyEvent->MetaKey());
if (!(ctrl || alt || shift || meta)) {
// The access key just went down and no other

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

@ -128,9 +128,9 @@ static_assert(NS_STYLE_DIRECTION_LTR == 0 && NS_STYLE_DIRECTION_RTL == 1,
*/
extern const nsNavigationDirection DirectionFromKeyCodeTable[2][6];
#define NS_DIRECTION_FROM_KEY_CODE(frame, keycode) \
(DirectionFromKeyCodeTable[frame->StyleVisibility()->mDirection] \
[keycode - nsIDOMKeyEvent::DOM_VK_END])
#define NS_DIRECTION_FROM_KEY_CODE(frame, keycode) \
(DirectionFromKeyCodeTable[frame->StyleVisibility()->mDirection] \
[keycode - mozilla::dom::KeyboardEventBinding::DOM_VK_END])
// nsMenuChainItem holds info about an open popup. Items are stored in a
// doubly linked list. Note that the linked list is stored beginning from

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

@ -17,10 +17,10 @@
#include "nsITreeBoxObject.h"
#include "nsITreeColumns.h"
#include "nsIObserverService.h"
#include "nsIDOMKeyEvent.h"
#include "mozilla/Services.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/KeyboardEventBinding.h"
static const char *kAutoCompleteSearchCID = "@mozilla.org/autocomplete/search;1?name=";
@ -291,7 +291,7 @@ nsAutoCompleteController::HandleText(bool *_retval)
// we should reopen it forcibly even if the value is empty.
if (popupClosedByCompositionStart && handlingCompositionCommit) {
bool cancel;
HandleKeyNavigation(nsIDOMKeyEvent::DOM_VK_DOWN, &cancel);
HandleKeyNavigation(dom::KeyboardEventBinding::DOM_VK_DOWN, &cancel);
return NS_OK;
}
ClosePopup();
@ -441,10 +441,10 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
input->GetDisableAutoComplete(&disabled);
NS_ENSURE_TRUE(!disabled, NS_OK);
if (aKey == nsIDOMKeyEvent::DOM_VK_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_DOWN ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_DOWN)
if (aKey == dom::KeyboardEventBinding::DOM_VK_UP ||
aKey == dom::KeyboardEventBinding::DOM_VK_DOWN ||
aKey == dom::KeyboardEventBinding::DOM_VK_PAGE_UP ||
aKey == dom::KeyboardEventBinding::DOM_VK_PAGE_DOWN)
{
// Prevent the input from handling up/down events, as it may move
// the cursor to home/end on some systems
@ -453,10 +453,10 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
bool isOpen = false;
input->GetPopupOpen(&isOpen);
if (isOpen) {
bool reverse = aKey == nsIDOMKeyEvent::DOM_VK_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ? true : false;
bool page = aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_DOWN ? true : false;
bool reverse = aKey == dom::KeyboardEventBinding::DOM_VK_UP ||
aKey == dom::KeyboardEventBinding::DOM_VK_PAGE_UP ? true : false;
bool page = aKey == dom::KeyboardEventBinding::DOM_VK_PAGE_UP ||
aKey == dom::KeyboardEventBinding::DOM_VK_PAGE_DOWN ? true : false;
// Fill in the value of the textbox with whatever is selected in the popup
// if the completeSelectedIndex attribute is set. We check this before
@ -514,13 +514,13 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
// shortcuts for up and down move to the beginning and end of the field
// otherwise.
int32_t start, end;
if (aKey == nsIDOMKeyEvent::DOM_VK_UP) {
if (aKey == dom::KeyboardEventBinding::DOM_VK_UP) {
input->GetSelectionStart(&start);
input->GetSelectionEnd(&end);
if (start > 0 || start != end)
*_retval = false;
}
else if (aKey == nsIDOMKeyEvent::DOM_VK_DOWN) {
else if (aKey == dom::KeyboardEventBinding::DOM_VK_DOWN) {
nsAutoString text;
input->GetTextValue(text);
input->GetSelectionStart(&start);
@ -560,10 +560,10 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
}
}
}
} else if ( aKey == nsIDOMKeyEvent::DOM_VK_LEFT
|| aKey == nsIDOMKeyEvent::DOM_VK_RIGHT
} else if ( aKey == dom::KeyboardEventBinding::DOM_VK_LEFT
|| aKey == dom::KeyboardEventBinding::DOM_VK_RIGHT
#ifndef XP_MACOSX
|| aKey == nsIDOMKeyEvent::DOM_VK_HOME
|| aKey == dom::KeyboardEventBinding::DOM_VK_HOME
#endif
)
{

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

@ -33,140 +33,140 @@
* Spoofed keycodes for English content (US English keyboard layout).
*/
CONTROL(Alt, AltLeft, nsIDOMKeyEvent::DOM_VK_ALT)
CONTROL(ArrowDown, ArrowDown, nsIDOMKeyEvent::DOM_VK_DOWN)
CONTROL(ArrowLeft, ArrowLeft, nsIDOMKeyEvent::DOM_VK_LEFT)
CONTROL(ArrowRight, ArrowRight, nsIDOMKeyEvent::DOM_VK_RIGHT)
CONTROL(ArrowUp, ArrowUp, nsIDOMKeyEvent::DOM_VK_UP)
CONTROL(Backspace, Backspace, nsIDOMKeyEvent::DOM_VK_BACK_SPACE)
CONTROL(CapsLock, CapsLock, nsIDOMKeyEvent::DOM_VK_CAPS_LOCK)
CONTROL(Alt, AltLeft, dom::KeyboardEventBinding::DOM_VK_ALT)
CONTROL(ArrowDown, ArrowDown, dom::KeyboardEventBinding::DOM_VK_DOWN)
CONTROL(ArrowLeft, ArrowLeft, dom::KeyboardEventBinding::DOM_VK_LEFT)
CONTROL(ArrowRight, ArrowRight, dom::KeyboardEventBinding::DOM_VK_RIGHT)
CONTROL(ArrowUp, ArrowUp, dom::KeyboardEventBinding::DOM_VK_UP)
CONTROL(Backspace, Backspace, dom::KeyboardEventBinding::DOM_VK_BACK_SPACE)
CONTROL(CapsLock, CapsLock, dom::KeyboardEventBinding::DOM_VK_CAPS_LOCK)
// Leaving "ContextMenu" key unimplemented; not every english keyboard has this.
// For example, MACOS doesn't have this.
CONTROL(Control, ControlLeft, nsIDOMKeyEvent::DOM_VK_CONTROL)
CONTROL(Delete, Delete, nsIDOMKeyEvent::DOM_VK_DELETE)
CONTROL(End, End, nsIDOMKeyEvent::DOM_VK_END)
CONTROL(Enter, Enter, nsIDOMKeyEvent::DOM_VK_RETURN)
CONTROL(Escape, Escape, nsIDOMKeyEvent::DOM_VK_ESCAPE)
CONTROL(Control, ControlLeft, dom::KeyboardEventBinding::DOM_VK_CONTROL)
CONTROL(Delete, Delete, dom::KeyboardEventBinding::DOM_VK_DELETE)
CONTROL(End, End, dom::KeyboardEventBinding::DOM_VK_END)
CONTROL(Enter, Enter, dom::KeyboardEventBinding::DOM_VK_RETURN)
CONTROL(Escape, Escape, dom::KeyboardEventBinding::DOM_VK_ESCAPE)
// Leaving "Help" key unimplemented; it only appears in some keyboard in Linux.
CONTROL(Home, Home, nsIDOMKeyEvent::DOM_VK_HOME)
CONTROL(Insert, Insert, nsIDOMKeyEvent::DOM_VK_INSERT)
CONTROL(Meta, OSLeft, nsIDOMKeyEvent::DOM_VK_WIN)
CONTROL(OS, OSLeft, nsIDOMKeyEvent::DOM_VK_WIN)
CONTROL(PageDown, PageDown, nsIDOMKeyEvent::DOM_VK_PAGE_DOWN)
CONTROL(PageUp, PageUp, nsIDOMKeyEvent::DOM_VK_PAGE_UP)
CONTROL(Home, Home, dom::KeyboardEventBinding::DOM_VK_HOME)
CONTROL(Insert, Insert, dom::KeyboardEventBinding::DOM_VK_INSERT)
CONTROL(Meta, OSLeft, dom::KeyboardEventBinding::DOM_VK_WIN)
CONTROL(OS, OSLeft, dom::KeyboardEventBinding::DOM_VK_WIN)
CONTROL(PageDown, PageDown, dom::KeyboardEventBinding::DOM_VK_PAGE_DOWN)
CONTROL(PageUp, PageUp, dom::KeyboardEventBinding::DOM_VK_PAGE_UP)
// Leaving "Pause", "PrintScreen" and "ScrollLock" keys unimplemented; they are
// non-MACOS only.
CONTROL(Shift, ShiftLeft, nsIDOMKeyEvent::DOM_VK_SHIFT)
CONTROL(Tab, Tab, nsIDOMKeyEvent::DOM_VK_TAB)
CONTROL(F1, F1, nsIDOMKeyEvent::DOM_VK_F1)
CONTROL(F2, F2, nsIDOMKeyEvent::DOM_VK_F2)
CONTROL(F3, F3, nsIDOMKeyEvent::DOM_VK_F3)
CONTROL(F4, F4, nsIDOMKeyEvent::DOM_VK_F4)
CONTROL(F5, F5, nsIDOMKeyEvent::DOM_VK_F5)
CONTROL(F6, F6, nsIDOMKeyEvent::DOM_VK_F6)
CONTROL(F7, F7, nsIDOMKeyEvent::DOM_VK_F7)
CONTROL(F8, F8, nsIDOMKeyEvent::DOM_VK_F8)
CONTROL(F9, F9, nsIDOMKeyEvent::DOM_VK_F9)
CONTROL(F10, F10, nsIDOMKeyEvent::DOM_VK_F10)
CONTROL(F11, F11, nsIDOMKeyEvent::DOM_VK_F11)
CONTROL(F12, F12, nsIDOMKeyEvent::DOM_VK_F12)
CONTROL(Shift, ShiftLeft, dom::KeyboardEventBinding::DOM_VK_SHIFT)
CONTROL(Tab, Tab, dom::KeyboardEventBinding::DOM_VK_TAB)
CONTROL(F1, F1, dom::KeyboardEventBinding::DOM_VK_F1)
CONTROL(F2, F2, dom::KeyboardEventBinding::DOM_VK_F2)
CONTROL(F3, F3, dom::KeyboardEventBinding::DOM_VK_F3)
CONTROL(F4, F4, dom::KeyboardEventBinding::DOM_VK_F4)
CONTROL(F5, F5, dom::KeyboardEventBinding::DOM_VK_F5)
CONTROL(F6, F6, dom::KeyboardEventBinding::DOM_VK_F6)
CONTROL(F7, F7, dom::KeyboardEventBinding::DOM_VK_F7)
CONTROL(F8, F8, dom::KeyboardEventBinding::DOM_VK_F8)
CONTROL(F9, F9, dom::KeyboardEventBinding::DOM_VK_F9)
CONTROL(F10, F10, dom::KeyboardEventBinding::DOM_VK_F10)
CONTROL(F11, F11, dom::KeyboardEventBinding::DOM_VK_F11)
CONTROL(F12, F12, dom::KeyboardEventBinding::DOM_VK_F12)
// Leaving "F13" to "F35" key unimplemented; they are some how platform dependent.
// "F13" to "F19" are on MAC's full keyboard but may not exist on usual keyboard.
// "F20" to "F24" are only available on Windows and Linux.
// "F25" to "F35" are Linux only.
// Leaving "Clear" key unimplemented; it's inconsistent between platforms.
KEY(" ", Space, nsIDOMKeyEvent::DOM_VK_SPACE, MODIFIER_NONE)
KEY(",", Comma, nsIDOMKeyEvent::DOM_VK_COMMA, MODIFIER_NONE)
KEY("<", Comma, nsIDOMKeyEvent::DOM_VK_COMMA, MODIFIER_SHIFT)
KEY(".", Period, nsIDOMKeyEvent::DOM_VK_PERIOD, MODIFIER_NONE)
KEY(">", Period, nsIDOMKeyEvent::DOM_VK_PERIOD, MODIFIER_SHIFT)
KEY("/", Slash, nsIDOMKeyEvent::DOM_VK_SLASH, MODIFIER_NONE)
KEY("?", Slash, nsIDOMKeyEvent::DOM_VK_SLASH, MODIFIER_SHIFT)
KEY(";", Semicolon, nsIDOMKeyEvent::DOM_VK_SEMICOLON, MODIFIER_NONE)
KEY(":", Semicolon, nsIDOMKeyEvent::DOM_VK_SEMICOLON, MODIFIER_SHIFT)
KEY("'", Quote, nsIDOMKeyEvent::DOM_VK_QUOTE, MODIFIER_NONE)
KEY("\"", Quote, nsIDOMKeyEvent::DOM_VK_QUOTE, MODIFIER_SHIFT)
KEY("[", BracketLeft, nsIDOMKeyEvent::DOM_VK_OPEN_BRACKET, MODIFIER_NONE)
KEY("{", BracketLeft, nsIDOMKeyEvent::DOM_VK_OPEN_BRACKET, MODIFIER_SHIFT)
KEY("]", BracketRight, nsIDOMKeyEvent::DOM_VK_CLOSE_BRACKET, MODIFIER_NONE)
KEY("}", BracketRight, nsIDOMKeyEvent::DOM_VK_CLOSE_BRACKET, MODIFIER_SHIFT)
KEY("`", Backquote, nsIDOMKeyEvent::DOM_VK_BACK_QUOTE, MODIFIER_NONE)
KEY("~", Backquote, nsIDOMKeyEvent::DOM_VK_BACK_QUOTE, MODIFIER_SHIFT)
KEY("\\", Backslash, nsIDOMKeyEvent::DOM_VK_BACK_SLASH, MODIFIER_NONE)
KEY("|", Backslash, nsIDOMKeyEvent::DOM_VK_BACK_SLASH, MODIFIER_SHIFT)
KEY("-", Minus, nsIDOMKeyEvent::DOM_VK_HYPHEN_MINUS, MODIFIER_NONE)
KEY("_", Minus, nsIDOMKeyEvent::DOM_VK_HYPHEN_MINUS, MODIFIER_SHIFT)
KEY("=", Equal, nsIDOMKeyEvent::DOM_VK_EQUALS, MODIFIER_NONE)
KEY("+", Equal, nsIDOMKeyEvent::DOM_VK_EQUALS, MODIFIER_SHIFT)
KEY("A", KeyA, nsIDOMKeyEvent::DOM_VK_A, MODIFIER_SHIFT)
KEY("B", KeyB, nsIDOMKeyEvent::DOM_VK_B, MODIFIER_SHIFT)
KEY("C", KeyC, nsIDOMKeyEvent::DOM_VK_C, MODIFIER_SHIFT)
KEY("D", KeyD, nsIDOMKeyEvent::DOM_VK_D, MODIFIER_SHIFT)
KEY("E", KeyE, nsIDOMKeyEvent::DOM_VK_E, MODIFIER_SHIFT)
KEY("F", KeyF, nsIDOMKeyEvent::DOM_VK_F, MODIFIER_SHIFT)
KEY("G", KeyG, nsIDOMKeyEvent::DOM_VK_G, MODIFIER_SHIFT)
KEY("H", KeyH, nsIDOMKeyEvent::DOM_VK_H, MODIFIER_SHIFT)
KEY("I", KeyI, nsIDOMKeyEvent::DOM_VK_I, MODIFIER_SHIFT)
KEY("J", KeyJ, nsIDOMKeyEvent::DOM_VK_J, MODIFIER_SHIFT)
KEY("K", KeyK, nsIDOMKeyEvent::DOM_VK_K, MODIFIER_SHIFT)
KEY("L", KeyL, nsIDOMKeyEvent::DOM_VK_L, MODIFIER_SHIFT)
KEY("M", KeyM, nsIDOMKeyEvent::DOM_VK_M, MODIFIER_SHIFT)
KEY("N", KeyN, nsIDOMKeyEvent::DOM_VK_N, MODIFIER_SHIFT)
KEY("O", KeyO, nsIDOMKeyEvent::DOM_VK_O, MODIFIER_SHIFT)
KEY("P", KeyP, nsIDOMKeyEvent::DOM_VK_P, MODIFIER_SHIFT)
KEY("Q", KeyQ, nsIDOMKeyEvent::DOM_VK_Q, MODIFIER_SHIFT)
KEY("R", KeyR, nsIDOMKeyEvent::DOM_VK_R, MODIFIER_SHIFT)
KEY("S", KeyS, nsIDOMKeyEvent::DOM_VK_S, MODIFIER_SHIFT)
KEY("T", KeyT, nsIDOMKeyEvent::DOM_VK_T, MODIFIER_SHIFT)
KEY("U", KeyU, nsIDOMKeyEvent::DOM_VK_U, MODIFIER_SHIFT)
KEY("V", KeyV, nsIDOMKeyEvent::DOM_VK_V, MODIFIER_SHIFT)
KEY("W", KeyW, nsIDOMKeyEvent::DOM_VK_W, MODIFIER_SHIFT)
KEY("X", KeyX, nsIDOMKeyEvent::DOM_VK_X, MODIFIER_SHIFT)
KEY("Y", KeyY, nsIDOMKeyEvent::DOM_VK_Y, MODIFIER_SHIFT)
KEY("Z", KeyZ, nsIDOMKeyEvent::DOM_VK_Z, MODIFIER_SHIFT)
KEY("a", KeyA, nsIDOMKeyEvent::DOM_VK_A, MODIFIER_NONE)
KEY("b", KeyB, nsIDOMKeyEvent::DOM_VK_B, MODIFIER_NONE)
KEY("c", KeyC, nsIDOMKeyEvent::DOM_VK_C, MODIFIER_NONE)
KEY("d", KeyD, nsIDOMKeyEvent::DOM_VK_D, MODIFIER_NONE)
KEY("e", KeyE, nsIDOMKeyEvent::DOM_VK_E, MODIFIER_NONE)
KEY("f", KeyF, nsIDOMKeyEvent::DOM_VK_F, MODIFIER_NONE)
KEY("g", KeyG, nsIDOMKeyEvent::DOM_VK_G, MODIFIER_NONE)
KEY("h", KeyH, nsIDOMKeyEvent::DOM_VK_H, MODIFIER_NONE)
KEY("i", KeyI, nsIDOMKeyEvent::DOM_VK_I, MODIFIER_NONE)
KEY("j", KeyJ, nsIDOMKeyEvent::DOM_VK_J, MODIFIER_NONE)
KEY("k", KeyK, nsIDOMKeyEvent::DOM_VK_K, MODIFIER_NONE)
KEY("l", KeyL, nsIDOMKeyEvent::DOM_VK_L, MODIFIER_NONE)
KEY("m", KeyM, nsIDOMKeyEvent::DOM_VK_M, MODIFIER_NONE)
KEY("n", KeyN, nsIDOMKeyEvent::DOM_VK_N, MODIFIER_NONE)
KEY("o", KeyO, nsIDOMKeyEvent::DOM_VK_O, MODIFIER_NONE)
KEY("p", KeyP, nsIDOMKeyEvent::DOM_VK_P, MODIFIER_NONE)
KEY("q", KeyQ, nsIDOMKeyEvent::DOM_VK_Q, MODIFIER_NONE)
KEY("r", KeyR, nsIDOMKeyEvent::DOM_VK_R, MODIFIER_NONE)
KEY("s", KeyS, nsIDOMKeyEvent::DOM_VK_S, MODIFIER_NONE)
KEY("t", KeyT, nsIDOMKeyEvent::DOM_VK_T, MODIFIER_NONE)
KEY("u", KeyU, nsIDOMKeyEvent::DOM_VK_U, MODIFIER_NONE)
KEY("v", KeyV, nsIDOMKeyEvent::DOM_VK_V, MODIFIER_NONE)
KEY("w", KeyW, nsIDOMKeyEvent::DOM_VK_W, MODIFIER_NONE)
KEY("x", KeyX, nsIDOMKeyEvent::DOM_VK_X, MODIFIER_NONE)
KEY("y", KeyY, nsIDOMKeyEvent::DOM_VK_Y, MODIFIER_NONE)
KEY("z", KeyZ, nsIDOMKeyEvent::DOM_VK_Z, MODIFIER_NONE)
KEY("0", Digit0, nsIDOMKeyEvent::DOM_VK_0, MODIFIER_NONE)
KEY("1", Digit1, nsIDOMKeyEvent::DOM_VK_1, MODIFIER_NONE)
KEY("2", Digit2, nsIDOMKeyEvent::DOM_VK_2, MODIFIER_NONE)
KEY("3", Digit3, nsIDOMKeyEvent::DOM_VK_3, MODIFIER_NONE)
KEY("4", Digit4, nsIDOMKeyEvent::DOM_VK_4, MODIFIER_NONE)
KEY("5", Digit5, nsIDOMKeyEvent::DOM_VK_5, MODIFIER_NONE)
KEY("6", Digit6, nsIDOMKeyEvent::DOM_VK_6, MODIFIER_NONE)
KEY("7", Digit7, nsIDOMKeyEvent::DOM_VK_7, MODIFIER_NONE)
KEY("8", Digit8, nsIDOMKeyEvent::DOM_VK_8, MODIFIER_NONE)
KEY("9", Digit9, nsIDOMKeyEvent::DOM_VK_9, MODIFIER_NONE)
KEY(")", Digit0, nsIDOMKeyEvent::DOM_VK_0, MODIFIER_SHIFT)
KEY("!", Digit1, nsIDOMKeyEvent::DOM_VK_1, MODIFIER_SHIFT)
KEY("@", Digit2, nsIDOMKeyEvent::DOM_VK_2, MODIFIER_SHIFT)
KEY("#", Digit3, nsIDOMKeyEvent::DOM_VK_3, MODIFIER_SHIFT)
KEY("$", Digit4, nsIDOMKeyEvent::DOM_VK_4, MODIFIER_SHIFT)
KEY("%", Digit5, nsIDOMKeyEvent::DOM_VK_5, MODIFIER_SHIFT)
KEY("^", Digit6, nsIDOMKeyEvent::DOM_VK_6, MODIFIER_SHIFT)
KEY("&", Digit7, nsIDOMKeyEvent::DOM_VK_7, MODIFIER_SHIFT)
KEY("*", Digit8, nsIDOMKeyEvent::DOM_VK_8, MODIFIER_SHIFT)
KEY("(", Digit9, nsIDOMKeyEvent::DOM_VK_9, MODIFIER_SHIFT)
KEY(" ", Space, dom::KeyboardEventBinding::DOM_VK_SPACE, MODIFIER_NONE)
KEY(",", Comma, dom::KeyboardEventBinding::DOM_VK_COMMA, MODIFIER_NONE)
KEY("<", Comma, dom::KeyboardEventBinding::DOM_VK_COMMA, MODIFIER_SHIFT)
KEY(".", Period, dom::KeyboardEventBinding::DOM_VK_PERIOD, MODIFIER_NONE)
KEY(">", Period, dom::KeyboardEventBinding::DOM_VK_PERIOD, MODIFIER_SHIFT)
KEY("/", Slash, dom::KeyboardEventBinding::DOM_VK_SLASH, MODIFIER_NONE)
KEY("?", Slash, dom::KeyboardEventBinding::DOM_VK_SLASH, MODIFIER_SHIFT)
KEY(";", Semicolon, dom::KeyboardEventBinding::DOM_VK_SEMICOLON, MODIFIER_NONE)
KEY(":", Semicolon, dom::KeyboardEventBinding::DOM_VK_SEMICOLON, MODIFIER_SHIFT)
KEY("'", Quote, dom::KeyboardEventBinding::DOM_VK_QUOTE, MODIFIER_NONE)
KEY("\"", Quote, dom::KeyboardEventBinding::DOM_VK_QUOTE, MODIFIER_SHIFT)
KEY("[", BracketLeft, dom::KeyboardEventBinding::DOM_VK_OPEN_BRACKET, MODIFIER_NONE)
KEY("{", BracketLeft, dom::KeyboardEventBinding::DOM_VK_OPEN_BRACKET, MODIFIER_SHIFT)
KEY("]", BracketRight, dom::KeyboardEventBinding::DOM_VK_CLOSE_BRACKET, MODIFIER_NONE)
KEY("}", BracketRight, dom::KeyboardEventBinding::DOM_VK_CLOSE_BRACKET, MODIFIER_SHIFT)
KEY("`", Backquote, dom::KeyboardEventBinding::DOM_VK_BACK_QUOTE, MODIFIER_NONE)
KEY("~", Backquote, dom::KeyboardEventBinding::DOM_VK_BACK_QUOTE, MODIFIER_SHIFT)
KEY("\\", Backslash, dom::KeyboardEventBinding::DOM_VK_BACK_SLASH, MODIFIER_NONE)
KEY("|", Backslash, dom::KeyboardEventBinding::DOM_VK_BACK_SLASH, MODIFIER_SHIFT)
KEY("-", Minus, dom::KeyboardEventBinding::DOM_VK_HYPHEN_MINUS, MODIFIER_NONE)
KEY("_", Minus, dom::KeyboardEventBinding::DOM_VK_HYPHEN_MINUS, MODIFIER_SHIFT)
KEY("=", Equal, dom::KeyboardEventBinding::DOM_VK_EQUALS, MODIFIER_NONE)
KEY("+", Equal, dom::KeyboardEventBinding::DOM_VK_EQUALS, MODIFIER_SHIFT)
KEY("A", KeyA, dom::KeyboardEventBinding::DOM_VK_A, MODIFIER_SHIFT)
KEY("B", KeyB, dom::KeyboardEventBinding::DOM_VK_B, MODIFIER_SHIFT)
KEY("C", KeyC, dom::KeyboardEventBinding::DOM_VK_C, MODIFIER_SHIFT)
KEY("D", KeyD, dom::KeyboardEventBinding::DOM_VK_D, MODIFIER_SHIFT)
KEY("E", KeyE, dom::KeyboardEventBinding::DOM_VK_E, MODIFIER_SHIFT)
KEY("F", KeyF, dom::KeyboardEventBinding::DOM_VK_F, MODIFIER_SHIFT)
KEY("G", KeyG, dom::KeyboardEventBinding::DOM_VK_G, MODIFIER_SHIFT)
KEY("H", KeyH, dom::KeyboardEventBinding::DOM_VK_H, MODIFIER_SHIFT)
KEY("I", KeyI, dom::KeyboardEventBinding::DOM_VK_I, MODIFIER_SHIFT)
KEY("J", KeyJ, dom::KeyboardEventBinding::DOM_VK_J, MODIFIER_SHIFT)
KEY("K", KeyK, dom::KeyboardEventBinding::DOM_VK_K, MODIFIER_SHIFT)
KEY("L", KeyL, dom::KeyboardEventBinding::DOM_VK_L, MODIFIER_SHIFT)
KEY("M", KeyM, dom::KeyboardEventBinding::DOM_VK_M, MODIFIER_SHIFT)
KEY("N", KeyN, dom::KeyboardEventBinding::DOM_VK_N, MODIFIER_SHIFT)
KEY("O", KeyO, dom::KeyboardEventBinding::DOM_VK_O, MODIFIER_SHIFT)
KEY("P", KeyP, dom::KeyboardEventBinding::DOM_VK_P, MODIFIER_SHIFT)
KEY("Q", KeyQ, dom::KeyboardEventBinding::DOM_VK_Q, MODIFIER_SHIFT)
KEY("R", KeyR, dom::KeyboardEventBinding::DOM_VK_R, MODIFIER_SHIFT)
KEY("S", KeyS, dom::KeyboardEventBinding::DOM_VK_S, MODIFIER_SHIFT)
KEY("T", KeyT, dom::KeyboardEventBinding::DOM_VK_T, MODIFIER_SHIFT)
KEY("U", KeyU, dom::KeyboardEventBinding::DOM_VK_U, MODIFIER_SHIFT)
KEY("V", KeyV, dom::KeyboardEventBinding::DOM_VK_V, MODIFIER_SHIFT)
KEY("W", KeyW, dom::KeyboardEventBinding::DOM_VK_W, MODIFIER_SHIFT)
KEY("X", KeyX, dom::KeyboardEventBinding::DOM_VK_X, MODIFIER_SHIFT)
KEY("Y", KeyY, dom::KeyboardEventBinding::DOM_VK_Y, MODIFIER_SHIFT)
KEY("Z", KeyZ, dom::KeyboardEventBinding::DOM_VK_Z, MODIFIER_SHIFT)
KEY("a", KeyA, dom::KeyboardEventBinding::DOM_VK_A, MODIFIER_NONE)
KEY("b", KeyB, dom::KeyboardEventBinding::DOM_VK_B, MODIFIER_NONE)
KEY("c", KeyC, dom::KeyboardEventBinding::DOM_VK_C, MODIFIER_NONE)
KEY("d", KeyD, dom::KeyboardEventBinding::DOM_VK_D, MODIFIER_NONE)
KEY("e", KeyE, dom::KeyboardEventBinding::DOM_VK_E, MODIFIER_NONE)
KEY("f", KeyF, dom::KeyboardEventBinding::DOM_VK_F, MODIFIER_NONE)
KEY("g", KeyG, dom::KeyboardEventBinding::DOM_VK_G, MODIFIER_NONE)
KEY("h", KeyH, dom::KeyboardEventBinding::DOM_VK_H, MODIFIER_NONE)
KEY("i", KeyI, dom::KeyboardEventBinding::DOM_VK_I, MODIFIER_NONE)
KEY("j", KeyJ, dom::KeyboardEventBinding::DOM_VK_J, MODIFIER_NONE)
KEY("k", KeyK, dom::KeyboardEventBinding::DOM_VK_K, MODIFIER_NONE)
KEY("l", KeyL, dom::KeyboardEventBinding::DOM_VK_L, MODIFIER_NONE)
KEY("m", KeyM, dom::KeyboardEventBinding::DOM_VK_M, MODIFIER_NONE)
KEY("n", KeyN, dom::KeyboardEventBinding::DOM_VK_N, MODIFIER_NONE)
KEY("o", KeyO, dom::KeyboardEventBinding::DOM_VK_O, MODIFIER_NONE)
KEY("p", KeyP, dom::KeyboardEventBinding::DOM_VK_P, MODIFIER_NONE)
KEY("q", KeyQ, dom::KeyboardEventBinding::DOM_VK_Q, MODIFIER_NONE)
KEY("r", KeyR, dom::KeyboardEventBinding::DOM_VK_R, MODIFIER_NONE)
KEY("s", KeyS, dom::KeyboardEventBinding::DOM_VK_S, MODIFIER_NONE)
KEY("t", KeyT, dom::KeyboardEventBinding::DOM_VK_T, MODIFIER_NONE)
KEY("u", KeyU, dom::KeyboardEventBinding::DOM_VK_U, MODIFIER_NONE)
KEY("v", KeyV, dom::KeyboardEventBinding::DOM_VK_V, MODIFIER_NONE)
KEY("w", KeyW, dom::KeyboardEventBinding::DOM_VK_W, MODIFIER_NONE)
KEY("x", KeyX, dom::KeyboardEventBinding::DOM_VK_X, MODIFIER_NONE)
KEY("y", KeyY, dom::KeyboardEventBinding::DOM_VK_Y, MODIFIER_NONE)
KEY("z", KeyZ, dom::KeyboardEventBinding::DOM_VK_Z, MODIFIER_NONE)
KEY("0", Digit0, dom::KeyboardEventBinding::DOM_VK_0, MODIFIER_NONE)
KEY("1", Digit1, dom::KeyboardEventBinding::DOM_VK_1, MODIFIER_NONE)
KEY("2", Digit2, dom::KeyboardEventBinding::DOM_VK_2, MODIFIER_NONE)
KEY("3", Digit3, dom::KeyboardEventBinding::DOM_VK_3, MODIFIER_NONE)
KEY("4", Digit4, dom::KeyboardEventBinding::DOM_VK_4, MODIFIER_NONE)
KEY("5", Digit5, dom::KeyboardEventBinding::DOM_VK_5, MODIFIER_NONE)
KEY("6", Digit6, dom::KeyboardEventBinding::DOM_VK_6, MODIFIER_NONE)
KEY("7", Digit7, dom::KeyboardEventBinding::DOM_VK_7, MODIFIER_NONE)
KEY("8", Digit8, dom::KeyboardEventBinding::DOM_VK_8, MODIFIER_NONE)
KEY("9", Digit9, dom::KeyboardEventBinding::DOM_VK_9, MODIFIER_NONE)
KEY(")", Digit0, dom::KeyboardEventBinding::DOM_VK_0, MODIFIER_SHIFT)
KEY("!", Digit1, dom::KeyboardEventBinding::DOM_VK_1, MODIFIER_SHIFT)
KEY("@", Digit2, dom::KeyboardEventBinding::DOM_VK_2, MODIFIER_SHIFT)
KEY("#", Digit3, dom::KeyboardEventBinding::DOM_VK_3, MODIFIER_SHIFT)
KEY("$", Digit4, dom::KeyboardEventBinding::DOM_VK_4, MODIFIER_SHIFT)
KEY("%", Digit5, dom::KeyboardEventBinding::DOM_VK_5, MODIFIER_SHIFT)
KEY("^", Digit6, dom::KeyboardEventBinding::DOM_VK_6, MODIFIER_SHIFT)
KEY("&", Digit7, dom::KeyboardEventBinding::DOM_VK_7, MODIFIER_SHIFT)
KEY("*", Digit8, dom::KeyboardEventBinding::DOM_VK_8, MODIFIER_SHIFT)
KEY("(", Digit9, dom::KeyboardEventBinding::DOM_VK_9, MODIFIER_SHIFT)

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

@ -12,6 +12,7 @@
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/PageTransitionEvent.h"
#include "mozilla/Logging.h"
#include "nsIFormAutoComplete.h"
@ -1096,15 +1097,15 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
uint32_t k = keyEvent->KeyCode();
switch (k) {
case nsIDOMKeyEvent::DOM_VK_DELETE:
case KeyboardEventBinding::DOM_VK_DELETE:
#ifndef XP_MACOSX
mController->HandleDelete(&cancel);
break;
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
case KeyboardEventBinding::DOM_VK_BACK_SPACE:
mController->HandleText(&unused);
break;
#else
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
case KeyboardEventBinding::DOM_VK_BACK_SPACE:
{
if (keyEvent->ShiftKey()) {
mController->HandleDelete(&cancel);
@ -1115,8 +1116,8 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
break;
}
#endif
case nsIDOMKeyEvent::DOM_VK_PAGE_UP:
case nsIDOMKeyEvent::DOM_VK_PAGE_DOWN:
case KeyboardEventBinding::DOM_VK_PAGE_UP:
case KeyboardEventBinding::DOM_VK_PAGE_DOWN:
{
if (keyEvent->CtrlKey() ||
keyEvent->AltKey() ||
@ -1125,10 +1126,10 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
}
}
MOZ_FALLTHROUGH;
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
case nsIDOMKeyEvent::DOM_VK_LEFT:
case nsIDOMKeyEvent::DOM_VK_RIGHT:
case KeyboardEventBinding::DOM_VK_UP:
case KeyboardEventBinding::DOM_VK_DOWN:
case KeyboardEventBinding::DOM_VK_LEFT:
case KeyboardEventBinding::DOM_VK_RIGHT:
{
// Get the writing-mode of the relevant input element,
// so that we can remap arrow keys if necessary.
@ -1141,33 +1142,33 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
}
if (wm.IsVertical()) {
switch (k) {
case nsIDOMKeyEvent::DOM_VK_LEFT:
k = wm.IsVerticalLR() ? nsIDOMKeyEvent::DOM_VK_UP
: nsIDOMKeyEvent::DOM_VK_DOWN;
case KeyboardEventBinding::DOM_VK_LEFT:
k = wm.IsVerticalLR() ? KeyboardEventBinding::DOM_VK_UP
: KeyboardEventBinding::DOM_VK_DOWN;
break;
case nsIDOMKeyEvent::DOM_VK_RIGHT:
k = wm.IsVerticalLR() ? nsIDOMKeyEvent::DOM_VK_DOWN
: nsIDOMKeyEvent::DOM_VK_UP;
case KeyboardEventBinding::DOM_VK_RIGHT:
k = wm.IsVerticalLR() ? KeyboardEventBinding::DOM_VK_DOWN
: KeyboardEventBinding::DOM_VK_UP;
break;
case nsIDOMKeyEvent::DOM_VK_UP:
k = nsIDOMKeyEvent::DOM_VK_LEFT;
case KeyboardEventBinding::DOM_VK_UP:
k = KeyboardEventBinding::DOM_VK_LEFT;
break;
case nsIDOMKeyEvent::DOM_VK_DOWN:
k = nsIDOMKeyEvent::DOM_VK_RIGHT;
case KeyboardEventBinding::DOM_VK_DOWN:
k = KeyboardEventBinding::DOM_VK_RIGHT;
break;
}
}
}
mController->HandleKeyNavigation(k, &cancel);
break;
case nsIDOMKeyEvent::DOM_VK_ESCAPE:
case KeyboardEventBinding::DOM_VK_ESCAPE:
mController->HandleEscape(&cancel);
break;
case nsIDOMKeyEvent::DOM_VK_TAB:
case KeyboardEventBinding::DOM_VK_TAB:
mController->HandleTab();
cancel = false;
break;
case nsIDOMKeyEvent::DOM_VK_RETURN:
case KeyboardEventBinding::DOM_VK_RETURN:
mController->HandleEnter(false, aEvent, &cancel);
break;
}
@ -1178,7 +1179,7 @@ nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
// (indicated by cancel=true) so sites don't manually submit forms
// (e.g. via submit.click()) without the autocompleted value being filled.
// Bug 286933 will fix this for other key events.
if (k == nsIDOMKeyEvent::DOM_VK_RETURN) {
if (k == KeyboardEventBinding::DOM_VK_RETURN) {
aEvent->StopPropagation();
}
}
@ -1244,7 +1245,7 @@ nsFormFillController::ShowPopup()
// Show the popup with the complete result set. Can't use HandleText()
// because it doesn't display the popup if the input is blank.
bool cancel = false;
mController->HandleKeyNavigation(nsIDOMKeyEvent::DOM_VK_DOWN, &cancel);
mController->HandleKeyNavigation(KeyboardEventBinding::DOM_VK_DOWN, &cancel);
}
return NS_OK;

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

@ -13,6 +13,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "nsIDOMEventTarget.h"
@ -636,16 +637,16 @@ WidgetInputEvent::AccelModifier()
static Modifier sAccelModifier = MODIFIER_NONE;
if (sAccelModifier == MODIFIER_NONE) {
switch (Preferences::GetInt("ui.key.accelKey", 0)) {
case nsIDOMKeyEvent::DOM_VK_META:
case dom::KeyboardEventBinding::DOM_VK_META:
sAccelModifier = MODIFIER_META;
break;
case nsIDOMKeyEvent::DOM_VK_WIN:
case dom::KeyboardEventBinding::DOM_VK_WIN:
sAccelModifier = MODIFIER_OS;
break;
case nsIDOMKeyEvent::DOM_VK_ALT:
case dom::KeyboardEventBinding::DOM_VK_ALT:
sAccelModifier = MODIFIER_ALT;
break;
case nsIDOMKeyEvent::DOM_VK_CONTROL:
case dom::KeyboardEventBinding::DOM_VK_CONTROL:
sAccelModifier = MODIFIER_CONTROL;
break;
default:
@ -1255,166 +1256,166 @@ WidgetKeyboardEvent::ComputeKeyCodeFromKeyNameIndex(KeyNameIndex aKeyNameIndex)
{
switch (aKeyNameIndex) {
case KEY_NAME_INDEX_Cancel:
return nsIDOMKeyEvent::DOM_VK_CANCEL;
return dom::KeyboardEventBinding::DOM_VK_CANCEL;
case KEY_NAME_INDEX_Help:
return nsIDOMKeyEvent::DOM_VK_HELP;
return dom::KeyboardEventBinding::DOM_VK_HELP;
case KEY_NAME_INDEX_Backspace:
return nsIDOMKeyEvent::DOM_VK_BACK_SPACE;
return dom::KeyboardEventBinding::DOM_VK_BACK_SPACE;
case KEY_NAME_INDEX_Tab:
return nsIDOMKeyEvent::DOM_VK_TAB;
return dom::KeyboardEventBinding::DOM_VK_TAB;
case KEY_NAME_INDEX_Clear:
return nsIDOMKeyEvent::DOM_VK_CLEAR;
return dom::KeyboardEventBinding::DOM_VK_CLEAR;
case KEY_NAME_INDEX_Enter:
return nsIDOMKeyEvent::DOM_VK_RETURN;
return dom::KeyboardEventBinding::DOM_VK_RETURN;
case KEY_NAME_INDEX_Shift:
return nsIDOMKeyEvent::DOM_VK_SHIFT;
return dom::KeyboardEventBinding::DOM_VK_SHIFT;
case KEY_NAME_INDEX_Control:
return nsIDOMKeyEvent::DOM_VK_CONTROL;
return dom::KeyboardEventBinding::DOM_VK_CONTROL;
case KEY_NAME_INDEX_Alt:
return nsIDOMKeyEvent::DOM_VK_ALT;
return dom::KeyboardEventBinding::DOM_VK_ALT;
case KEY_NAME_INDEX_Pause:
return nsIDOMKeyEvent::DOM_VK_PAUSE;
return dom::KeyboardEventBinding::DOM_VK_PAUSE;
case KEY_NAME_INDEX_CapsLock:
return nsIDOMKeyEvent::DOM_VK_CAPS_LOCK;
return dom::KeyboardEventBinding::DOM_VK_CAPS_LOCK;
case KEY_NAME_INDEX_Hiragana:
case KEY_NAME_INDEX_Katakana:
case KEY_NAME_INDEX_HiraganaKatakana:
case KEY_NAME_INDEX_KanaMode:
return nsIDOMKeyEvent::DOM_VK_KANA;
return dom::KeyboardEventBinding::DOM_VK_KANA;
case KEY_NAME_INDEX_HangulMode:
return nsIDOMKeyEvent::DOM_VK_HANGUL;
return dom::KeyboardEventBinding::DOM_VK_HANGUL;
case KEY_NAME_INDEX_Eisu:
return nsIDOMKeyEvent::DOM_VK_EISU;
return dom::KeyboardEventBinding::DOM_VK_EISU;
case KEY_NAME_INDEX_JunjaMode:
return nsIDOMKeyEvent::DOM_VK_JUNJA;
return dom::KeyboardEventBinding::DOM_VK_JUNJA;
case KEY_NAME_INDEX_FinalMode:
return nsIDOMKeyEvent::DOM_VK_FINAL;
return dom::KeyboardEventBinding::DOM_VK_FINAL;
case KEY_NAME_INDEX_HanjaMode:
return nsIDOMKeyEvent::DOM_VK_HANJA;
return dom::KeyboardEventBinding::DOM_VK_HANJA;
case KEY_NAME_INDEX_KanjiMode:
return nsIDOMKeyEvent::DOM_VK_KANJI;
return dom::KeyboardEventBinding::DOM_VK_KANJI;
case KEY_NAME_INDEX_Escape:
return nsIDOMKeyEvent::DOM_VK_ESCAPE;
return dom::KeyboardEventBinding::DOM_VK_ESCAPE;
case KEY_NAME_INDEX_Convert:
return nsIDOMKeyEvent::DOM_VK_CONVERT;
return dom::KeyboardEventBinding::DOM_VK_CONVERT;
case KEY_NAME_INDEX_NonConvert:
return nsIDOMKeyEvent::DOM_VK_NONCONVERT;
return dom::KeyboardEventBinding::DOM_VK_NONCONVERT;
case KEY_NAME_INDEX_Accept:
return nsIDOMKeyEvent::DOM_VK_ACCEPT;
return dom::KeyboardEventBinding::DOM_VK_ACCEPT;
case KEY_NAME_INDEX_ModeChange:
return nsIDOMKeyEvent::DOM_VK_MODECHANGE;
return dom::KeyboardEventBinding::DOM_VK_MODECHANGE;
case KEY_NAME_INDEX_PageUp:
return nsIDOMKeyEvent::DOM_VK_PAGE_UP;
return dom::KeyboardEventBinding::DOM_VK_PAGE_UP;
case KEY_NAME_INDEX_PageDown:
return nsIDOMKeyEvent::DOM_VK_PAGE_DOWN;
return dom::KeyboardEventBinding::DOM_VK_PAGE_DOWN;
case KEY_NAME_INDEX_End:
return nsIDOMKeyEvent::DOM_VK_END;
return dom::KeyboardEventBinding::DOM_VK_END;
case KEY_NAME_INDEX_Home:
return nsIDOMKeyEvent::DOM_VK_HOME;
return dom::KeyboardEventBinding::DOM_VK_HOME;
case KEY_NAME_INDEX_ArrowLeft:
return nsIDOMKeyEvent::DOM_VK_LEFT;
return dom::KeyboardEventBinding::DOM_VK_LEFT;
case KEY_NAME_INDEX_ArrowUp:
return nsIDOMKeyEvent::DOM_VK_UP;
return dom::KeyboardEventBinding::DOM_VK_UP;
case KEY_NAME_INDEX_ArrowRight:
return nsIDOMKeyEvent::DOM_VK_RIGHT;
return dom::KeyboardEventBinding::DOM_VK_RIGHT;
case KEY_NAME_INDEX_ArrowDown:
return nsIDOMKeyEvent::DOM_VK_DOWN;
return dom::KeyboardEventBinding::DOM_VK_DOWN;
case KEY_NAME_INDEX_Select:
return nsIDOMKeyEvent::DOM_VK_SELECT;
return dom::KeyboardEventBinding::DOM_VK_SELECT;
case KEY_NAME_INDEX_Print:
return nsIDOMKeyEvent::DOM_VK_PRINT;
return dom::KeyboardEventBinding::DOM_VK_PRINT;
case KEY_NAME_INDEX_Execute:
return nsIDOMKeyEvent::DOM_VK_EXECUTE;
return dom::KeyboardEventBinding::DOM_VK_EXECUTE;
case KEY_NAME_INDEX_PrintScreen:
return nsIDOMKeyEvent::DOM_VK_PRINTSCREEN;
return dom::KeyboardEventBinding::DOM_VK_PRINTSCREEN;
case KEY_NAME_INDEX_Insert:
return nsIDOMKeyEvent::DOM_VK_INSERT;
return dom::KeyboardEventBinding::DOM_VK_INSERT;
case KEY_NAME_INDEX_Delete:
return nsIDOMKeyEvent::DOM_VK_DELETE;
return dom::KeyboardEventBinding::DOM_VK_DELETE;
case KEY_NAME_INDEX_OS:
// case KEY_NAME_INDEX_Super:
// case KEY_NAME_INDEX_Hyper:
return nsIDOMKeyEvent::DOM_VK_WIN;
return dom::KeyboardEventBinding::DOM_VK_WIN;
case KEY_NAME_INDEX_ContextMenu:
return nsIDOMKeyEvent::DOM_VK_CONTEXT_MENU;
return dom::KeyboardEventBinding::DOM_VK_CONTEXT_MENU;
case KEY_NAME_INDEX_Standby:
return nsIDOMKeyEvent::DOM_VK_SLEEP;
return dom::KeyboardEventBinding::DOM_VK_SLEEP;
case KEY_NAME_INDEX_F1:
return nsIDOMKeyEvent::DOM_VK_F1;
return dom::KeyboardEventBinding::DOM_VK_F1;
case KEY_NAME_INDEX_F2:
return nsIDOMKeyEvent::DOM_VK_F2;
return dom::KeyboardEventBinding::DOM_VK_F2;
case KEY_NAME_INDEX_F3:
return nsIDOMKeyEvent::DOM_VK_F3;
return dom::KeyboardEventBinding::DOM_VK_F3;
case KEY_NAME_INDEX_F4:
return nsIDOMKeyEvent::DOM_VK_F4;
return dom::KeyboardEventBinding::DOM_VK_F4;
case KEY_NAME_INDEX_F5:
return nsIDOMKeyEvent::DOM_VK_F5;
return dom::KeyboardEventBinding::DOM_VK_F5;
case KEY_NAME_INDEX_F6:
return nsIDOMKeyEvent::DOM_VK_F6;
return dom::KeyboardEventBinding::DOM_VK_F6;
case KEY_NAME_INDEX_F7:
return nsIDOMKeyEvent::DOM_VK_F7;
return dom::KeyboardEventBinding::DOM_VK_F7;
case KEY_NAME_INDEX_F8:
return nsIDOMKeyEvent::DOM_VK_F8;
return dom::KeyboardEventBinding::DOM_VK_F8;
case KEY_NAME_INDEX_F9:
return nsIDOMKeyEvent::DOM_VK_F9;
return dom::KeyboardEventBinding::DOM_VK_F9;
case KEY_NAME_INDEX_F10:
return nsIDOMKeyEvent::DOM_VK_F10;
return dom::KeyboardEventBinding::DOM_VK_F10;
case KEY_NAME_INDEX_F11:
return nsIDOMKeyEvent::DOM_VK_F11;
return dom::KeyboardEventBinding::DOM_VK_F11;
case KEY_NAME_INDEX_F12:
return nsIDOMKeyEvent::DOM_VK_F12;
return dom::KeyboardEventBinding::DOM_VK_F12;
case KEY_NAME_INDEX_F13:
return nsIDOMKeyEvent::DOM_VK_F13;
return dom::KeyboardEventBinding::DOM_VK_F13;
case KEY_NAME_INDEX_F14:
return nsIDOMKeyEvent::DOM_VK_F14;
return dom::KeyboardEventBinding::DOM_VK_F14;
case KEY_NAME_INDEX_F15:
return nsIDOMKeyEvent::DOM_VK_F15;
return dom::KeyboardEventBinding::DOM_VK_F15;
case KEY_NAME_INDEX_F16:
return nsIDOMKeyEvent::DOM_VK_F16;
return dom::KeyboardEventBinding::DOM_VK_F16;
case KEY_NAME_INDEX_F17:
return nsIDOMKeyEvent::DOM_VK_F17;
return dom::KeyboardEventBinding::DOM_VK_F17;
case KEY_NAME_INDEX_F18:
return nsIDOMKeyEvent::DOM_VK_F18;
return dom::KeyboardEventBinding::DOM_VK_F18;
case KEY_NAME_INDEX_F19:
return nsIDOMKeyEvent::DOM_VK_F19;
return dom::KeyboardEventBinding::DOM_VK_F19;
case KEY_NAME_INDEX_F20:
return nsIDOMKeyEvent::DOM_VK_F20;
return dom::KeyboardEventBinding::DOM_VK_F20;
case KEY_NAME_INDEX_F21:
return nsIDOMKeyEvent::DOM_VK_F21;
return dom::KeyboardEventBinding::DOM_VK_F21;
case KEY_NAME_INDEX_F22:
return nsIDOMKeyEvent::DOM_VK_F22;
return dom::KeyboardEventBinding::DOM_VK_F22;
case KEY_NAME_INDEX_F23:
return nsIDOMKeyEvent::DOM_VK_F23;
return dom::KeyboardEventBinding::DOM_VK_F23;
case KEY_NAME_INDEX_F24:
return nsIDOMKeyEvent::DOM_VK_F24;
return dom::KeyboardEventBinding::DOM_VK_F24;
case KEY_NAME_INDEX_NumLock:
return nsIDOMKeyEvent::DOM_VK_NUM_LOCK;
return dom::KeyboardEventBinding::DOM_VK_NUM_LOCK;
case KEY_NAME_INDEX_ScrollLock:
return nsIDOMKeyEvent::DOM_VK_SCROLL_LOCK;
return dom::KeyboardEventBinding::DOM_VK_SCROLL_LOCK;
case KEY_NAME_INDEX_AudioVolumeMute:
return nsIDOMKeyEvent::DOM_VK_VOLUME_MUTE;
return dom::KeyboardEventBinding::DOM_VK_VOLUME_MUTE;
case KEY_NAME_INDEX_AudioVolumeDown:
return nsIDOMKeyEvent::DOM_VK_VOLUME_DOWN;
return dom::KeyboardEventBinding::DOM_VK_VOLUME_DOWN;
case KEY_NAME_INDEX_AudioVolumeUp:
return nsIDOMKeyEvent::DOM_VK_VOLUME_UP;
return dom::KeyboardEventBinding::DOM_VK_VOLUME_UP;
case KEY_NAME_INDEX_Meta:
return nsIDOMKeyEvent::DOM_VK_META;
return dom::KeyboardEventBinding::DOM_VK_META;
case KEY_NAME_INDEX_AltGraph:
return nsIDOMKeyEvent::DOM_VK_ALTGR;
return dom::KeyboardEventBinding::DOM_VK_ALTGR;
case KEY_NAME_INDEX_Attn:
return nsIDOMKeyEvent::DOM_VK_ATTN;
return dom::KeyboardEventBinding::DOM_VK_ATTN;
case KEY_NAME_INDEX_CrSel:
return nsIDOMKeyEvent::DOM_VK_CRSEL;
return dom::KeyboardEventBinding::DOM_VK_CRSEL;
case KEY_NAME_INDEX_ExSel:
return nsIDOMKeyEvent::DOM_VK_EXSEL;
return dom::KeyboardEventBinding::DOM_VK_EXSEL;
case KEY_NAME_INDEX_EraseEof:
return nsIDOMKeyEvent::DOM_VK_EREOF;
return dom::KeyboardEventBinding::DOM_VK_EREOF;
case KEY_NAME_INDEX_Play:
return nsIDOMKeyEvent::DOM_VK_PLAY;
return dom::KeyboardEventBinding::DOM_VK_PLAY;
case KEY_NAME_INDEX_ZoomToggle:
case KEY_NAME_INDEX_ZoomIn:
case KEY_NAME_INDEX_ZoomOut:
return nsIDOMKeyEvent::DOM_VK_ZOOM;
return dom::KeyboardEventBinding::DOM_VK_ZOOM;
default:
return 0;
}

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

@ -876,7 +876,7 @@ static const KeyConversionData gKeyConversions[] = {
#define KEYCODE_ENTRY(aStr, aCode) \
{#aStr, sizeof(#aStr) - 1, NS_##aStr, aCode}
// Some keycodes may have different name in nsIDOMKeyEvent from its key name.
// Some keycodes may have different name in KeyboardEvent from its key name.
#define KEYCODE_ENTRY2(aStr, aNSName, aCode) \
{#aStr, sizeof(#aStr) - 1, NS_##aNSName, aCode}