Bug 1436508 part 11. Remove the use of the nsIDOMKeyEvent::DOM_VK* constants in C++. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 09 Feb 2018 11:17:09 -0500
changeset 403183 5ae4bf25badf
parent 403182 b01bd36c3899
child 403184 f91374248200
push id33416
push userarchaeopteryx@coole-files.de
push date2018-02-09 22:32 +0000
treeherdermozilla-central@c2cddb0cbb20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1436508
milestone60.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 1436508 part 11. Remove the use of the nsIDOMKeyEvent::DOM_VK* constants in C++. r=masayuki MozReview-Commit-ID: Honw0NrVMuV
accessible/generic/Accessible.cpp
accessible/xul/XULMenuAccessible.cpp
accessible/xul/XULSelectControlAccessible.cpp
dom/base/nsContentUtils.cpp
dom/events/VirtualKeyCodeList.h
dom/interfaces/events/nsIDOMKeyEvent.idl
dom/xbl/nsXBLPrototypeHandler.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
layout/xul/MenuBoxObject.cpp
layout/xul/nsMenuBarListener.cpp
layout/xul/nsMenuBarListener.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULPopupManager.h
toolkit/components/autocomplete/nsAutoCompleteController.cpp
toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
toolkit/components/satchel/nsFormFillController.cpp
widget/WidgetEventImpl.cpp
widget/cocoa/nsCocoaUtils.mm
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -26,17 +26,16 @@
 #include "States.h"
 #include "StyleInfo.h"
 #include "TableAccessible.h"
 #include "TableCellAccessible.h"
 #include "TreeWalker.h"
 #include "XULDocument.h"
 
 #include "nsIDOMElement.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIDOMXULButtonElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULLabelElement.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsINodeList.h"
 #include "nsPIDOMWindow.h"
 
@@ -80,16 +79,17 @@
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Unused.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/CanvasRenderingContext2D.h"
 #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;
 using namespace mozilla::a11y;
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible: nsISupports and cycle collection
@@ -257,23 +257,23 @@ Accessible::AccessKey() const
 
   if (!key)
     return KeyBinding();
 
   // Get modifier mask. Use ui.key.generalAccessKey (unless it is -1).
   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();
   }
 
   // Determine the access modifier used in this context.
   nsIDocument* document = mContent->GetUncomposedDoc();
   if (!document)
--- a/accessible/xul/XULMenuAccessible.cpp
+++ b/accessible/xul/XULMenuAccessible.cpp
@@ -14,26 +14,26 @@
 #include "XULFormControlAccessible.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIMutableArray.h"
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIServiceManager.h"
 #include "nsIPresShell.h"
 #include "nsIContent.h"
 #include "nsMenuBarFrame.h"
 #include "nsMenuPopupFrame.h"
 
 #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;
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULMenuitemAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -170,26 +170,26 @@ XULMenuitemAccessible::AccessKey() const
       // If top level menu item, add Alt+ or whatever modifier text to string
       // No need to cache pref service, this happens rarely
       if (gMenuAccesskeyModifier == -1) {
         // Need to initialize cached global accesskey pref
         gMenuAccesskeyModifier = Preferences::GetInt("ui.key.menuAccessKey", 0);
       }
 
       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;
       }
     }
   }
 
   return KeyBinding(accesskey[0], modifierKey);
 }
--- a/accessible/xul/XULSelectControlAccessible.cpp
+++ b/accessible/xul/XULSelectControlAccessible.cpp
@@ -7,23 +7,23 @@
 #include "XULSelectControlAccessible.h"
 
 #include "nsAccessibilityService.h"
 #include "DocAccessible.h"
 
 #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;
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -47,16 +47,17 @@
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/FileSystemSecurity.h"
 #include "mozilla/dom/FileBlobImpl.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #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"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/XULCommandEvent.h"
@@ -8621,38 +8622,38 @@ nsContentUtils::SendKeyEvent(nsIWidget* 
       event.mLocation = eKeyLocationNumpad;
       break;
     default:
       if (locationFlag != 0) {
         return NS_ERROR_INVALID_ARG;
       }
       // 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:
           event.mLocation = eKeyLocationStandard;
           break;
       }
       break;
   }
--- a/dom/events/VirtualKeyCodeList.h
+++ b/dom/events/VirtualKeyCodeList.h
@@ -1,35 +1,35 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // 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.
  *
  * If NS_DISALLOW_SAME_KEYCODE is defined, same keyCode won't listed up.
  * This is useful when you create switch-case statement.
  */
 
 #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)
 DEFINE_VK_INTERNAL2(_BACK, _BACK_SPACE)
 DEFINE_VK_INTERNAL(_TAB)
 DEFINE_VK_INTERNAL(_CLEAR)
 DEFINE_VK_INTERNAL(_RETURN)
 DEFINE_VK_INTERNAL(_SHIFT)
