Bug 1254755 part.3 Rename WidgetKeyboardEvent::alternativeCharCodes to WidgetKeyboardEvent::mAlternativeCharCodes r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 12 May 2016 17:57:21 +0900
changeset 367293 c0242329a862c78c86842a1c0cbcc7b9a9a770b1
parent 367292 db6c018b92431167c87bdbed372810c849976a59
child 367294 be42b431f18af58f26062f401ddf4b843f700895
push id18190
push usermasayuki@d-toybox.com
push dateMon, 16 May 2016 08:16:10 +0000
reviewerssmaug
bugs1254755
milestone49.0a1
Bug 1254755 part.3 Rename WidgetKeyboardEvent::alternativeCharCodes to WidgetKeyboardEvent::mAlternativeCharCodes r?smaug MozReview-Commit-ID: 26K8ZxzavfB
widget/TextEventDispatcher.cpp
widget/TextEvents.h
widget/WidgetEventImpl.cpp
widget/cocoa/TextInputHandler.h
widget/cocoa/TextInputHandler.mm
widget/gtk/NativeKeyBindings.cpp
widget/gtk/nsGtkKeyUtils.cpp
widget/nsGUIEventIPC.h
widget/windows/KeyboardLayout.cpp
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -493,17 +493,17 @@ TextEventDispatcher::DispatchKeyboardEve
     keyEvent.mPluginEvent.Clear();
   }
   // TODO: Manage mUniqueId here.
 
   // Request the alternative char codes for the key event.
   // eKeyDown also needs alternative char codes because nsXBLWindowKeyHandler
   // needs to check if a following keypress event is reserved by chrome for
   // stopping propagation of its preceding keydown event.
