Bug 1254755 part.2 Rename WidgetKeyboardEvent::charCode to WidgetKeyboardEvent::mCharCode r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 13 May 2016 16:06:18 +0900
changeset 297542 328c0d5ad23a386345bc2b2b65aee4361d5b50ba
parent 297541 5ebc59c69d1b421fa79d18578ace462563de7c24
child 297543 b3c7c85f2f8ac2a669ecec5570bba22ff83b4a99
push id30264
push userkwierso@gmail.com
push dateTue, 17 May 2016 20:52:53 +0000
treeherdermozilla-central@991f249a6ffa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1254755
milestone49.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 1254755 part.2 Rename WidgetKeyboardEvent::charCode to WidgetKeyboardEvent::mCharCode r=smaug And mCharCode shouldn't be compared with NS_VK_*, nsIDOMKeyEvent::DOM_VK_*. Additionally, when it's compared with a character constant, cast isn't necessary. MozReview-Commit-ID: JMT614copjG
dom/base/nsContentUtils.cpp
dom/events/KeyboardEvent.cpp
dom/html/HTMLSummaryElement.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
editor/libeditor/nsHTMLEditor.cpp
editor/libeditor/nsPlaintextEditor.cpp
layout/forms/nsListControlFrame.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/xul/nsMenuFrame.cpp
widget/TextEvents.h
widget/WidgetEventImpl.cpp
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.h
widget/cocoa/TextInputHandler.mm
widget/gonk/nsAppShell.cpp
widget/gtk/NativeKeyBindings.cpp
widget/gtk/nsGtkKeyUtils.cpp
widget/nsGUIEventIPC.h
widget/qt/nsWindow.cpp
widget/windows/KeyboardLayout.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7669,20 +7669,20 @@ nsContentUtils::SendKeyEvent(nsIWidget* 
   else
     return NS_ERROR_FAILURE;
 
   WidgetKeyboardEvent event(true, msg, aWidget);
   event.mModifiers = GetWidgetModifiers(aModifiers);
 
   if (msg == eKeyPress) {
     event.mKeyCode = aCharCode ? 0 : aKeyCode;
-    event.charCode = aCharCode;
+    event.mCharCode = aCharCode;
   } else {
     event.mKeyCode = aKeyCode;
-    event.charCode = 0;
+    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.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD;
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -179,32 +179,32 @@ KeyboardEvent::GetCharCode(uint32_t* aCh
   return NS_OK;
 }
 
 uint32_t
 KeyboardEvent::CharCode()
 {
   // If this event is initialized with ctor, we shouldn't check event type.
   if (mInitializedByCtor) {
-    return mEvent->AsKeyboardEvent()->charCode;
+    return mEvent->AsKeyboardEvent()->mCharCode;
   }
 
   switch (mEvent->mMessage) {
   case eBeforeKeyDown:
   case eKeyDown:
   case eKeyDownOnPlugin:
   case eAfterKeyDown:
   case eBeforeKeyUp:
   case eKeyUp:
   case eKeyUpOnPlugin:
   case eAfterKeyUp:
     return 0;
   case eKeyPress:
   case eAccessKeyNotFound:
-    return mEvent->AsKeyboardEvent()->charCode;
+    return mEvent->AsKeyboardEvent()->mCharCode;
   default:
     break;
   }
   return 0;
 }
 
 NS_IMETHODIMP
 KeyboardEvent::GetKeyCode(uint32_t* aKeyCode)
@@ -337,17 +337,17 @@ KeyboardEvent::InitKeyEvent(const nsAStr
                             uint32_t aKeyCode,
                             uint32_t aCharCode)
 {
   UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
 
   WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
   keyEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
   keyEvent->mKeyCode = aKeyCode;
-  keyEvent->charCode = aCharCode;
+  keyEvent->mCharCode = aCharCode;
 
   return NS_OK;
 }
 
 } // namespace dom
 } // namespace mozilla
 
 using namespace mozilla;
--- a/dom/html/HTMLSummaryElement.cpp
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -72,17 +72,17 @@ HTMLSummaryElement::PostHandleEvent(Even
   } // event->HasMouseEventMessage()
 
   if (event->HasKeyEventMessage()) {
     WidgetKeyboardEvent* keyboardEvent = event->AsKeyboardEvent();
     bool dispatchClick = false;
 
     switch (event->mMessage) {
       case eKeyPress:
-        if (keyboardEvent->charCode == nsIDOMKeyEvent::DOM_VK_SPACE) {
+        if (keyboardEvent->mCharCode == ' ') {
           // Consume 'space' key to prevent scrolling the page down.
           aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
         }
 
         dispatchClick = keyboardEvent->mKeyCode == NS_VK_RETURN;
         break;
 
       case eKeyUp:
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2849,17 +2849,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
           }
       }
       break;
 
     case eKeyboardEventClass:
      {
        const WidgetKeyboardEvent& keyEvent = *anEvent.AsKeyboardEvent();
        LOG("Firing eKeyboardEventClass %d %d\n",
-           keyEvent.mKeyCode, keyEvent.charCode);
+           keyEvent.mKeyCode, keyEvent.mCharCode);
        // pluginEvent is initialized by nsWindow::InitKeyEvent().
        const ANPEvent* pluginEvent = static_cast<const ANPEvent*>(keyEvent.mPluginEvent);
        if (pluginEvent) {
          MOZ_ASSERT(pluginEvent->inSize == sizeof(ANPEvent));
          MOZ_ASSERT(pluginEvent->eventType == kKey_ANPEventType);
          mInstance->HandleEvent(const_cast<ANPEvent*>(pluginEvent),
                                 nullptr,
                                 NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -696,24 +696,24 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOM
         return TypedText(EmptyString(), eTypedBR);
       }
       // uses rules to figure out what to insert
       return TypedText(EmptyString(), eTypedBreak);
   }
 
   // NOTE: On some keyboard layout, some characters are inputted with Control
   // key or Alt key, but at that time, widget sets FALSE to these keys.
-  if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->IsControl() ||
+  if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() ||
       nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
       nativeKeyEvent->IsOS()) {
     // we don't PreventDefault() here or keybindings like control-x won't work
     return NS_OK;
   }
   aKeyEvent->AsEvent()->PreventDefault();
