Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: Source/core/events/KeyboardCode.h

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/events/KeyboardCode.h
diff --git a/Source/core/events/KeyboardCode.h b/Source/core/events/KeyboardCode.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef75b91386c8e59efa96af50718f4770b5781de1
--- /dev/null
+++ b/Source/core/events/KeyboardCode.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2014 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef KeyboardCode_h
+#define KeyboardCode_h
+
+#include <platform/WindowsKeyboardCodes.h>
+
+struct UsbKeyToCodeMapEntry {
+ int usbCode;
+ int windowsKeyCode;
+ const char* code;
+};
+
+const UsbKeyToCodeMapEntry keyCodeMap[] = {
+ // 2.1.1.1 AlphaNumeric Section
+ {0x070035, VK_OEM_3, "Backquote"}, // `~
+ {0x070031, VK_OEM_5, "Backslash"}, // \| (US keyboard only}
+ {0x07002a, VK_BACK, "Backspace"},
+ {0x07002f, VK_OEM_4, "BracketLeft"}, // [{
+ {0x070030, VK_OEM_6, "BracketRight"}, // ]}
+ {0x070036, VK_OEM_COMMA, "Comma"}, // ,<
+ {0x070027, VK_0, "Digit0"}, // 0)
+ {0x07001e, VK_1, "Digit1"}, // 1!
+ {0x07001f, VK_2, "Digit2"}, // 2@
+ {0x070020, VK_3, "Digit3"}, // 3#
+ {0x070021, VK_4, "Digit4"}, // 4$
+ {0x070022, VK_5, "Digit5"}, // 5%
+ {0x070023, VK_6, "Digit6"}, // 6^
+ {0x070024, VK_7, "Digit7"}, // 7&
+ {0x070025, VK_8, "Digit8"}, // 8*
+ {0x070026, VK_9, "Digit9"}, // 9(
+ {0x07002e, VK_OEM_PLUS, "Equal"}, // =+
+ {0x070064, VK_NONAME, "IntlBackslash"}, // Non-US \|
+ {0x070032, VK_NONAME, "IntlHash"}, // #~ (Non-US}
+ {0x070087, VK_NONAME, "IntlRo"}, // Brazilian /? and Japanese _ 'ro'.
+ {0x070089, VK_NONAME, "IntlYen"}, // Japanese
+ {0x070004, VK_A, "KeyA"}, // aA
+ {0x070005, VK_B, "KeyB"}, // bB
+ {0x070006, VK_C, "KeyC"}, // cC
+ {0x070007, VK_D, "KeyD"}, // dD
+ {0x070008, VK_E, "KeyE"}, // eEo
+ {0x070009, VK_F, "KeyF"}, // fF
+ {0x07000a, VK_G, "KeyG"}, // gG
+ {0x07000b, VK_H, "KeyH"}, // hH
+ {0x07000c, VK_I, "KeyI"}, // iI
+ {0x07000d, VK_J, "KeyJ"}, // jJ
+ {0x07000e, VK_K, "KeyK"}, // kK
+ {0x07000f, VK_L, "KeyL"}, // lL
+ {0x070010, VK_M, "KeyM"}, // mM
+ {0x070011, VK_N, "KeyN"}, // nN
+ {0x070012, VK_O, "KeyO"}, // oO
+ {0x070013, VK_P, "KeyP"}, // pP
+ {0x070014, VK_Q, "KeyQ"}, // qQ
+ {0x070015, VK_R, "KeyR"}, // rR
+ {0x070016, VK_S, "KeyS"}, // sS
+ {0x070017, VK_T, "KeyT"}, // tT
+ {0x070018, VK_U, "KeyU"}, // uU
+ {0x070019, VK_V, "KeyV"}, // vV
+ {0x07001a, VK_W, "KeyW"}, // wW
+ {0x07001b, VK_X, "KeyX"}, // xX
+ {0x07001c, VK_Y, "KeyY"}, // yY
+ {0x07001d, VK_Z, "KeyZ"}, // zZ
+ {0x07002d, VK_OEM_MINUS, "Minus"}, // -_
+ {0x070037, VK_OEM_PERIOD, "Period"}, // .>
+ {0x070034, VK_OEM_7, "Quote"}, // '"
+ {0x070033, VK_OEM_1, "Semicolon"}, // ;
+ {0x070038, VK_OEM_2, "Slash"}, // /?
+
+ // 2.1.1.2 Functional Keys
+ {0x0700e2, VK_LMENU, "AltLeft"}, // Alt or Option
+ {0x0700e6, VK_RMENU, "AltRight"}, // Alt or Option or AltGr
+ {0x070039, VK_CAPITAL, "CapsLock"},
+ {0x070065, VK_APPS, "ContextMenu"}, // Application context menu
+ {0x0700e0, VK_LCONTROL, "ControlLeft"},
+ {0x0700e4, VK_RCONTROL, "ControlRight"},
+ {0x070028, VK_RETURN, "Enter"},
+ {0x0700e3, VK_LWIN, "OSLeft"},
+ {0x0700e7, VK_RWIN, "OSRight"},
+ {0x0700e1, VK_LSHIFT, "ShiftLeft"},
+ {0x0700e5, VK_RSHIFT, "ShiftRight"},
+ {0x07002c, VK_SPACE, "Space"}, // Spacebar
+ {0x07002b, VK_TAB, "Tab"},
+
+ // Japanese/Korean Keyboard keys
+ {0x07008a, VK_CONVERT, "Convert"}, // Japanese: 変換 (henkan)
+ {0x070088, VK_KANA, "KanaMode"}, // Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji)
+ {0x070090, VK_NONAME, "Lang1"}, // Korean: 한/영 (han/yeong), Japanese (Mac keyboard): かな (kana)
+ {0x070091, VK_HANJA, "Lang2"}, // Korean: 한자 (hanja), Japanese (Mac keyboard): 英数 (eisu)
+ {0x070092, VK_NONAME, "Lang3"}, // Japanese (word-processing keyboard): Katakana
+ {0x070093, VK_NONAME, "Lang4"}, // Japanese (word-processing keyboard): Hiragana
+ {0x070094, VK_NONAME, "Lang5"}, // Japanese (word-processing keyboard): Zenkaku/Hankaku
+ {0x07008b, VK_NONAME, "NonConvert"}, // Japanese: 無変換 (muhenkan)
+
+ // 2.1.2 Control Pad
+ {0x07004c, VK_DELETE, "Delete"},
+ {0x07004d, VK_END, "End"},
+ {0x070075, VK_HELP, "Help"},
+ {0x07004a, VK_HOME, "Home"},
+ {0x070049, VK_INSERT, "Insert"}, // Labeled "Help/Insert" on Mac.
+ {0x07004e, VK_NEXT, "PageDown"},
+ {0x07004b, VK_PRIOR, "PageUp"},
+
+ // 2.1.3 Arrow Pad
+ {0x070051, VK_DOWN, "ArrowDown"},
+ {0x070050, VK_LEFT, "ArrowLeft"},
+ {0x07004f, VK_RIGHT, "ArrowRight"},
+ {0x070052, VK_UP, "ArrowUp"},
+
+ // 2.1.4 Numpad
+ {0x070053, VK_NUMLOCK, "NumLock"}, // On the Mac, the 'NumLock' code should be used for the numpad 'Clear' key.
+ {0x070062, VK_NUMPAD0, "Numpad0"}, // 0 and Insert
+ {0x070059, VK_NUMPAD1, "Numpad1"}, // 1 and End
+ {0x07005a, VK_NUMPAD2, "Numpad2"}, // 2 and ArrowDown
+ {0x07005b, VK_NUMPAD3, "Numpad3"}, // 3 and PageDown
+ {0x07005c, VK_NUMPAD4, "Numpad4"}, // 4 and ArrowLeft
+ {0x07005d, VK_NUMPAD5, "Numpad5"}, // 5
+ {0x07005e, VK_NUMPAD6, "Numpad6"}, // 6 and ArrowRight
+ {0x07005f, VK_NUMPAD7, "Numpad7"}, // 7 and Home
+ {0x070060, VK_NUMPAD8, "Numpad8"}, // 8 and ArrowUp
+ {0x070061, VK_NUMPAD9, "Numpad9"}, // 9 and PageUp
+ {0x070057, VK_ADD, "NumpadAdd"}, // +
+ {0x0700bb, VK_NONAME, "NumpadBackspace"}, // Found on the Microsoft Natural Keyboard.
+ {0x0700d8, VK_NONAME, "NumpadClear"}, // For use with numpads that have a 'Clear' key that is separate from the 'NumLock' key. On the Mac, the numpad 'Clear' key should always be encoded as 'NumLock'.
+ {0x0700d9, VK_NONAME, "NumpadClearEntry"},
+ {0x070085, VK_SEPARATOR, "NumpadComma"}, // (thousands separator). For locales where the thousands separator is a '.' (e.g., Brazil), this key may generate a '.'.
+ {0x070063, VK_SEPARATOR, "NumpadDecimal"}, // (decimal separator) and Delete. For locales where the decimal separator is ',' (e.g., Brazil), this key may generate a ','.
+ {0x070054, VK_DIVIDE, "NumpadDivide"}, // /
+ {0x070058, VK_NONAME, "NumpadEnter"},
+ {0x070067, VK_NONAME, "NumpadEqual"}, // =
+ {0x0700d3, VK_NONAME, "NumpadMemoryAdd"},
+ {0x0700d2, VK_NONAME, "NumpadMemoryClear"},
+ {0x0700d1, VK_NONAME, "NumpadMemoryRecall"},
+ {0x0700d0, VK_NONAME, "NumpadMemoryStore"},
+ {0x0700d4, VK_NONAME, "NumpadMemorySubtract"},
+ {0x070055, VK_MULTIPLY, "NumpadMultiply"}, // *
+ {0x0700b6, VK_NONAME, "NumpadParenLeft"}, // ( Found on the Microsoft Natural Keyboard.
+ {0x0700b7, VK_NONAME, "NumpadParenRight"}, // ) Found on the Microsoft Natural Keyboard.
+ {0x070056, VK_SUBTRACT, "NumpadSubtract"}, // -
+
+ // 2.1.5 Function Section
+ {0x070029, VK_ESCAPE, "Escape"},
+ {0x07003a, VK_F1, "F1"},
+ {0x07003b, VK_F2, "F2"},
+ {0x07003c, VK_F3, "F3"},
+ {0x07003d, VK_F4, "F4"},
+ {0x07003e, VK_F5, "F5"},
+ {0x07003f, VK_F6, "F6"},
+ {0x070040, VK_F7, "F7"},
+ {0x070041, VK_F8, "F8"},
+ {0x070042, VK_F9, "F9"},
+ {0x070043, VK_F10, "F10"},
+ {0x070044, VK_F11, "F11"},
+ {0x070045, VK_F12, "F12"},
+ // Fn
+ // FLock
+ {0x070046, VK_SNAPSHOT, "PrintScreen"}, // PrintScreen is effectively F13 on Mac OS X.
+ {0x070047, VK_SCROLL, "ScrollLock"},
+ {0x070048, VK_PAUSE, "Pause"},
+};
+
+#endif /* KeyboardCode_h */

Powered by Google App Engine
This is Rietveld 408576698