--- a/dom/interfaces/events/nsIDOMKeyEvent.idl
+++ b/dom/interfaces/events/nsIDOMKeyEvent.idl
@@ -3,225 +3,9 @@
  * 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 "nsIDOMUIEvent.idl"
 
 [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;
 };
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -45,16 +45,17 @@
 #include "mozilla/BasicEvents.h"
 #include "mozilla/JSEventHandler.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
 #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"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 
@@ -235,17 +236,17 @@ nsXBLPrototypeHandler::InitAccessKeys()
     return;
   }
 
   // Compiled-in defaults, in case we can't get the pref --
   // mac doesn't have menu shortcuts, other platforms use alt.
 #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:
   kMenuAccessKey =
     Preferences::GetInt("ui.key.menuAccessKey", kMenuAccessKey);
 }
 
 nsresult
@@ -524,17 +525,17 @@ nsXBLPrototypeHandler::DispatchXBLComman
     controller = GetController(aTarget); // We're attached to the receiver possibly.
   }
 
   // We are the default action for this command.
   // Stop any other default action from executing.
   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.
 
     nsCOMPtr<nsPIDOMWindowOuter> windowToCheck;
     if (windowRoot)
       windowToCheck = windowRoot->GetWindow();
     else
@@ -789,45 +790,45 @@ int32_t nsXBLPrototypeHandler::GetMatchi
 
   return 0;
 }
 
 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;
   }
   return cControl | cControlMask;  // for warning avoidance
 }
 
 // static
 int32_t
 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;
   }
 }
 
 void
 nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -35,16 +35,17 @@
 #include "mozInlineSpellChecker.h"
 
 #include "mozilla/EditAction.h"
 #include "mozilla/EditorSpellCheck.h"
 #include "mozilla/EditorUtils.h"
 #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"
 #include "mozISpellI18NUtil.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMDocument.h"
@@ -1869,26 +1870,28 @@ mozInlineSpellChecker::OnKeyPress(nsIDOM
     aKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
   NS_ENSURE_TRUE(keyEvent, NS_OK);
 
   uint32_t keyCode = keyEvent->KeyCode();
 
   // 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;
   }
 
   return NS_OK;
 }
 
 // Used as the nsIEditorSpellCheck::UpdateCurrentDictionary callback.
--- a/layout/xul/MenuBoxObject.cpp
+++ b/layout/xul/MenuBoxObject.cpp
@@ -3,16 +3,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/. */
 
 #include "mozilla/dom/MenuBoxObject.h"
 #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"
 #include "nsMenuBarListener.h"
 #include "nsMenuFrame.h"
 #include "nsMenuPopupFrame.h"
 
 namespace mozilla {
@@ -99,20 +100,20 @@ bool MenuBoxObject::HandleKeyPress(Keybo
 
   nsMenuPopupFrame* popupFrame = menu->GetPopup();
   if (!popupFrame) {
     return false;
   }
 
   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);
       return pm->HandleKeyboardNavigationInPopup(popupFrame, theDirection);
     }
     default:
       return pm->HandleShortcutNavigation(&keyEvent, popupFrame);
   }
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -18,16 +18,17 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 
 #include "nsContentUtils.h"
 #include "mozilla/BasicEvents.h"
 #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;
 
 /*
  * nsMenuBarListener implementation
  */
 
@@ -143,32 +144,42 @@ void nsMenuBarListener::InitAccessKey()
     return;
 
   // Compiled-in defaults, in case we can't get LookAndFeel --
   // mac doesn't have menu shortcuts, other platforms use alt.
 #ifdef XP_MACOSX
   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
 nsMenuBarListener::ToggleMenuActiveState()
 {
   nsMenuFrame* closemenu = mMenuBarFrame->ToggleMenuActiveState();
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm && closemenu) {
--- a/layout/xul/nsMenuBarListener.h
+++ b/layout/xul/nsMenuBarListener.h
@@ -105,15 +105,15 @@ protected:
   // The top window as EventTarget.
   mozilla::dom::EventTarget* mTopWindowEventTarget;
   // Whether or not the ALT key is currently down.
   bool mAccessKeyDown;
   // Whether or not the ALT key down is canceled by other action.
   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;
 };
 
 #endif // #ifndef nsMenuBarListener_h
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -51,16 +51,17 @@
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
 #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>
 
 using namespace mozilla;
 using mozilla::dom::PopupBoxObject;
 using mozilla::dom::KeyboardEvent;
 
 int8_t nsMenuPopupFrame::sDefaultLevelIsTop = -1;
