Bug 1337739 Create an enum eKeyLocation* for avoiding to use nsIDOMKeyEvent::DOM_KEY_LOCATION_* r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 08 Feb 2017 21:04:22 +0900
changeset 390714 cdd7f21530b2e6cf819ec42a80c47ef2f0bfff98
parent 390713 d362fcfd6f331119c081f2b22f77baee914b7a38
child 390715 3593cac8732bbe91591773077757789b79a4b94b
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1337739
milestone54.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 1337739 Create an enum eKeyLocation* for avoiding to use nsIDOMKeyEvent::DOM_KEY_LOCATION_* r=smaug Currently, we use alias NS_VK_* for WidgetKeyboardEvent::mKeyCode. Similarly, we should create alias enum for nsIDOMKeyEvent::DOM_KEY_LOCATION_*. Then, we can reduce the length and avoid to include nsIDOMKeyEvent in some cpp files. MozReview-Commit-ID: 5cs4zQ061Lc
dom/base/nsContentUtils.cpp
editor/libeditor/EditorEventListener.cpp
widget/TextEvents.h
widget/WidgetEventImpl.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/nsGtkKeyUtils.cpp
widget/windows/KeyboardLayout.cpp
widget/windows/KeyboardLayout.h
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -8201,26 +8201,26 @@ nsContentUtils::SendKeyEvent(nsIWidget* 
     event.mCharCode = 0;
   }
 
   uint32_t locationFlag = (aAdditionalFlags &
     (nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD | nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT |
      nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT | nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD));
   switch (locationFlag) {
     case nsIDOMWindowUtils::KEY_FLAG_LOCATION_STANDARD:
-      event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+      event.mLocation = eKeyLocationStandard;
       break;
     case nsIDOMWindowUtils::KEY_FLAG_LOCATION_LEFT:
-      event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+      event.mLocation = eKeyLocationLeft;
       break;
     case nsIDOMWindowUtils::KEY_FLAG_LOCATION_RIGHT:
-      event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+      event.mLocation = eKeyLocationRight;
       break;
     case nsIDOMWindowUtils::KEY_FLAG_LOCATION_NUMPAD:
-      event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      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:
@@ -8234,26 +8234,26 @@ nsContentUtils::SendKeyEvent(nsIWidget* 
         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:
-          event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+          event.mLocation = eKeyLocationNumpad;
           break;
         case nsIDOMKeyEvent::DOM_VK_SHIFT:
         case nsIDOMKeyEvent::DOM_VK_CONTROL:
         case nsIDOMKeyEvent::DOM_VK_ALT:
         case nsIDOMKeyEvent::DOM_VK_META:
-          event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+          event.mLocation = eKeyLocationLeft;
           break;
         default:
-          event.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+          event.mLocation = eKeyLocationStandard;
           break;
       }
       break;
   }
 
   event.mRefPoint = LayoutDeviceIntPoint(0, 0);
   event.mTime = PR_IntervalNow();
   if (!(aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -514,23 +514,25 @@ bool IsCtrlShiftPressed(nsIDOMKeyEvent* 
     aEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
   MOZ_ASSERT(keyboardEvent,
              "DOM key event's internal event must be WidgetKeyboardEvent");
 
   if (!keyboardEvent->IsControl()) {
     return false;
   }
 
-  uint32_t location = keyboardEvent->mLocation;
-  if (location == nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT) {
-    isRTL = true;
-  } else if (location == nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT) {
-    isRTL = false;
-  } else {
-    return false;
+  switch (keyboardEvent->mLocation) {
+    case eKeyLocationRight:
+      isRTL = true;
+      break;
+    case eKeyLocationLeft:
+      isRTL = false;
+      break;
+    default:
+      return false;
   }
 
   // Scan the key status to find pressed keys. We should abandon changing the
   // text direction when there are other pressed keys.
   if (keyboardEvent->IsAlt() || keyboardEvent->IsOS()) {
     return false;
   }
 
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -36,16 +36,24 @@ enum
 #define NS_DEFINE_VK(aDOMKeyName, aDOMKeyCode) NS_##aDOMKeyName = aDOMKeyCode,
 #include "mozilla/VirtualKeyCodeList.h"
 #undef NS_DEFINE_VK
   NS_VK_UNKNOWN = 0xFF
 };
 
 namespace mozilla {
 
+enum : uint32_t
+{
+  eKeyLocationStandard = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD,
+  eKeyLocationLeft     = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT,
+  eKeyLocationRight    = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT,
+  eKeyLocationNumpad   = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD
+};
+
 const nsCString GetDOMKeyCodeName(uint32_t aKeyCode);
 
 namespace dom {
   class PBrowserParent;
   class PBrowserChild;
 } // namespace dom
 namespace plugins {
   class PPluginInstanceChild;
@@ -103,24 +111,24 @@ private:
   friend class dom::PBrowserChild;
 
 protected:
   WidgetKeyboardEvent()
     : mNativeKeyEvent(nullptr)
     , mKeyCode(0)
     , mCharCode(0)
     , mPseudoCharCode(0)
-    , mLocation(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
+    , mLocation(eKeyLocationStandard)
     , mAccessKeyForwardedToChild(false)
     , mUniqueId(0)
 #ifdef XP_MACOSX
     , mNativeModifierFlags(0)
     , mNativeKeyCode(0)
 #endif // #ifdef XP_MACOSX
-    , mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
+    , mKeyNameIndex(KEY_NAME_INDEX_Unidentified)
     , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
     , mInputMethodAppState(eNotHandled)
     , mIsChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mIsSynthesizedByTIP(false)
   {
@@ -132,24 +140,24 @@ public:
   WidgetKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
                       nsIWidget* aWidget,
                       EventClassID aEventClassID = eKeyboardEventClass)
     : WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
     , mNativeKeyEvent(nullptr)
     , mKeyCode(0)
     , mCharCode(0)
     , mPseudoCharCode(0)
-    , mLocation(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
+    , mLocation(eKeyLocationStandard)
     , mAccessKeyForwardedToChild(false)
     , mUniqueId(0)
 #ifdef XP_MACOSX
     , mNativeModifierFlags(0)
     , mNativeKeyCode(0)
 #endif // #ifdef XP_MACOSX
-    , mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
+    , mKeyNameIndex(KEY_NAME_INDEX_Unidentified)
     , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
     , mInputMethodAppState(eNotHandled)
     , mIsChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mIsSynthesizedByTIP(false)
   {
@@ -222,17 +230,17 @@ public:
   // value of the key.  Otherwise, 0.  This value must not be a control
   // character when some modifiers are active.  Then, this value should be an
   // unmodified value except Shift and AltGr.
   uint32_t mCharCode;
   // mPseudoCharCode is valid only when mMessage is an eKeyDown event.
   // This stores mCharCode value of keypress event which is fired with same
   // key value and same modifier state.
   uint32_t mPseudoCharCode;
-  // One of nsIDOMKeyEvent::DOM_KEY_LOCATION_*
+  // One of eKeyLocation*
   uint32_t mLocation;
   // True if accesskey handling was forwarded to the child via
   // TabParent::HandleAccessKey. In this case, parent process menu access key
   // handling should be delayed until it is determined that there exists no
   // overriding access key in the content process.
   bool mAccessKeyForwardedToChild;
   // Unique id associated with a keydown / keypress event. Used in identifing
   // keypress events for removal from async event dispatch queue in metrofx
@@ -335,18 +343,18 @@ public:
    *                          the first item is most preferred.
    */
   void GetAccessKeyCandidates(nsTArray<uint32_t>& aCandidates);
 
   static void Shutdown();
 
   /**
    * ComputeLocationFromCodeValue() returns one of .mLocation value
-   * (nsIDOMKeyEvent::DOM_KEY_LOCATION_*) which is the most preferred value
-   * for the specified specified code value.
+   * (eKeyLocation*) which is the most preferred value for the specified code
+   * value.
    */
   static uint32_t ComputeLocationFromCodeValue(CodeNameIndex aCodeNameIndex);
 
   /**
    * ComputeKeyCodeFromKeyNameIndex() return a .mKeyCode value which can be
    * mapped from the specified key value.  Note that this returns 0 if the
    * key name index is KEY_NAME_INDEX_Unidentified or KEY_NAME_INDEX_USE_STRING.
    * This means that this method is useful only for non-printable keys.
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -890,22 +890,22 @@ WidgetKeyboardEvent::ComputeLocationFrom
   // Following commented out cases are not defined in PhysicalKeyCodeNameList.h
   // but are defined by D3E spec.  So, they should be uncommented when the
   // code values are defined in the header.
   switch (aCodeNameIndex) {
     case CODE_NAME_INDEX_AltLeft:
     case CODE_NAME_INDEX_ControlLeft:
     case CODE_NAME_INDEX_OSLeft:
     case CODE_NAME_INDEX_ShiftLeft:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+      return eKeyLocationLeft;
     case CODE_NAME_INDEX_AltRight:
     case CODE_NAME_INDEX_ControlRight:
     case CODE_NAME_INDEX_OSRight:
     case CODE_NAME_INDEX_ShiftRight:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+      return eKeyLocationRight;
     case CODE_NAME_INDEX_Numpad0:
     case CODE_NAME_INDEX_Numpad1:
     case CODE_NAME_INDEX_Numpad2:
     case CODE_NAME_INDEX_Numpad3:
     case CODE_NAME_INDEX_Numpad4:
     case CODE_NAME_INDEX_Numpad5:
     case CODE_NAME_INDEX_Numpad6:
     case CODE_NAME_INDEX_Numpad7:
@@ -924,19 +924,19 @@ WidgetKeyboardEvent::ComputeLocationFrom
     case CODE_NAME_INDEX_NumpadMemoryClear:
     case CODE_NAME_INDEX_NumpadMemoryRecall:
     case CODE_NAME_INDEX_NumpadMemoryStore:
     case CODE_NAME_INDEX_NumpadMemorySubtract:
     case CODE_NAME_INDEX_NumpadMultiply:
     case CODE_NAME_INDEX_NumpadParenLeft:
     case CODE_NAME_INDEX_NumpadParenRight:
     case CODE_NAME_INDEX_NumpadSubtract:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      return eKeyLocationNumpad;
     default:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+      return eKeyLocationStandard;
   }
 }
 
 /* static */ uint32_t
 WidgetKeyboardEvent::ComputeKeyCodeFromKeyNameIndex(KeyNameIndex aKeyNameIndex)
 {
   switch (aKeyNameIndex) {
     case KEY_NAME_INDEX_Cancel:
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -906,24 +906,24 @@ TISInputSourceWrapper::InitKeyEvent(NSEv
   aKeyEvent.mKeyCode =
     ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta());
 
   switch (nativeKeyCode) {
     case kVK_Command:
     case kVK_Shift:
     case kVK_Option:
     case kVK_Control:
-      aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+      aKeyEvent.mLocation = eKeyLocationLeft;
       break;
 
     case kVK_RightCommand:
     case kVK_RightShift:
     case kVK_RightOption:
     case kVK_RightControl:
-      aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+      aKeyEvent.mLocation = eKeyLocationRight;
       break;
 
     case kVK_ANSI_Keypad0:
     case kVK_ANSI_Keypad1:
     case kVK_ANSI_Keypad2:
     case kVK_ANSI_Keypad3:
     case kVK_ANSI_Keypad4:
     case kVK_ANSI_Keypad5:
@@ -935,21 +935,21 @@ TISInputSourceWrapper::InitKeyEvent(NSEv
     case kVK_ANSI_KeypadPlus:
     case kVK_ANSI_KeypadMinus:
     case kVK_ANSI_KeypadDecimal:
     case kVK_ANSI_KeypadDivide:
     case kVK_ANSI_KeypadEquals:
     case kVK_ANSI_KeypadEnter:
     case kVK_JIS_KeypadComma:
     case kVK_Powerbook_KeypadEnter:
-      aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      aKeyEvent.mLocation = eKeyLocationNumpad;
       break;
 
     default:
-      aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+      aKeyEvent.mLocation = eKeyLocationStandard;
       break;
   }
 
   aKeyEvent.mIsRepeat =
     ([aNativeKeyEvent type] == NSKeyDown) ? [aNativeKeyEvent isARepeat] : false;
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::InitKeyEvent, "
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -941,26 +941,26 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboa
 
     switch (aGdkKeyEvent->keyval) {
         case GDK_Shift_L:
         case GDK_Control_L:
         case GDK_Alt_L:
         case GDK_Super_L:
         case GDK_Hyper_L:
         case GDK_Meta_L:
-            aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+            aKeyEvent.mLocation = eKeyLocationLeft;
             break;
 
         case GDK_Shift_R:
         case GDK_Control_R:
         case GDK_Alt_R:
         case GDK_Super_R:
         case GDK_Hyper_R:
         case GDK_Meta_R:
-            aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+            aKeyEvent.mLocation = eKeyLocationRight;
             break;
 
         case GDK_KP_0:
         case GDK_KP_1:
         case GDK_KP_2:
         case GDK_KP_3:
         case GDK_KP_4:
         case GDK_KP_5:
@@ -988,21 +988,21 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboa
         case GDK_KP_Delete:
         case GDK_KP_Equal:
         case GDK_KP_Multiply:
         case GDK_KP_Add:
         case GDK_KP_Separator:
         case GDK_KP_Subtract:
         case GDK_KP_Decimal:
         case GDK_KP_Divide:
-            aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+            aKeyEvent.mLocation = eKeyLocationNumpad;
             break;
 
         default:
-            aKeyEvent.mLocation = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+            aKeyEvent.mLocation = eKeyLocationStandard;
             break;
     }
 
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
         ("%p InitKeyEvent, modifierState=0x%08X "
          "aGdkKeyEvent={ type=%s, keyval=%s(0x%X), state=0x%08X, "
          "hardware_keycode=0x%08X, is_modifier=%s } "
          "aKeyEvent={ message=%s, isShift=%s, isControl=%s, "
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/TextEvents.h"
 #include "mozilla/WindowsVersion.h"
 
 #include "nsAlgorithm.h"
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 #include "nsGkAtoms.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIIdleServiceInternal.h"
 #include "nsIWindowsRegKey.h"
 #include "nsMemory.h"
 #include "nsPrintfCString.h"
 #include "nsQuickSort.h"
 #include "nsServiceManagerUtils.h"
 #include "nsToolkit.h"
 #include "nsUnicharUtils.h"
@@ -250,23 +249,23 @@ GetCharacterCodeName(WPARAM aCharCode)
     }
   }
 }
 
 static const nsCString
 GetKeyLocationName(uint32_t aLocation)
 {
   switch (aLocation) {
-    case nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT:
+    case eKeyLocationLeft:
       return NS_LITERAL_CSTRING("KEY_LOCATION_LEFT");
-    case nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT:
+    case eKeyLocationRight:
       return NS_LITERAL_CSTRING("KEY_LOCATION_RIGHT");
-    case nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD:
+    case eKeyLocationStandard:
       return NS_LITERAL_CSTRING("KEY_LOCATION_STANDARD");
-    case nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD:
+    case eKeyLocationNumpad:
       return NS_LITERAL_CSTRING("KEY_LOCATION_NUMPAD");
     default:
       return nsPrintfCString("Unknown (0x%04X)", aLocation);
   }
 }
 
 static const nsCString
 GetCharacterCodeName(char16_t* aChars, uint32_t aLength)
@@ -1772,43 +1771,41 @@ NativeKey::GetScanCodeWithExtendedFlag()
 uint32_t
 NativeKey::GetKeyLocation() const
 {
   switch (mVirtualKeyCode) {
     case VK_LSHIFT:
     case VK_LCONTROL:
     case VK_LMENU:
     case VK_LWIN:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT;
+      return eKeyLocationLeft;
 
     case VK_RSHIFT:
     case VK_RCONTROL:
     case VK_RMENU:
     case VK_RWIN:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT;
+      return eKeyLocationRight;
 
     case VK_RETURN:
       // XXX This code assumes that all keyboard drivers use same mapping.
-      return !mIsExtended ? nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD :
-                            nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      return !mIsExtended ? eKeyLocationStandard : eKeyLocationNumpad;
 
     case VK_INSERT:
     case VK_DELETE:
     case VK_END:
     case VK_DOWN:
     case VK_NEXT:
     case VK_LEFT:
     case VK_CLEAR:
     case VK_RIGHT:
     case VK_HOME:
     case VK_UP:
     case VK_PRIOR:
       // XXX This code assumes that all keyboard drivers use same mapping.
-      return mIsExtended ? nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD :
-                           nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      return mIsExtended ? eKeyLocationStandard : eKeyLocationNumpad;
 
     // NumLock key isn't included due to IE9's behavior.
     case VK_NUMPAD0:
     case VK_NUMPAD1:
     case VK_NUMPAD2:
     case VK_NUMPAD3:
     case VK_NUMPAD4:
     case VK_NUMPAD5:
@@ -1818,25 +1815,25 @@ NativeKey::GetKeyLocation() const
     case VK_NUMPAD9:
     case VK_DECIMAL:
     case VK_DIVIDE:
     case VK_MULTIPLY:
     case VK_SUBTRACT:
     case VK_ADD:
     // Separator key of Brazilian keyboard or JIS keyboard for Mac
     case VK_ABNT_C2:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD;
+      return eKeyLocationNumpad;
 
     case VK_SHIFT:
     case VK_CONTROL:
     case VK_MENU:
       NS_WARNING("Failed to decide the key location?");
 
     default:
-      return nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
+      return eKeyLocationStandard;
   }
 }
 
 uint8_t
 NativeKey::ComputeVirtualKeyCodeFromScanCode() const
 {
   return static_cast<uint8_t>(
            ::MapVirtualKeyEx(mScanCode, MAPVK_VSC_TO_VK, mKeyboardLayout));
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -447,17 +447,17 @@ private:
         return false;
       default:
         return false;
     }
   }
 
   UINT GetScanCodeWithExtendedFlag() const;
 
-  // The result is one of nsIDOMKeyEvent::DOM_KEY_LOCATION_*.
+  // The result is one of eKeyLocation*.
   uint32_t GetKeyLocation() const;
 
   /**
    * RemoveFollowingOddCharMessages() removes odd WM_CHAR messages from the
    * queue when IsIMEDoingKakuteiUndo() returns true.
    */
   void RemoveFollowingOddCharMessages();