-  nsAutoString str(nativeKeyEvent->charCode);
+  nsAutoString str(nativeKeyEvent->mCharCode);
   return TypedText(str, eTypedText);
 }
 
 static void
 AssertParserServiceIsCorrect(nsIAtom* aTag, bool aIsBlock)
 {
 #ifdef DEBUG
   // Check this against what we would have said with the old code:
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -398,24 +398,24 @@ nsPlaintextEditor::HandleKeyPressEvent(n
         return NS_OK;
       }
       aKeyEvent->AsEvent()->PreventDefault();
       return TypedText(EmptyString(), eTypedBreak);
   }
 
   // NOTE: On some keyboard layout, some characters are inputted with Control
   // key or Alt key, but at that time, widget sets FALSE to these keys.
-  if (nativeKeyEvent->charCode == 0 || nativeKeyEvent->IsControl() ||
+  if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() ||
       nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
       nativeKeyEvent->IsOS()) {
     // we don't PreventDefault() here or keybindings like control-x won't work
     return NS_OK;
   }
   aKeyEvent->AsEvent()->PreventDefault();
-  nsAutoString str(nativeKeyEvent->charCode);
+  nsAutoString str(nativeKeyEvent->mCharCode);
   return TypedText(str, eTypedText);
 }
 
 /* This routine is needed to provide a bottleneck for typing for logging
    purposes.  Can't use HandleKeyPress() (above) for that since it takes
    a nsIDOMKeyEvent* parameter.  So instead we pass enough info through
    to TypedText() to determine what action to take, but without passing
    an event.
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -2266,28 +2266,28 @@ nsListControlFrame::KeyPress(nsIDOMEvent
 
   if (keyEvent->IsAlt()) {
     return NS_OK;
   }
 
   // With some keyboard layout, space key causes non-ASCII space.
   // So, the check in keydown event handler isn't enough, we need to check it
   // again with keypress event.
-  if (keyEvent->charCode != ' ') {
+  if (keyEvent->mCharCode != ' ') {
     mControlSelectMode = false;
   }
 
   bool isControlOrMeta = (keyEvent->IsControl() || keyEvent->IsMeta());
-  if (isControlOrMeta && keyEvent->charCode != ' ') {
+  if (isControlOrMeta && keyEvent->mCharCode != ' ') {
     return NS_OK;
   }
 
-  // NOTE: If mKeyCode of keypress event is not 0, charCode is always 0.
+  // NOTE: If mKeyCode of keypress event is not 0, mCharCode is always 0.
   //       Therefore, all non-printable keys are not handled after this block.
-  if (!keyEvent->charCode) {
+  if (!keyEvent->mCharCode) {
     // Backspace key will delete the last char in the string.  Otherwise,
     // non-printable keypress should reset incremental search.
     if (keyEvent->mKeyCode == NS_VK_BACK) {
       incrementalSearchResetter.Cancel();
       if (!GetIncrementalString().IsEmpty()) {
         GetIncrementalString().Truncate(GetIncrementalString().Length() - 1);
       }
       aKeyEvent->PreventDefault();
@@ -2310,32 +2310,32 @@ nsListControlFrame::KeyPress(nsIDOMEvent
   // Incremental Search: if time elapsed is below
   // INCREMENTAL_SEARCH_KEYPRESS_TIME, append this keystroke to the search
   // string we will use to find options and start searching at the current
   // keystroke.  Otherwise, Truncate the string if it's been a long time
   // since our last keypress.
   if (keyEvent->mTime - gLastKeyTime > INCREMENTAL_SEARCH_KEYPRESS_TIME) {
     // If this is ' ' and we are at the beginning of the string, treat it as
     // "select this option" (bug 191543)
-    if (keyEvent->charCode == ' ') {
+    if (keyEvent->mCharCode == ' ') {
       // Actually process the new index and let the selection code
       // do the scrolling for us
-      PostHandleKeyEvent(mEndSelectionIndex, keyEvent->charCode,
+      PostHandleKeyEvent(mEndSelectionIndex, keyEvent->mCharCode,
                          keyEvent->IsShift(), isControlOrMeta);
 
       return NS_OK;
     }
 
     GetIncrementalString().Truncate();
   }
 
   gLastKeyTime = keyEvent->mTime;
 
   // Append this keystroke to the search string. 
-  char16_t uniChar = ToLowerCase(static_cast<char16_t>(keyEvent->charCode));
+  char16_t uniChar = ToLowerCase(static_cast<char16_t>(keyEvent->mCharCode));
   GetIncrementalString().Append(uniChar);
 
   // See bug 188199, if all letters in incremental string are same, just try to
   // match the first one
   nsAutoString incrementalString(GetIncrementalString());
   uint32_t charIndex = 1, stringLength = incrementalString.Length();
   while (charIndex < stringLength &&
          incrementalString[charIndex] == incrementalString[charIndex - 1]) {
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -135,17 +135,17 @@ GetActionForEvent(nsIDOMEvent* aEvent)
     NS_VK_UP,      NS_VK_DOWN, 
     NS_VK_HOME,    NS_VK_END 
   };
 
   if (keyEvent->mKeyCode == NS_VK_TAB) {
     return keyEvent->IsShift() ? eEventAction_ShiftTab : eEventAction_Tab;
   }
 
-  if (keyEvent->charCode == ' ' || keyEvent->mKeyCode == NS_VK_SPACE) {
+  if (keyEvent->mCharCode == ' ' || keyEvent->mKeyCode == NS_VK_SPACE) {
     return eEventAction_Propagate;
   }
 
   if (keyEvent->IsShift()) {
     return eEventAction_Suppress;
   }
 
   for (uint32_t i = 0; i < ArrayLength(kOKKeyCodes); ++i) {
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -387,17 +387,17 @@ nsMenuFrame::HandleEvent(nsPresContext* 
 
   bool onmenu = IsOnMenu();
 
   if (aEvent->mMessage == eKeyPress && !IsDisabled()) {
     WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
     uint32_t keyCode = keyEvent->mKeyCode;
 #ifdef XP_MACOSX
     // On mac, open menulist on either up/down arrow or space (w/o Cmd pressed)
-    if (!IsOpen() && ((keyEvent->charCode == NS_VK_SPACE && !keyEvent->IsMeta()) ||
+    if (!IsOpen() && ((keyEvent->mCharCode == ' ' && !keyEvent->IsMeta()) ||
         (keyCode == NS_VK_UP || keyCode == NS_VK_DOWN))) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
       OpenMenu(false);
     }
 #else
     // On other platforms, toggle menulist on unmodified F4 or Alt arrow
     if ((keyCode == NS_VK_F4 && !keyEvent->IsAlt()) ||
         ((keyCode == NS_VK_UP || keyCode == NS_VK_DOWN) && keyEvent->IsAlt())) {
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -78,17 +78,17 @@ struct AlternativeCharCode
 
 struct ShortcutKeyCandidate
 {
   ShortcutKeyCandidate(uint32_t aCharCode, bool aIgnoreShift)
     : mCharCode(aCharCode)
     , mIgnoreShift(aIgnoreShift)
   {
   }
-  // The charCode value which must match keyboard shortcut definition.
+  // The mCharCode value which must match keyboard shortcut definition.
   uint32_t mCharCode;
   // true if Shift state can be ignored.  Otherwise, Shift key state must
   // match keyboard shortcut definition.
   bool mIgnoreShift;
 };
 
 /******************************************************************************
  * mozilla::WidgetKeyboardEvent
@@ -98,17 +98,17 @@ class WidgetKeyboardEvent : public Widge
 {
 private:
   friend class dom::PBrowserParent;
   friend class dom::PBrowserChild;
 
 protected:
   WidgetKeyboardEvent()
     : mKeyCode(0)
-    , charCode(0)
+    , mCharCode(0)
     , mPseudoCharCode(0)
     , location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
     , isChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mAccessKeyForwardedToChild(false)
     , mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
@@ -127,17 +127,17 @@ protected:
 public:
   virtual WidgetKeyboardEvent* AsKeyboardEvent() override { return this; }
 
   WidgetKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
                       nsIWidget* aWidget,
                       EventClassID aEventClassID = eKeyboardEventClass)
     : WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
     , mKeyCode(0)
-    , charCode(0)
+    , mCharCode(0)
     , mPseudoCharCode(0)
     , location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD)
     , isChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mAccessKeyForwardedToChild(false)
     , mKeyNameIndex(mozilla::KEY_NAME_INDEX_Unidentified)
@@ -188,26 +188,26 @@ public:
     // Not copying widget, it is a weak reference.
     WidgetKeyboardEvent* result =
       new WidgetKeyboardEvent(false, mMessage, nullptr);
     result->AssignKeyEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
-  // A DOM keyCode value or 0.  If a keypress event whose charCode is 0, this
+  // A DOM keyCode value or 0.  If a keypress event whose mCharCode is 0, this
   // should be 0.
   uint32_t mKeyCode;
   // If the instance is a keypress event of a printable key, this is a UTF-16
   // 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 charCode;
+  uint32_t mCharCode;
   // mPseudoCharCode is valid only when mMessage is an eKeyDown event.
-  // This stores charCode value of keypress event which is fired with same
+  // 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_*
   uint32_t location;
   // OS translated Unicode chars which are used for accesskey and accelkey
   // handling. The handlers will try from first character to last character.
   nsTArray<AlternativeCharCode> alternativeCharCodes;
   // Indicates whether the event signifies a printable character
@@ -268,29 +268,29 @@ public:
   // Indicates whether the event is synthesized from Text Input Processor
   // or an actual event from nsAppShell.
   bool mIsSynthesizedByTIP;
 
   // If the key should cause keypress events, this returns true.
   // Otherwise, false.
   bool ShouldCauseKeypressEvents() const;
 
-  // charCode value of non-eKeyPress events is always 0.  However, if
+  // mCharCode value of non-eKeyPress events is always 0.  However, if
   // non-eKeyPress event has one or more alternative char code values,
-  // its first item should be the charCode value of following eKeyPress event.
-  // PseudoCharCode() returns charCode value for eKeyPress event,
+  // its first item should be the mCharCode value of following eKeyPress event.
+  // PseudoCharCode() returns mCharCode value for eKeyPress event,
   // the first alternative char code value of non-eKeyPress event or 0.
   uint32_t PseudoCharCode() const
   {
-    return mMessage == eKeyPress ? charCode : mPseudoCharCode;
+    return mMessage == eKeyPress ? mCharCode : mPseudoCharCode;
   }
   void SetCharCode(uint32_t aCharCode)
   {
     if (mMessage == eKeyPress) {
-      charCode = aCharCode;
+      mCharCode = aCharCode;
     } else {
       mPseudoCharCode = aCharCode;
     }
   }
 
   void GetDOMKeyName(nsAString& aKeyName)
   {
     if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING) {
@@ -368,17 +368,17 @@ public:
 
   static const char* GetCommandStr(Command aCommand);
 
   void AssignKeyEventData(const WidgetKeyboardEvent& aEvent, bool aCopyTargets)
   {
     AssignInputEventData(aEvent, aCopyTargets);
 
     mKeyCode = aEvent.mKeyCode;
-    charCode = aEvent.charCode;
+    mCharCode = aEvent.mCharCode;
     mPseudoCharCode = aEvent.mPseudoCharCode;
     location = aEvent.location;
     alternativeCharCodes = aEvent.alternativeCharCodes;
     isChar = aEvent.isChar;
     mIsRepeat = aEvent.mIsRepeat;
     mIsComposing = aEvent.mIsComposing;
     mIsReserved = aEvent.mIsReserved;
     mAccessKeyForwardedToChild = aEvent.mAccessKeyForwardedToChild;
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -564,65 +564,63 @@ WidgetKeyboardEvent::GetShortcutKeyCandi
   }
 
   // Special case for "Space" key.  With some keyboard layouts, "Space" with
   // or without Shift key causes non-ASCII space.  For such keyboard layouts,
   // we should guarantee that the key press works as an ASCII white space key
   // press.  However, if the space key is assigned to a function key, it
   // shouldn't work as a space key.
   if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING &&
-      mCodeNameIndex == CODE_NAME_INDEX_Space &&
-      pseudoCharCode != static_cast<uint32_t>(' ')) {
-    ShortcutKeyCandidate spaceKey(static_cast<uint32_t>(' '), false);
+      mCodeNameIndex == CODE_NAME_INDEX_Space && pseudoCharCode != ' ') {
+    ShortcutKeyCandidate spaceKey(' ', false);
     aCandidates.AppendElement(spaceKey);
   }
 }
 
 void
 WidgetKeyboardEvent::GetAccessKeyCandidates(nsTArray<uint32_t>& aCandidates)
 {
   MOZ_ASSERT(aCandidates.IsEmpty(), "aCandidates must be empty");
 
   // return the lower cased charCode candidates for access keys.
   // the priority of the charCodes are:
   //   0: charCode, 1: unshiftedCharCodes[0], 2: shiftedCharCodes[0]
   //   3: unshiftedCharCodes[1], 4: shiftedCharCodes[1],...
-  if (charCode) {
-    uint32_t ch = charCode;
+  if (mCharCode) {
+    uint32_t ch = mCharCode;
     if (IS_IN_BMP(ch)) {
       ch = ToLowerCase(static_cast<char16_t>(ch));
     }
     aCandidates.AppendElement(ch);
   }
   for (uint32_t i = 0; i < alternativeCharCodes.Length(); ++i) {
     uint32_t ch[2] =
       { alternativeCharCodes[i].mUnshiftedCharCode,
         alternativeCharCodes[i].mShiftedCharCode };
     for (uint32_t j = 0; j < 2; ++j) {
       if (!ch[j]) {
         continue;
       }
       if (IS_IN_BMP(ch[j])) {
         ch[j] = ToLowerCase(static_cast<char16_t>(ch[j]));
       }
-      // Don't append the charCode that was already appended.
+      // Don't append the mCharCode that was already appended.
       if (aCandidates.IndexOf(ch[j]) == aCandidates.NoIndex) {
         aCandidates.AppendElement(ch[j]);
       }
     }
   }
   // Special case for "Space" key.  With some keyboard layouts, "Space" with
   // or without Shift key causes non-ASCII space.  For such keyboard layouts,
   // we should guarantee that the key press works as an ASCII white space key
   // press.  However, if the space key is assigned to a function key, it
   // shouldn't work as a space key.
   if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING &&
-      mCodeNameIndex == CODE_NAME_INDEX_Space &&
-      charCode != static_cast<uint32_t>(' ')) {
-    aCandidates.AppendElement(static_cast<uint32_t>(' '));
+      mCodeNameIndex == CODE_NAME_INDEX_Space && mCharCode != ' ') {
+    aCandidates.AppendElement(' ');
   }
   return;
 }
 
 /* static */ void
 WidgetKeyboardEvent::Shutdown()
 {
   delete sKeyNameIndexHashtable;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2457,34 +2457,34 @@ InitKeyEvent(WidgetKeyboardEvent& event,
     const uint32_t domKeyCode = ConvertAndroidKeyCodeToDOMKeyCode(keyCode);
     const int32_t charCode = unicodeChar ? unicodeChar : baseUnicodeChar;
 
     event.mModifiers = GetModifiers(metaState);
 
     if (event.mMessage == eKeyPress) {
         // Android gives us \n, so filter out some control characters.
         event.isChar = (charCode >= ' ');
-        event.charCode = event.isChar ? charCode : 0;
+        event.mCharCode = event.isChar ? charCode : 0;
         event.mKeyCode = event.isChar ? 0 : domKeyCode;
         event.mPluginEvent.Clear();
 
         // For keypress, if the unicode char already has modifiers applied, we
         // don't specify extra modifiers. If UnicodeChar() != BaseUnicodeChar()
         // it means UnicodeChar() already has modifiers applied.
         // Note that on Android 4.x, Alt modifier isn't set when the key input
         // causes text input even while right Alt key is pressed.  However,
         // this is necessary for Android 2.3 compatibility.
         if (unicodeChar && unicodeChar != baseUnicodeChar) {
             event.mModifiers &= ~(MODIFIER_ALT | MODIFIER_CONTROL
                                                | MODIFIER_META);
         }
 
     } else {
         event.isChar = false;
-        event.charCode = 0;
+        event.mCharCode = 0;
         event.mKeyCode = domKeyCode;
 
         ANPEvent pluginEvent;
         pluginEvent.inSize = sizeof(pluginEvent);
         pluginEvent.eventType = kKey_ANPEventType;
         pluginEvent.data.key.action = event.mMessage == eKeyDown
                 ? kDown_ANPKeyAction : kUp_ANPKeyAction;
         pluginEvent.data.key.nativeCode = keyCode;
--- a/widget/cocoa/TextInputHandler.h
+++ b/widget/cocoa/TextInputHandler.h
@@ -223,17 +223,17 @@ public:
    *                              compute the character to be input from
    *                              characters of aNativeKeyEvent.
    */
   void InitKeyEvent(NSEvent *aNativeKeyEvent, WidgetKeyboardEvent& aKeyEvent,
                     const nsAString *aInsertString = nullptr);
 
   /**
    * WillDispatchKeyboardEvent() computes aKeyEvent.alternativeCharCodes and
-   * recompute aKeyEvent.charCode if it's necessary.
+   * recompute aKeyEvent.mCharCode if it's necessary.
    *
    * @param aNativeKeyEvent       A native key event for which you want to
    *                              dispatch a Gecko key event.
    * @param aInsertString         If caller expects that the event will cause
    *                              a character to be input (say in an editor),
    *                              the caller should set this.  Otherwise,
    *                              if caller sets null to this, this method will
    *                              compute the character to be input from
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -1067,46 +1067,46 @@ TISInputSourceWrapper::WillDispatchKeybo
   }
 
   UInt32 kbType = GetKbdType();
 
   if (MOZ_LOG_TEST(gLog, LogLevel::Info)) {
     nsAutoString chars;
     nsCocoaUtils::GetStringForNSString([aNativeKeyEvent characters], chars);
     NS_ConvertUTF16toUTF8 utf8Chars(chars);
-    char16_t uniChar = static_cast<char16_t>(aKeyEvent.charCode);
+    char16_t uniChar = static_cast<char16_t>(aKeyEvent.mCharCode);
     MOZ_LOG(gLog, LogLevel::Info,
       ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
        "aNativeKeyEvent=%p, [aNativeKeyEvent characters]=\"%s\", "
-       "aKeyEvent={ mMessage=%s, charCode=0x%X(%s) }, kbType=0x%X, "
+       "aKeyEvent={ mMessage=%s, mCharCode=0x%X(%s) }, kbType=0x%X, "
        "IsOpenedIMEMode()=%s",
        this, aNativeKeyEvent, utf8Chars.get(),
-       GetGeckoKeyEventType(aKeyEvent), aKeyEvent.charCode,
+       GetGeckoKeyEventType(aKeyEvent), aKeyEvent.mCharCode,
        uniChar ? NS_ConvertUTF16toUTF8(&uniChar, 1).get() : "",
        kbType, TrueOrFalse(IsOpenedIMEMode())));
   }
 
   nsAutoString insertStringForCharCode;
   ComputeInsertStringForCharCode(aNativeKeyEvent, aKeyEvent, aInsertString,
                                  insertStringForCharCode);
 
-  // The charCode was set from mKeyValue. However, for example, when Ctrl key
+  // The mCharCode was set from mKeyValue. However, for example, when Ctrl key
   // is pressed, its value should indicate an ASCII character for backward
   // compatibility rather than inputting character without the modifiers.
-  // Therefore, we need to modify charCode value here.
+  // Therefore, we need to modify mCharCode value here.
   uint32_t charCode =
     insertStringForCharCode.IsEmpty() ? 0 : insertStringForCharCode[0];
   aKeyEvent.SetCharCode(charCode);
   // this is not a special key  XXX not used in XP
   aKeyEvent.isChar = (aKeyEvent.mMessage == eKeyPress);
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
-     "aKeyEvent.mKeyCode=0x%X, aKeyEvent.charCode=0x%X",
-     this, aKeyEvent.mKeyCode, aKeyEvent.charCode));
+     "aKeyEvent.mKeyCode=0x%X, aKeyEvent.mCharCode=0x%X",
+     this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode));
 
   TISInputSourceWrapper USLayout("com.apple.keylayout.US");
   bool isRomanKeyboardLayout = IsASCIICapable();
 
   UInt32 key = [aNativeKeyEvent keyCode];
 
   // Caps lock and num lock modifier state:
   UInt32 lockState = 0;
@@ -1171,17 +1171,17 @@ TISInputSourceWrapper::WillDispatchKeybo
   // want the character on the second level.  e.g. With a US QWERTY
   // layout, we want "?" when the "/","?" key is pressed with
   // Command+Shift.
 
   // On a German layout, the OS gives us '/' with Cmd+Shift+SS(eszett)
   // even though Cmd+SS is 'SS' and Shift+'SS' is '?'.  This '/' seems
   // like a hack to make the Cmd+"?" event look the same as the Cmd+"?"
   // event on a US keyboard.  The user thinks they are typing Cmd+"?", so
-  // we'll prefer the "?" character, replacing charCode with shiftedChar
+  // we'll prefer the "?" character, replacing mCharCode with shiftedChar
   // when Shift is pressed.  However, in case there is a layout where the
   // character unique to Cmd+Shift is the character that the user expects,
   // we'll send it as an alternative char.
   bool hasCmdShiftOnlyChar =
     cmdedChar != cmdedShiftChar && uncmdedShiftChar != cmdedShiftChar;
   uint32_t originalCmdedShiftChar = cmdedShiftChar;
 
   // If we can make a good guess at the characters that the user would
@@ -2231,22 +2231,22 @@ TextInputHandler::InsertText(NSAttribute
   // the input string.
 
   if (currentKeyEvent) {
     NSEvent* keyEvent = currentKeyEvent->mKeyEvent;
     InitKeyEvent(keyEvent, keypressEvent, &str);
   } else {
     nsCocoaUtils::InitInputEvent(keypressEvent, static_cast<NSEvent*>(nullptr));
     if (keypressEvent.isChar) {
-      keypressEvent.charCode = str.CharAt(0);
+      keypressEvent.mCharCode = str.CharAt(0);
     }
     // Note that insertText is not called only at key pressing.
-    if (!keypressEvent.charCode) {
+    if (!keypressEvent.mCharCode) {
       keypressEvent.mKeyCode =
-        WidgetUtils::ComputeKeyCodeFromChar(keypressEvent.charCode);
+        WidgetUtils::ComputeKeyCodeFromChar(keypressEvent.mCharCode);
     }
   }
 
   // Remove basic modifiers from keypress event because if they are included,
   // nsPlaintextEditor ignores the event.
   keypressEvent.mModifiers &= ~(MODIFIER_CONTROL |
                                 MODIFIER_ALT |
                                 MODIFIER_META);
@@ -4162,17 +4162,17 @@ TextInputHandlerBase::AttachNativeKeyEve
   // Don't try to replace a native event if one already exists.
   // OS X doesn't have an OS modifier, can't make a native event.
   if (aKeyEvent.mNativeKeyEvent || aKeyEvent.mModifiers & MODIFIER_OS) {
     return NS_OK;
   }
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TextInputHandlerBase::AttachNativeKeyEvent, key=0x%X, char=0x%X, "
-     "mod=0x%X", this, aKeyEvent.mKeyCode, aKeyEvent.charCode,
+     "mod=0x%X", this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode,
      aKeyEvent.mModifiers));
 
   NSEventType eventType;
   if (aKeyEvent.mMessage == eKeyUp) {
     eventType = NSKeyUp;
   } else {
     eventType = NSKeyDown;
   }
@@ -4192,19 +4192,19 @@ TextInputHandlerBase::AttachNativeKeyEve
     if (aKeyEvent.mModifiers & sModifierFlagMap[i][0]) {
       modifierFlags |= sModifierFlagMap[i][1];
     }
   }
 
   NSInteger windowNumber = [[mView window] windowNumber];
 
   NSString* characters;
-  if (aKeyEvent.charCode) {
+  if (aKeyEvent.mCharCode) {
     characters = [NSString stringWithCharacters:
-      reinterpret_cast<const unichar*>(&(aKeyEvent.charCode)) length:1];
+      reinterpret_cast<const unichar*>(&(aKeyEvent.mCharCode)) length:1];
   } else {
     uint32_t cocoaCharCode =
       nsCocoaUtils::ConvertGeckoKeyCodeToMacCharCode(aKeyEvent.mKeyCode);
     characters = [NSString stringWithCharacters:
       reinterpret_cast<const unichar*>(&cocoaCharCode) length:1];
   }
 
   aKeyEvent.mNativeKeyEvent =
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -296,22 +296,22 @@ KeyEventDispatcher::PrintableKeyValue() 
 
 nsEventStatus
 KeyEventDispatcher::DispatchKeyEventInternal(EventMessage aEventMessage)
 {
     WidgetKeyboardEvent event(true, aEventMessage, nullptr);
     if (aEventMessage == eKeyPress) {
         // XXX If the charCode is not a printable character, the charCode
         //     should be computed without Ctrl/Alt/Meta modifiers.
-        event.charCode = static_cast<uint32_t>(mChar);
+        event.mCharCode = static_cast<uint32_t>(mChar);
     }
-    if (!event.charCode) {
+    if (!event.mCharCode) {
         event.mKeyCode = mDOMKeyCode;
     }
-    event.isChar = !!event.charCode;
+    event.isChar = !!event.mCharCode;
     event.mIsRepeat = IsRepeat();
     event.mKeyNameIndex = mDOMKeyNameIndex;
     if (mDOMPrintableKeyValue) {
         event.mKeyValue = mDOMPrintableKeyValue;
     }
     event.mCodeNameIndex = mDOMCodeNameIndex;
     event.mModifiers = getDOMModifiers(mData.metaState);
     event.location = mDOMKeyLocation;
--- a/widget/gtk/NativeKeyBindings.cpp
+++ b/widget/gtk/NativeKeyBindings.cpp
@@ -298,32 +298,32 @@ NativeKeyBindings::Execute(const WidgetK
   // settings.
   if (!aEvent.mNativeKeyEvent) {
     // It must be synthesized event or dispatched DOM event from chrome.
     return false;
   }
 
   guint keyval;
 
-  if (aEvent.charCode) {
-    keyval = gdk_unicode_to_keyval(aEvent.charCode);
+  if (aEvent.mCharCode) {
+    keyval = gdk_unicode_to_keyval(aEvent.mCharCode);
   } else {
     keyval =
       static_cast<GdkEventKey*>(aEvent.mNativeKeyEvent)->keyval;
   }
 
   if (ExecuteInternal(aEvent, aCallback, aCallbackData, keyval)) {
     return true;
   }
 
   for (uint32_t i = 0; i < aEvent.alternativeCharCodes.Length(); ++i) {
     uint32_t ch = aEvent.IsShift() ?
       aEvent.alternativeCharCodes[i].mShiftedCharCode :
       aEvent.alternativeCharCodes[i].mUnshiftedCharCode;
-    if (ch && ch != aEvent.charCode) {
+    if (ch && ch != aEvent.mCharCode) {
       keyval = gdk_unicode_to_keyval(ch);
       if (ExecuteInternal(aEvent, aCallback, aCallbackData, keyval)) {
         return true;
       }
     }
   }
 
 /*
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -1332,42 +1332,42 @@ void
 KeymapWrapper::WillDispatchKeyboardEventInternal(WidgetKeyboardEvent& aKeyEvent,
                                                  GdkEventKey* aGdkKeyEvent)
 {
     uint32_t charCode = GetCharCodeFor(aGdkKeyEvent);
     if (!charCode) {
         MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
             ("KeymapWrapper(%p): WillDispatchKeyboardEventInternal, "
              "mKeyCode=0x%02X, charCode=0x%08X",
-             this, aKeyEvent.mKeyCode, aKeyEvent.charCode));
+             this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode));
         return;
     }
 
-    // The charCode was set from mKeyValue. However, for example, when Ctrl key
+    // The mCharCode was set from mKeyValue. However, for example, when Ctrl key
     // is pressed, its value should indicate an ASCII character for backward
     // compatibility rather than inputting character without the modifiers.
-    // Therefore, we need to modify charCode value here.
+    // Therefore, we need to modify mCharCode value here.
     aKeyEvent.SetCharCode(charCode);
 
     gint level = GetKeyLevel(aGdkKeyEvent);
     if (level != 0 && level != 1) {
         MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
             ("KeymapWrapper(%p): WillDispatchKeyboardEventInternal, "
-             "mKeyCode=0x%02X, charCode=0x%08X, level=%d",
-             this, aKeyEvent.mKeyCode, aKeyEvent.charCode, level));
+             "mKeyCode=0x%02X, mCharCode=0x%08X, level=%d",
+             this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode, level));
         return;
     }
 
     guint baseState = aGdkKeyEvent->state &
         ~(GetModifierMask(SHIFT) | GetModifierMask(CTRL) |
           GetModifierMask(ALT) | GetModifierMask(META) |
           GetModifierMask(SUPER) | GetModifierMask(HYPER));
 
     // We shold send both shifted char and unshifted char, all keyboard layout
-    // users can use all keys.  Don't change event.charCode. On some keyboard
+    // users can use all keys.  Don't change event.mCharCode. On some keyboard
     // layouts, Ctrl/Alt/Meta keys are used for inputting some characters.
     AlternativeCharCode altCharCodes(0, 0);
     // unshifted charcode of current keyboard layout.
     altCharCodes.mUnshiftedCharCode =
         GetCharCodeFor(aGdkKeyEvent, baseState, aGdkKeyEvent->group);
     bool isLatin = (altCharCodes.mUnshiftedCharCode <= 0xFF);
     // shifted charcode of current keyboard layout.
     altCharCodes.mShiftedCharCode =
@@ -1386,33 +1386,33 @@ KeymapWrapper::WillDispatchKeyboardEvent
              IS_ASCII_ALPHABETICAL(altCharCodes.mShiftedCharCode));
     }
 
     // If current keyboard layout can input Latin characters, we don't need
     // more information.
     if (!needLatinKeyCodes) {
         MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
             ("KeymapWrapper(%p): WillDispatchKeyboardEventInternal, "
-             "mKeyCode=0x%02X, charCode=0x%08X, level=%d, altCharCodes={ "
+             "mKeyCode=0x%02X, mCharCode=0x%08X, level=%d, altCharCodes={ "
              "mUnshiftedCharCode=0x%08X, mShiftedCharCode=0x%08X }",
-             this, aKeyEvent.mKeyCode, aKeyEvent.charCode, level,
+             this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode, level,
              altCharCodes.mUnshiftedCharCode, altCharCodes.mShiftedCharCode));
         return;
     }
 
     // Next, find Latin inputtable keyboard layout.
     gint minGroup = GetFirstLatinGroup();
     if (minGroup < 0) {
         MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
             ("KeymapWrapper(%p): WillDispatchKeyboardEventInternal, "
              "Latin keyboard layout isn't found: "
-             "mKeyCode=0x%02X, charCode=0x%08X, level=%d, "
+             "mKeyCode=0x%02X, mCharCode=0x%08X, level=%d, "
              "altCharCodes={ mUnshiftedCharCode=0x%08X, "
              "mShiftedCharCode=0x%08X }",
-             this, aKeyEvent.mKeyCode, aKeyEvent.charCode, level,
+             this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode, level,
              altCharCodes.mUnshiftedCharCode, altCharCodes.mShiftedCharCode));
         return;
     }
 
     AlternativeCharCode altLatinCharCodes(0, 0);
     uint32_t unmodifiedCh =
         aKeyEvent.IsShift() ? altCharCodes.mShiftedCharCode :
                               altCharCodes.mUnshiftedCharCode;
@@ -1426,34 +1426,34 @@ KeymapWrapper::WillDispatchKeyboardEvent
                         baseState | GetModifierMask(SHIFT),
                         minGroup);
     altLatinCharCodes.mShiftedCharCode =
         IsBasicLatinLetterOrNumeral(ch) ? ch : 0;
     if (altLatinCharCodes.mUnshiftedCharCode ||
         altLatinCharCodes.mShiftedCharCode) {
         aKeyEvent.alternativeCharCodes.AppendElement(altLatinCharCodes);
     }
-    // If the charCode is not Latin, and the level is 0 or 1, we should
-    // replace the charCode to Latin char if Alt and Meta keys are not
+    // If the mCharCode is not Latin, and the level is 0 or 1, we should
+    // replace the mCharCode to Latin char if Alt and Meta keys are not
     // pressed. (Alt should be sent the localized char for accesskey
     // like handling of Web Applications.)
     ch = aKeyEvent.IsShift() ? altLatinCharCodes.mShiftedCharCode :
                                altLatinCharCodes.mUnshiftedCharCode;
     if (ch && !(aKeyEvent.IsAlt() || aKeyEvent.IsMeta()) &&
         charCode == unmodifiedCh) {
         aKeyEvent.SetCharCode(ch);
     }
 
     MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
         ("KeymapWrapper(%p): WillDispatchKeyboardEventInternal, "
-         "mKeyCode=0x%02X, charCode=0x%08X, level=%d, minGroup=%d, "
+         "mKeyCode=0x%02X, mCharCode=0x%08X, level=%d, minGroup=%d, "
          "altCharCodes={ mUnshiftedCharCode=0x%08X, "
          "mShiftedCharCode=0x%08X } "
          "altLatinCharCodes={ mUnshiftedCharCode=0x%08X, "
          "mShiftedCharCode=0x%08X }",
-         this, aKeyEvent.mKeyCode, aKeyEvent.charCode, level, minGroup,
+         this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode, level, minGroup,
          altCharCodes.mUnshiftedCharCode, altCharCodes.mShiftedCharCode,
          altLatinCharCodes.mUnshiftedCharCode,
          altLatinCharCodes.mShiftedCharCode));
 }
 
 } // namespace widget
 } // namespace mozilla
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -390,17 +390,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam));
     WriteParam(aMsg, static_cast<uint32_t>(aParam.mKeyNameIndex));
     WriteParam(aMsg, static_cast<uint32_t>(aParam.mCodeNameIndex));
     WriteParam(aMsg, aParam.mKeyValue);
     WriteParam(aMsg, aParam.mCodeValue);
     WriteParam(aMsg, aParam.mKeyCode);
-    WriteParam(aMsg, aParam.charCode);
+    WriteParam(aMsg, aParam.mCharCode);
     WriteParam(aMsg, aParam.mPseudoCharCode);
     WriteParam(aMsg, aParam.alternativeCharCodes);
     WriteParam(aMsg, aParam.isChar);
     WriteParam(aMsg, aParam.mIsRepeat);
     WriteParam(aMsg, aParam.mIsReserved);
     WriteParam(aMsg, aParam.mAccessKeyForwardedToChild);
     WriteParam(aMsg, aParam.location);
     WriteParam(aMsg, aParam.mUniqueId);
@@ -426,17 +426,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
       inputMethodAppState = 0;
     if (ReadParam(aMsg, aIter,
                   static_cast<mozilla::WidgetInputEvent*>(aResult)) &&
         ReadParam(aMsg, aIter, &keyNameIndex) &&
         ReadParam(aMsg, aIter, &codeNameIndex) &&
         ReadParam(aMsg, aIter, &aResult->mKeyValue) &&
         ReadParam(aMsg, aIter, &aResult->mCodeValue) &&
         ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
-        ReadParam(aMsg, aIter, &aResult->charCode) &&
+        ReadParam(aMsg, aIter, &aResult->mCharCode) &&
         ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
         ReadParam(aMsg, aIter, &aResult->alternativeCharCodes) &&
         ReadParam(aMsg, aIter, &aResult->isChar) &&
         ReadParam(aMsg, aIter, &aResult->mIsRepeat) &&
         ReadParam(aMsg, aIter, &aResult->mIsReserved) &&
         ReadParam(aMsg, aIter, &aResult->mAccessKeyForwardedToChild) &&
         ReadParam(aMsg, aIter, &aResult->location) &&
         ReadParam(aMsg, aIter, &aResult->mUniqueId) &&
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1122,21 +1122,21 @@ InitKeyEvent(WidgetKeyboardEvent& aEvent
         aQEvent->isAutoRepeat();
     aEvent.mTime = 0;
 
     if (sAltGrModifier) {
         aEvent.mModifiers |= (MODIFIER_CONTROL | MODIFIER_ALT);
     }
 
     if (aQEvent->text().length() && aQEvent->text()[0].isPrint()) {
-        aEvent.charCode = (int32_t) aQEvent->text()[0].unicode();
+        aEvent.mCharCode = static_cast<uint32_t>(aQEvent->text()[0].unicode());
         aEvent.mKeyCode = 0;
         aEvent.mKeyNameIndex = KEY_NAME_INDEX_PrintableKey;
     } else {
-        aEvent.charCode = 0;
+        aEvent.mCharCode = 0;
         aEvent.mKeyCode = QtKeyCodeToDOMKeyCode(aQEvent->key());
         aEvent.mKeyNameIndex = QtKeyCodeToDOMKeyNameIndex(aQEvent->key());
     }
 
     aEvent.mCodeNameIndex = ScanCodeToDOMCodeNameIndex(aQEvent->nativeScanCode());
 
     // The transformations above and in qt for the keyval are not invertible
     // so link to the QKeyEvent (which will vanish soon after return from the
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1684,17 +1684,17 @@ NativeKey::HandleCharMessage(const MSG& 
 
   // First, handle normal text input or non-printable key case here.
   if ((!mModKeyState.IsAlt() && !mModKeyState.IsControl()) ||
       mModKeyState.IsAltGr() ||
       (mOriginalVirtualKeyCode &&
        !KeyboardLayout::IsPrintableCharKey(mOriginalVirtualKeyCode))) {
     WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
     if (!IsControlChar(static_cast<char16_t>(aCharMsg.wParam))) {
-      keypressEvent.charCode = static_cast<uint32_t>(aCharMsg.wParam);
+      keypressEvent.mCharCode = static_cast<uint32_t>(aCharMsg.wParam);
     } else {
       keypressEvent.mKeyCode = mDOMKeyCode;
     }
     nsresult rv = mDispatcher->BeginNativeInputTransaction();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return true;
     }
 
@@ -1761,18 +1761,18 @@ NativeKey::HandleCharMessage(const MSG& 
   }
 
   nsresult rv = mDispatcher->BeginNativeInputTransaction();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return true;
   }
 
   WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
-  keypressEvent.charCode = uniChar;
-  if (!keypressEvent.charCode) {
+  keypressEvent.mCharCode = uniChar;
+  if (!keypressEvent.mCharCode) {
     keypressEvent.mKeyCode = mDOMKeyCode;
   }
   nsEventStatus status = InitKeyEvent(keypressEvent, mModKeyState, &aCharMsg);
   bool dispatched =
     mDispatcher->MaybeDispatchKeypressEvents(keypressEvent, status,
                                              const_cast<NativeKey*>(this));
   if (aEventDispatched) {
     *aEventDispatched = dispatched;
@@ -2255,19 +2255,19 @@ NativeKey::ComputeInputtingStringWithKey
       mUnshiftedLatinChar = 0;
     }
   }
 
   if (!mModKeyState.IsControl()) {
     return;
   }
 
-  // If the charCode is not ASCII character, we should replace the
-  // charCode with ASCII character only when Ctrl is pressed.
-  // But don't replace the charCode when the charCode is not same as
+  // If the mCharCode is not ASCII character, we should replace the
+  // mCharCode with ASCII character only when Ctrl is pressed.
+  // But don't replace the mCharCode when the mCharCode is not same as
   // unmodified characters. In such case, Ctrl is sometimes used for a
   // part of character inputting key combination like Shift.
   uint32_t ch =
     mModKeyState.IsShift() ? mShiftedLatinChar : mUnshiftedLatinChar;
   if (!ch) {
     return;
   }
   if (mInputtingStringAndModifiers.IsEmpty() ||
@@ -2334,20 +2334,20 @@ NativeKey::WillDispatchKeyboardEvent(Wid
                         MODIFIER_ALTGRAPH | MODIFIER_CAPSLOCK);
       modKeyState.Set(
         mInputtingStringAndModifiers.mModifiers[aIndex - skipUniChars]);
       modKeyState.InitInputEvent(aKeyboardEvent);
     }
     uint16_t uniChar =
       mInputtingStringAndModifiers.mChars[aIndex - skipUniChars];
 
-    // The charCode was set from mKeyValue. However, for example, when Ctrl key
+    // The mCharCode was set from mKeyValue. However, for example, when Ctrl key
     // is pressed, its value should indicate an ASCII character for backward
     // compatibility rather than inputting character without the modifiers.
-    // Therefore, we need to modify charCode value here.
+    // Therefore, we need to modify mCharCode value here.
     aKeyboardEvent.SetCharCode(uniChar);
   }
 
   if (skipShiftedChars <= aIndex) {
     shiftedChar = mShiftedString.mChars[aIndex - skipShiftedChars];
   }
   if (skipUnshiftedChars <= aIndex) {
     unshiftedChar = mUnshiftedString.mChars[aIndex - skipUnshiftedChars];