@@ -2101,17 +2102,17 @@ nsMenuPopupFrame::FindMenuWithShortcut(K
   nsIContent* parentContent = mContent->GetParent();
 
   bool isMenu = parentContent &&
                   !parentContent->NodeInfo()->Equals(nsGkAtoms::menulist, kNameSpaceID_XUL);
 
   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;
       }
       else {
 #ifdef XP_WIN
         nsCOMPtr<nsISound> soundInterface = do_CreateInstance("@mozilla.org/sound;1");
         if (soundInterface)
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -32,50 +32,56 @@
 #include "nsIDocument.h"
 #include "nsPIWindowRoot.h"
 #include "nsFrameManager.h"
 #include "nsIObserverService.h"
 #include "XULDocument.h"
 #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"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Services.h"
 #include "mozilla/widget/nsAutoRollup.h"
 
 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
   }
 };
 
 nsXULPopupManager* nsXULPopupManager::sInstance = nullptr;
 
 nsIContent* nsMenuChainItem::Content()
 {
   return mFrame->GetContent();
@@ -2182,18 +2188,18 @@ nsXULPopupManager::HandleKeyboardNavigat
   if (item)
     itemFrame = item->Frame();
   else if (mActiveMenuBar)
     itemFrame = mActiveMenuBar;
   else
     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;
 #ifdef MOZ_WIDGET_GTK
   nsMenuFrame* currentItem = nullptr;
   if (item && mActiveMenuBar && NS_DIRECTION_IS_INLINE(theDirection)) {
     currentItem = item->Frame()->GetCurrentMenuItem();
     // If nothing is selected in the menu and we have a menubar, let it
@@ -2332,85 +2338,86 @@ nsXULPopupManager::HandleKeyboardEventWi
                         KeyboardEvent* aKeyEvent,
                         nsMenuChainItem* aTopVisibleMenuItem)
 {
   uint32_t keyCode = aKeyEvent->KeyCode();
 
   // 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();
       aKeyEvent->PreventDefault();
     }
     return true;
   }
 
   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() &&
           aTopVisibleMenuItem &&
           aTopVisibleMenuItem->Frame()->IsMenuList()) {
         Rollup(0, false, nullptr, nullptr);
         break;
       }
       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
       // ends up being the same. Similar for the tab key below.
       if (aTopVisibleMenuItem) {
         HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
       } else if (mActiveMenuBar) {
         mActiveMenuBar->MenuClosed();
       }
       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(
             kNameSpaceID_None, nsGkAtoms::activateontab, nsGkAtoms::_true,
             eCaseMatters)) {
         // close popups or deactivate menubar when Tab or F10 are pressed
         Rollup(0, false, nullptr, nullptr);
         break;
       } else if (mActiveMenuBar) {
         mActiveMenuBar->MenuClosed();
         break;
       }
       // 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.
       nsMenuFrame* menuToOpen = nullptr;
       WidgetGUIEvent* GUIEvent = aKeyEvent->WidgetEventPtr()->AsGUIEvent();
 
       if (aTopVisibleMenuItem) {
         menuToOpen = aTopVisibleMenuItem->Frame()->Enter(GUIEvent);
@@ -2695,23 +2702,23 @@ nsXULPopupManager::KeyDown(KeyboardEvent
   // If the key just pressed is the access key (usually Alt),
   // dismiss and unfocus the menu.
 
   nsMenuBarListener::GetMenuAccessKey(&menuAccessKey);
   if (menuAccessKey) {
     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
         // modifiers are already down.
         nsMenuChainItem* item = GetTopVisibleMenu();
         if (item && !item->Frame()->IsMenuList()) {
           Rollup(0, false, nullptr, nullptr);
         } else if (mActiveMenuBar) {
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -123,19 +123,19 @@ static_assert(NS_STYLE_DIRECTION_LTR == 
 
 /**
  * DirectionFromKeyCodeTable: two arrays, the first for left-to-right and the
  * other for right-to-left, that map keycodes to values of
  * nsNavigationDirection.
  */
 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
 // the lowest child in a chain of menus, as this is the active submenu.
 class nsMenuChainItem
 {
 private:
   nsMenuPopupFrame* mFrame; // the popup frame
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -12,20 +12,20 @@
 #include "nsToolkitCompsCID.h"
 #include "nsIServiceManager.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsIScriptSecurityManager.h"
 #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=";
 
 using namespace mozilla;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsAutoCompleteController)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAutoCompleteController)
@@ -286,17 +286,17 @@ nsAutoCompleteController::HandleText(boo
   SetSearchStringInternal(newValue);
 
   // Don't search if the value is empty
   if (newValue.Length() == 0) {
     // If autocomplete popup was closed by compositionstart event handler,
     // 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();
     return NS_OK;
   }
 
   *_retval = true;
   StartSearches();
@@ -436,32 +436,32 @@ nsAutoCompleteController::HandleKeyNavig
   nsCOMPtr<nsIAutoCompletePopup> popup;
   input->GetPopup(getter_AddRefs(popup));
   NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
 
   bool disabled;
   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
     *_retval = true;
 
     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
       // calling SelectBy of an earlier attempt to avoid crashing.
       bool completeSelection;
       input->GetCompleteSelectedIndex(&completeSelection);
 
       // The user has keyed up or down to change the selection.  Stop the search
@@ -509,23 +509,23 @@ nsAutoCompleteController::HandleKeyNavig
       }
     } else {
 #ifdef XP_MACOSX
       // on Mac, only show the popup if the caret is at the start or end of
       // the input and there is no selection, so that the default defined key
       // 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);
         input->GetSelectionEnd(&end);
         if (start != end || end < (int32_t)text.Length())
           *_retval = false;
       }
 #endif
@@ -555,20 +555,20 @@ nsAutoCompleteController::HandleKeyNavig
           nsAutoString value;
           input->GetTextValue(value);
           SetSearchStringInternal(value);
 
           StartSearches();
         }
       }
     }
