Bug 1419091: Define keybindings in a static C++ table. r=masayuki
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 08 Oct 2018 11:08:52 -0700
changeset 442813 0e7a8e6537619430d62cdda189acbd440a682788
parent 442812 d33100811e81d7a87c080475622e3cb54f85617b
child 442814 ac929295fea8ff8b43b939b43e638e530c557ec1
push id109248
push userdtownsend@mozilla.com
push dateWed, 24 Oct 2018 21:25:49 +0000
treeherdermozilla-inbound@40036a4302c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1419091
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1419091: Define keybindings in a static C++ table. r=masayuki Copies the keybindings from platformHTMLBindings.xml into an array of C structs that can be easily used to instantiate an nsXBLPrototypeHandler (done in later patches). These were mechanically generated. Differential Revision: https://phabricator.services.mozilla.com/D8930
dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForTextAreaCommon.h
dom/xbl/builtin/ShortcutKeys.h
dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/android/moz.build
dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/emacs/moz.build
dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/mac/moz.build
dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/unix/moz.build
dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/win/moz.build
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h
@@ -0,0 +1,16 @@
+/* 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/. */
+
+    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
+    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
+    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
+    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h
@@ -0,0 +1,20 @@
+/* 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/. */
+
+    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
+    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
+    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"v",    u"accel,shift",     u"cmd_pasteNoFormatting" },
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h
@@ -0,0 +1,17 @@
+/* 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/. */
+
+    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/ShortcutKeyDefinitionsForTextAreaCommon.h
@@ -0,0 +1,17 @@
+/* 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/. */
+
+    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/ShortcutKeys.h
@@ -0,0 +1,30 @@
+/* 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/. */
+
+#ifndef mozilla_dom_ShortcutKeys_h
+#define mozilla_dom_ShortcutKeys_h
+
+namespace mozilla {
+
+typedef struct
+{
+   const char16_t* event;
+   const char16_t* keycode;
+   const char16_t* key;
+   const char16_t* modifiers;
+   const char16_t* command;
+} ShortcutKeyData;
+
+class ShortcutKeys
+{
+protected:
+  static ShortcutKeyData sBrowserHandlers[];
+  static ShortcutKeyData sEditorHandlers[];
+  static ShortcutKeyData sInputHandlers[];
+  static ShortcutKeyData sTextAreaHandlers[];
+};
+
+} // namespace mozilla
+
+#endif // #ifndef mozilla_dom_ShortcutKeys_h
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp
@@ -0,0 +1,152 @@
+/* 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/. */
+
+#include "../ShortcutKeys.h"
+
+namespace mozilla {
+
+ShortcutKeyData ShortcutKeys::sInputHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForInputCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
+    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
+
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectCharPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectCharNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectLinePrevious" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectLineNext" },
+    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForEditorCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
+    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+} // namespace mozilla
--- a/dom/xbl/builtin/android/moz.build
+++ b/dom/xbl/builtin/android/moz.build
@@ -1,7 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
+JAR_MANIFESTS += ['jar.mn']
+
+SOURCES += ['ShortcutKeyDefinitions.cpp']
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp
@@ -0,0 +1,164 @@
+/* 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/. */
+
+#include "../ShortcutKeys.h"
+
+namespace mozilla {
+
+ShortcutKeyData ShortcutKeys::sInputHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForInputCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
+    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
+    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
+    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
+    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
+    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
+    { u"keypress", nullptr,         u"w",    u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control,shift",   u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"control,shift",   u"cmd_selectEndLine" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
+    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
+    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
+    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
+    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
+    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
+    { u"keypress", nullptr,         u"w",    u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"n",    u"control",         u"cmd_lineNext" },
+    { u"keypress", nullptr,         u"p",    u"control",         u"cmd_linePrevious" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
+
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectCharPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectCharNext" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectLinePrevious" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectLineNext" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForEditorCommon.h"
+
+    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
+    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
+    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
+    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
+    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
+    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
+    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
+    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
+    { u"keypress", nullptr,         u"p",    u"control",         u"cmd_linePrevious" },
+    { u"keypress", nullptr,         u"n",    u"control",         u"cmd_lineNext" },
+    { u"keypress", nullptr,         u"x",    u"control",         u"cmd_cut" },
+    { u"keypress", nullptr,         u"c",    u"control",         u"cmd_copy" },
+    { u"keypress", nullptr,         u"v",    u"control",         u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"control",         u"cmd_undo" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+} // namespace mozilla
--- a/dom/xbl/builtin/emacs/moz.build
+++ b/dom/xbl/builtin/emacs/moz.build
@@ -1,7 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
+JAR_MANIFESTS += ['jar.mn']
+
+SOURCES += ['ShortcutKeyDefinitions.cpp']
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp
@@ -0,0 +1,73 @@
+/* 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/. */
+
+#include "../ShortcutKeys.h"
+
+namespace mozilla {
+
+ShortcutKeyData ShortcutKeys::sInputHandlers[] =
+{
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
+{
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
+
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_scrollPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_scrollPageDown" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_scrollTop" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_scrollBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"alt,shift",       u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"alt,shift",       u"cmd_selectRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_UP",        nullptr, u"alt,shift",       u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"alt,shift",       u"cmd_selectDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", u"VK_UP",        nullptr, u"accel",           u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"accel",           u"cmd_moveDown2" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
+{
+    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
+    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
+    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
+    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
+    { u"keypress", nullptr,         u"v",    u"accel,shift",     u"cmd_pasteNoFormatting" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", nullptr,         u"v",    u"accel,alt,shift", u"cmd_pasteNoFormatting" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+} // namespace mozilla
--- a/dom/xbl/builtin/mac/moz.build
+++ b/dom/xbl/builtin/mac/moz.build
@@ -1,7 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
+JAR_MANIFESTS += ['jar.mn']
+
+SOURCES += ['ShortcutKeyDefinitions.cpp']
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp
@@ -0,0 +1,81 @@
+/* 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/. */
+
+#include "../ShortcutKeys.h"
+
+namespace mozilla {
+
+ShortcutKeyData ShortcutKeys::sInputHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForInputCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
+
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectRight2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"control,shift",   u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control,shift",   u"cmd_selectDown2" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForEditorCommon.h"
+
+    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
+    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+} // namespace mozilla
--- a/dom/xbl/builtin/unix/moz.build
+++ b/dom/xbl/builtin/unix/moz.build
@@ -1,7 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
+JAR_MANIFESTS += ['jar.mn']
+
+SOURCES += ['ShortcutKeyDefinitions.cpp']
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp
@@ -0,0 +1,152 @@
+/* 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/. */
+
+#include "../ShortcutKeys.h"
+
+namespace mozilla {
+
+ShortcutKeyData ShortcutKeys::sInputHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForInputCommon.h"
+
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectRight2" },
+    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,control",   u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,control",   u"cmd_selectDown2" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
+
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectRight2" },
+    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,control",   u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,control",   u"cmd_selectDown2" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
+
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
+    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"control,shift",   u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"control,shift",   u"cmd_selectDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
+{
+#include "../ShortcutKeyDefinitionsForEditorCommon.h"
+
+    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
+    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
+    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
+    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"accel",           u"cmd_moveLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"accel",           u"cmd_moveRight2" },
+    { u"keypress", u"VK_LEFT",      nullptr, u"shift,accel",     u"cmd_selectLeft2" },
+    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,accel",     u"cmd_selectRight2" },
+    { u"keypress", u"VK_UP",        nullptr, u"accel",           u"cmd_moveUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"accel",           u"cmd_moveDown2" },
+    { u"keypress", u"VK_UP",        nullptr, u"shift,accel",     u"cmd_selectUp2" },
+    { u"keypress", u"VK_DOWN",      nullptr, u"shift,accel",     u"cmd_selectDown2" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
+    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
+    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
+    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
+    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
+    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
+    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
+    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
+    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
+    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
+    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
+    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
+
+    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
+};
+
+} // namespace mozilla
--- a/dom/xbl/builtin/win/moz.build
+++ b/dom/xbl/builtin/win/moz.build
@@ -1,7 +1,11 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
+JAR_MANIFESTS += ['jar.mn']
+
+SOURCES += ['ShortcutKeyDefinitions.cpp']
+
+FINAL_LIBRARY = 'xul'