-  keyEvent.alternativeCharCodes.Clear();
+  keyEvent.mAlternativeCharCodes.Clear();
   if ((WidgetKeyboardEvent::IsKeyDownOrKeyDownOnPlugin(aMessage) ||
        aMessage == eKeyPress) &&
       (keyEvent.IsControl() || keyEvent.IsAlt() ||
        keyEvent.IsMeta() || keyEvent.IsOS())) {
     nsCOMPtr<TextEventDispatcherListener> listener =
       do_QueryReferent(mListener);
     if (listener) {
       DebugOnly<WidgetKeyboardEvent> original(keyEvent);
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -204,17 +204,17 @@ public:
   // 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_*
   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;
+  nsTArray<AlternativeCharCode> mAlternativeCharCodes;
   // Indicates whether the event signifies a printable character
   bool isChar;
   // Indicates whether the event is generated by auto repeat or not.
   // if this is keyup event, always false.
   bool mIsRepeat;
   // Indicates whether the event is generated during IME (or deadkey)
   // composition.  This is initialized by EventStateManager.  So, key event
   // dispatchers don't need to initialize this.
@@ -371,17 +371,17 @@ public:
   void AssignKeyEventData(const WidgetKeyboardEvent& aEvent, bool aCopyTargets)
   {
     AssignInputEventData(aEvent, aCopyTargets);
 
     mKeyCode = aEvent.mKeyCode;
     mCharCode = aEvent.mCharCode;
     mPseudoCharCode = aEvent.mPseudoCharCode;
     location = aEvent.location;
-    alternativeCharCodes = aEvent.alternativeCharCodes;
+    mAlternativeCharCodes = aEvent.mAlternativeCharCodes;
     isChar = aEvent.isChar;
     mIsRepeat = aEvent.mIsRepeat;
     mIsComposing = aEvent.mIsComposing;
     mIsReserved = aEvent.mIsReserved;
     mAccessKeyForwardedToChild = aEvent.mAccessKeyForwardedToChild;
     mKeyNameIndex = aEvent.mKeyNameIndex;
     mCodeNameIndex = aEvent.mCodeNameIndex;
     mKeyValue = aEvent.mKeyValue;
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -498,58 +498,58 @@ WidgetKeyboardEvent::GetShortcutKeyCandi
   //   1: shiftedCharCodes[0]/false, 2: shiftedCharCodes[0]/true,
   //   3: shiftedCharCodes[1]/false, 4: shiftedCharCodes[1]/true...
   uint32_t pseudoCharCode = PseudoCharCode();
   if (pseudoCharCode) {
     ShortcutKeyCandidate key(pseudoCharCode, false);
     aCandidates.AppendElement(key);
   }
 
-  uint32_t len = alternativeCharCodes.Length();
+  uint32_t len = mAlternativeCharCodes.Length();
   if (!IsShift()) {
     for (uint32_t i = 0; i < len; ++i) {
-      uint32_t ch = alternativeCharCodes[i].mUnshiftedCharCode;
+      uint32_t ch = mAlternativeCharCodes[i].mUnshiftedCharCode;
       if (!ch || ch == pseudoCharCode) {
         continue;
       }
       ShortcutKeyCandidate key(ch, false);
       aCandidates.AppendElement(key);
     }
     // If unshiftedCharCodes doesn't have numeric but shiftedCharCode has it,
     // this keyboard layout is AZERTY or similar layout, probably.
     // In this case, Accel+[0-9] should be accessible without shift key.
     // However, the priority should be lowest.
     if (!HasASCIIDigit(aCandidates)) {
       for (uint32_t i = 0; i < len; ++i) {
-        uint32_t ch = alternativeCharCodes[i].mShiftedCharCode;
+        uint32_t ch = mAlternativeCharCodes[i].mShiftedCharCode;
         if (ch >= '0' && ch <= '9') {
           ShortcutKeyCandidate key(ch, false);
           aCandidates.AppendElement(key);
           break;
         }
       }
     }
   } else {
     for (uint32_t i = 0; i < len; ++i) {
-      uint32_t ch = alternativeCharCodes[i].mShiftedCharCode;
+      uint32_t ch = mAlternativeCharCodes[i].mShiftedCharCode;
       if (!ch) {
         continue;
       }
 
       if (ch != pseudoCharCode) {
         ShortcutKeyCandidate key(ch, false);
         aCandidates.AppendElement(key);
       }
 
       // If the char is an alphabet, the shift key state should not be
       // ignored. E.g., Ctrl+Shift+C should not execute Ctrl+C.
 
       // And checking the charCode is same as unshiftedCharCode too.
       // E.g., for Ctrl+Shift+(Plus of Numpad) should not run Ctrl+Plus.
-      uint32_t unshiftCh = alternativeCharCodes[i].mUnshiftedCharCode;
+      uint32_t unshiftCh = mAlternativeCharCodes[i].mUnshiftedCharCode;
       if (CharsCaseInsensitiveEqual(ch, unshiftCh)) {
         continue;
       }
 
       // On the Hebrew keyboard layout on Windows, the unshifted char is a
       // localized character but the shifted char is a Latin alphabet,
       // then, we should not execute without the shift state. See bug 433192.
       if (IsCaseChangeableChar(ch)) {
@@ -586,20 +586,20 @@ WidgetKeyboardEvent::GetAccessKeyCandida
   //   3: unshiftedCharCodes[1], 4: shiftedCharCodes[1],...
   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) {
+  for (uint32_t i = 0; i < mAlternativeCharCodes.Length(); ++i) {
     uint32_t ch[2] =
-      { alternativeCharCodes[i].mUnshiftedCharCode,
-        alternativeCharCodes[i].mShiftedCharCode };
+      { mAlternativeCharCodes[i].mUnshiftedCharCode,
+        mAlternativeCharCodes[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 mCharCode that was already appended.
--- a/widget/cocoa/TextInputHandler.h
+++ b/widget/cocoa/TextInputHandler.h
@@ -222,17 +222,17 @@ public:
    *                              if caller sets null to this, this method will
    *                              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
+   * WillDispatchKeyboardEvent() computes aKeyEvent.mAlternativeCharCodes and
    * 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
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -1152,17 +1152,17 @@ TISInputSourceWrapper::WillDispatchKeybo
 
   // If the current keyboard is not Dvorak-QWERTY or Cmd is not pressed,
   // we should append unshiftedChar and shiftedChar for handling the
   // normal characters.  These are the characters that the user is most
   // likely to associate with this key.
   if ((unshiftedChar || shiftedChar) &&
       (!aKeyEvent.IsMeta() || !isDvorakQWERTY)) {
     AlternativeCharCode altCharCodes(unshiftedChar, shiftedChar);
-    aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes);
+    aKeyEvent.mAlternativeCharCodes.AppendElement(altCharCodes);
   }
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
      "aKeyEvent.isMeta=%s, isDvorakQWERTY=%s, "
      "unshiftedChar=U+%X, shiftedChar=U+%X",
      this, OnOrOff(aKeyEvent.IsMeta()), TrueOrFalse(isDvorakQWERTY),
      unshiftedChar, shiftedChar));
 
@@ -1214,29 +1214,29 @@ TISInputSourceWrapper::WillDispatchKeybo
   // we should append cmdedChar and shiftedCmdChar that are
   // Latin char for the key.
   // If the keyboard layout is Dvorak-QWERTY, we should append them only when
   // command key is pressed because when command key isn't pressed, uncmded
   // chars have been appended already.
   if ((cmdedChar || cmdedShiftChar) && isCmdSwitchLayout &&
       (aKeyEvent.IsMeta() || !isDvorakQWERTY)) {
     AlternativeCharCode altCharCodes(cmdedChar, cmdedShiftChar);
-    aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes);
+    aKeyEvent.mAlternativeCharCodes.AppendElement(altCharCodes);
   }
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
      "hasCmdShiftOnlyChar=%s, isCmdSwitchLayout=%s, isDvorakQWERTY=%s, "
      "cmdedChar=U+%X, cmdedShiftChar=U+%X",
      this, TrueOrFalse(hasCmdShiftOnlyChar), TrueOrFalse(isDvorakQWERTY),
      TrueOrFalse(isDvorakQWERTY), cmdedChar, cmdedShiftChar));
   // Special case for 'SS' key of German layout. See the comment of
   // hasCmdShiftOnlyChar definition for the detail.
   if (hasCmdShiftOnlyChar && originalCmdedShiftChar) {
     AlternativeCharCode altCharCodes(0, originalCmdedShiftChar);
-    aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes);
+    aKeyEvent.mAlternativeCharCodes.AppendElement(altCharCodes);
   }
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
      "hasCmdShiftOnlyChar=%s, originalCmdedShiftChar=U+%X",
      this, TrueOrFalse(hasCmdShiftOnlyChar), originalCmdedShiftChar));
 
   NS_OBJC_END_TRY_ABORT_BLOCK
 }