-  } 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
             )
   {
     // The user hit a text-navigation key.
     bool isOpen = false;
     input->GetPopupOpen(&isOpen);
 
     // If minresultsforpopup > 1 and there's less matches than the minimum
--- a/toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
+++ b/toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
@@ -28,145 +28,145 @@
  *   @param modifiers     The spoofing modifier states for this key.
  *                        See BasicEvents.h for details.
  */
 
 /**
  * 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)
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -7,16 +7,17 @@
 #include "nsFormFillController.h"
 
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/Element.h"
 #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"
 #include "nsIInputListAutoComplete.h"
 #include "nsIAutoCompleteSimpleResult.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsIServiceManager.h"
@@ -1091,99 +1092,99 @@ nsFormFillController::KeyPress(nsIDOMEve
     return NS_ERROR_FAILURE;
   }
 
   bool cancel = false;
   bool unused = false;
 
   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);
       } else {
         mController->HandleText(&unused);
       }
 
       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() ||
           keyEvent->MetaKey()) {
         break;
       }
     }
     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.
       mozilla::WritingMode wm;
       if (mFocusedInput) {
         nsIFrame *frame = mFocusedInput->GetPrimaryFrame();
         if (frame) {
           wm = frame->GetWritingMode();
         }
       }
       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;
   }
 
   if (cancel) {
     aEvent->PreventDefault();
     // Don't let the page see the RETURN event when the popup is open
     // (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();
     }
   }
 
   return NS_OK;
 }
 
 nsresult
@@ -1239,17 +1240,17 @@ nsFormFillController::ShowPopup()
     // Show the popup with a filtered result set
     mController->SetSearchString(EmptyString());
     bool unused = false;
     mController->HandleText(&unused);
   } else {
     // 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;
 }
 
 ////////////////////////////////////////////////////////////////////////
 //// nsFormFillController
 
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -8,16 +8,17 @@
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #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"
 #include "nsPrintfCString.h"
 
 namespace mozilla {
 
 /******************************************************************************
@@ -631,26 +632,26 @@ WidgetInputEvent::GetModifier(const nsAS
 
 /* static */
 Modifier
 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:
 #ifdef XP_MACOSX
         sAccelModifier = MODIFIER_META;
 #else
         sAccelModifier = MODIFIER_CONTROL;
 #endif
@@ -1250,176 +1251,176 @@ WidgetKeyboardEvent::ComputeLocationFrom
   }
 }
 
 /* static */ uint32_t
 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;
   }
 }
 
 /* static */ Modifier
 WidgetKeyboardEvent::GetModifierForKeyName(KeyNameIndex aKeyNameIndex)
 {
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -871,17 +871,17 @@ struct KeyConversionData
   uint32_t charCode;
 };
 
 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}
 
   KEYCODE_ENTRY(VK_CANCEL, 0x001B),
   KEYCODE_ENTRY(VK_DELETE, NSDeleteFunctionKey),
   KEYCODE_ENTRY(VK_BACK, NSBackspaceCharacter),
   KEYCODE_ENTRY2(VK_BACK_SPACE, VK_BACK, NSBackspaceCharacter),
   KEYCODE_ENTRY(VK_TAB, NSTabCharacter),