--- a/widget/gtk/NativeKeyBindings.cpp
+++ b/widget/gtk/NativeKeyBindings.cpp
@@ -309,20 +309,20 @@ NativeKeyBindings::Execute(const WidgetK
     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) {
+  for (uint32_t i = 0; i < aEvent.mAlternativeCharCodes.Length(); ++i) {
     uint32_t ch = aEvent.IsShift() ?
-      aEvent.alternativeCharCodes[i].mShiftedCharCode :
-      aEvent.alternativeCharCodes[i].mUnshiftedCharCode;
+      aEvent.mAlternativeCharCodes[i].mShiftedCharCode :
+      aEvent.mAlternativeCharCodes[i].mUnshiftedCharCode;
     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
@@ -1371,17 +1371,17 @@ KeymapWrapper::WillDispatchKeyboardEvent
     bool isLatin = (altCharCodes.mUnshiftedCharCode <= 0xFF);
     // shifted charcode of current keyboard layout.
     altCharCodes.mShiftedCharCode =
         GetCharCodeFor(aGdkKeyEvent,
                        baseState | GetModifierMask(SHIFT),
                        aGdkKeyEvent->group);
     isLatin = isLatin && (altCharCodes.mShiftedCharCode <= 0xFF);
     if (altCharCodes.mUnshiftedCharCode || altCharCodes.mShiftedCharCode) {
-        aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes);
+        aKeyEvent.mAlternativeCharCodes.AppendElement(altCharCodes);
     }
 
     bool needLatinKeyCodes = !isLatin;
     if (!needLatinKeyCodes) {
         needLatinKeyCodes = 
             (IS_ASCII_ALPHABETICAL(altCharCodes.mUnshiftedCharCode) !=
              IS_ASCII_ALPHABETICAL(altCharCodes.mShiftedCharCode));
     }
@@ -1424,17 +1424,17 @@ KeymapWrapper::WillDispatchKeyboardEvent
     // shifted charcode of found keyboard layout.
     ch = GetCharCodeFor(aGdkKeyEvent,
                         baseState | GetModifierMask(SHIFT),
                         minGroup);
     altLatinCharCodes.mShiftedCharCode =
         IsBasicLatinLetterOrNumeral(ch) ? ch : 0;
     if (altLatinCharCodes.mUnshiftedCharCode ||
         altLatinCharCodes.mShiftedCharCode) {
-        aKeyEvent.alternativeCharCodes.AppendElement(altLatinCharCodes);
+        aKeyEvent.mAlternativeCharCodes.AppendElement(altLatinCharCodes);
     }
     // 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()) &&
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -392,17 +392,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
     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.mCharCode);
     WriteParam(aMsg, aParam.mPseudoCharCode);
-    WriteParam(aMsg, aParam.alternativeCharCodes);
+    WriteParam(aMsg, aParam.mAlternativeCharCodes);
     WriteParam(aMsg, aParam.isChar);
     WriteParam(aMsg, aParam.mIsRepeat);
     WriteParam(aMsg, aParam.mIsReserved);
     WriteParam(aMsg, aParam.mAccessKeyForwardedToChild);
     WriteParam(aMsg, aParam.location);
     WriteParam(aMsg, aParam.mUniqueId);
     WriteParam(aMsg, aParam.mIsSynthesizedByTIP);
     WriteParam(aMsg,
@@ -428,17 +428,17 @@ struct ParamTraits<mozilla::WidgetKeyboa
                   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->mCharCode) &&
         ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
-        ReadParam(aMsg, aIter, &aResult->alternativeCharCodes) &&
+        ReadParam(aMsg, aIter, &aResult->mAlternativeCharCodes) &&
         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) &&
         ReadParam(aMsg, aIter, &aResult->mIsSynthesizedByTIP) &&
         ReadParam(aMsg, aIter, &inputMethodAppState)
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -890,17 +890,17 @@ NativeKey::NativeKey(nsWindowBase* aWidg
   mIsDeadKey =
     (IsFollowedByDeadCharMessage() ||
      keyboardLayout->IsDeadKey(mOriginalVirtualKeyCode, mModKeyState));
   mIsPrintableKey = KeyboardLayout::IsPrintableCharKey(mOriginalVirtualKeyCode);
 
   if (IsKeyDownMessage()) {
     // Compute some strings which may be inputted by the key with various
     // modifier state if this key event won't cause text input actually.
-    // They will be used for setting alternativeCharCodes in the callback
+    // They will be used for setting mAlternativeCharCodes in the callback
     // method which will be called by TextEventDispatcher.
     if (NeedsToHandleWithoutFollowingCharMessages()) {
       ComputeInputtingStringWithKeyboardLayout();
     } else {
       // This message might be sent by SendInput() API to input a Unicode
       // character, in such case, we can only know what char will be inputted
       // with following WM_CHAR message.
       // TODO: We cannot initialize mCommittedCharsAndModifiers for VK_PACKET
@@ -2309,17 +2309,18 @@ NativeKey::WillDispatchKeyboardEvent(Wid
              std::max(mShiftedString.mLength, mUnshiftedString.mLength));
   uint32_t skipUniChars = longestLength - mInputtingStringAndModifiers.mLength;
   uint32_t skipShiftedChars = longestLength - mShiftedString.mLength;
   uint32_t skipUnshiftedChars = longestLength - mUnshiftedString.mLength;
   if (aIndex >= longestLength) {
     return;
   }
 
-  nsTArray<AlternativeCharCode>& altArray = aKeyboardEvent.alternativeCharCodes;
+  nsTArray<AlternativeCharCode>& altArray =
+    aKeyboardEvent.mAlternativeCharCodes;
 
   uint16_t shiftedChar = 0, unshiftedChar = 0;
   if (skipUniChars <= aIndex) {
     // XXX Modifying modifier state of aKeyboardEvent is illegal, but no way
     //     to set different modifier state per keypress event except this
     //     hack.  Note that ideally, dead key should cause composition events
     //     instead of keypress events, though.
     if (aIndex - skipUniChars  < mInputtingStringAndModifiers.mLength) {