Bug 938987 Use 'Dead' key value for all dead keys r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 30 Dec 2014 10:47:54 +0900
changeset 238350 0371226486c07ac2c54773bf1c742c2dcd6264f5
parent 238349 e5860aab53a5fe1bec8fa29c6cccdf4fbe096d0a
child 238351 f6205ad77a3c08ec7f3ba033f4e5595d34172aab
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs938987
milestone37.0a1
Bug 938987 Use 'Dead' key value for all dead keys r=smaug
dom/events/KeyNameList.h
widget/NativeKeyToDOMKeyName.h
widget/SharedWidgetUtils.cpp
widget/WidgetUtils.h
widget/qt/nsQtKeyUtils.cpp
widget/windows/KeyboardLayout.cpp
--- a/dom/events/KeyNameList.h
+++ b/dom/events/KeyNameList.h
@@ -121,17 +121,17 @@ DEFINE_KEYNAME_WITH_SAME_NAME(PrintScree
 /******************************************************************************
  * IME and Composition Keys
  *****************************************************************************/
 DEFINE_KEYNAME_WITH_SAME_NAME(AllCandidates)
 DEFINE_KEYNAME_WITH_SAME_NAME(Alphanumeric)
 DEFINE_KEYNAME_WITH_SAME_NAME(CodeInput)
 DEFINE_KEYNAME_WITH_SAME_NAME(Compose)
 DEFINE_KEYNAME_WITH_SAME_NAME(Convert)
-// DEFINE_KEYNAME_WITH_SAME_NAME(Dead)
+DEFINE_KEYNAME_WITH_SAME_NAME(Dead)
 DEFINE_KEYNAME_WITH_SAME_NAME(FinalMode)
 // DEFINE_KEYNAME_WITH_SAME_NAME(GroupFirst)
 // DEFINE_KEYNAME_WITH_SAME_NAME(GroupLast)
 // DEFINE_KEYNAME_WITH_SAME_NAME(GroupNext)
 // DEFINE_KEYNAME_WITH_SAME_NAME(GroupPrevious)
 DEFINE_KEYNAME_WITH_SAME_NAME(ModeChange)
 // DEFINE_KEYNAME_WITH_SAME_NAME(NextCandidate)
 DEFINE_KEYNAME_WITH_SAME_NAME(NonConvert)
@@ -346,30 +346,10 @@ DEFINE_KEYNAME_WITH_SAME_NAME(Subtitle)
 // DEFINE_KEYNAME_WITH_SAME_NAME(Teletext)
 // DEFINE_KEYNAME_WITH_SAME_NAME(TV)
 // DEFINE_KEYNAME_WITH_SAME_NAME(TVInput)
 // DEFINE_KEYNAME_WITH_SAME_NAME(TVPower)
 // DEFINE_KEYNAME_WITH_SAME_NAME(VideoModeNext)
 // DEFINE_KEYNAME_WITH_SAME_NAME(Wink)
 DEFINE_KEYNAME_WITH_SAME_NAME(ZoomToggle)
 
-/******************************************************************************
- * Deprecated
- ******************************************************************************/
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadGrave)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadAcute)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadCircumflex)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadTilde)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadMacron)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadBreve)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadAboveDot)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadUmlaut)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadAboveRing)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadDoubleacute)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadCaron)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadCedilla)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadOgonek)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadIota)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadVoicedSound)
-DEFINE_KEYNAME_WITH_SAME_NAME(DeadSemivoicedSound)
-
 #undef DEFINE_KEYNAME_WITH_SAME_NAME
 #undef DEFINE_KEYNAME_INTERNAL
--- a/widget/NativeKeyToDOMKeyName.h
+++ b/widget/NativeKeyToDOMKeyName.h
@@ -441,16 +441,82 @@ KEY_MAP_GTK     (Compose, GDK_Multi_key)
 KEY_MAP_QT      (Compose, Qt::Key_Multi_key)
 
 // Convert
 KEY_MAP_WIN     (Convert, VK_CONVERT)
 KEY_MAP_GTK     (Convert, GDK_Henkan)
 KEY_MAP_QT      (Convert, Qt::Key_Henkan)
 KEY_MAP_ANDROID (Convert, AKEYCODE_HENKAN)
 
+// Dead
+KEY_MAP_GTK     (Dead, GDK_dead_grave)
+KEY_MAP_GTK     (Dead, GDK_dead_acute)
+KEY_MAP_GTK     (Dead, GDK_dead_circumflex)
+KEY_MAP_GTK     (Dead, GDK_dead_tilde) // Same as GDK_dead_perispomeni
+KEY_MAP_GTK     (Dead, GDK_dead_macron)
+KEY_MAP_GTK     (Dead, GDK_dead_breve)
+KEY_MAP_GTK     (Dead, GDK_dead_abovedot)
+KEY_MAP_GTK     (Dead, GDK_dead_diaeresis)
+KEY_MAP_GTK     (Dead, GDK_dead_abovering)
+KEY_MAP_GTK     (Dead, GDK_dead_doubleacute)
+KEY_MAP_GTK     (Dead, GDK_dead_caron)
+KEY_MAP_GTK     (Dead, GDK_dead_cedilla)
+KEY_MAP_GTK     (Dead, GDK_dead_ogonek)
+KEY_MAP_GTK     (Dead, GDK_dead_iota)
+KEY_MAP_GTK     (Dead, GDK_dead_voiced_sound)
+KEY_MAP_GTK     (Dead, GDK_dead_semivoiced_sound)
+KEY_MAP_GTK     (Dead, GDK_dead_belowdot)
+KEY_MAP_GTK     (Dead, GDK_dead_hook)
+KEY_MAP_GTK     (Dead, GDK_dead_horn)
+KEY_MAP_GTK     (Dead, GDK_dead_stroke)
+KEY_MAP_GTK     (Dead, GDK_dead_abovecomma) // Same as GDK_dead_psili
+KEY_MAP_GTK     (Dead, GDK_dead_abovereversedcomma) // Same as GDK_dead_dasia
+KEY_MAP_GTK     (Dead, GDK_dead_doublegrave)
+KEY_MAP_GTK     (Dead, GDK_dead_belowring)
+KEY_MAP_GTK     (Dead, GDK_dead_belowmacron)
+KEY_MAP_GTK     (Dead, GDK_dead_belowcircumflex)
+KEY_MAP_GTK     (Dead, GDK_dead_belowtilde)
+KEY_MAP_GTK     (Dead, GDK_dead_belowbreve)
+KEY_MAP_GTK     (Dead, GDK_dead_belowdiaeresis)
+KEY_MAP_GTK     (Dead, GDK_dead_invertedbreve)
+KEY_MAP_GTK     (Dead, GDK_dead_belowcomma)
+KEY_MAP_GTK     (Dead, GDK_dead_currency)
+KEY_MAP_GTK     (Dead, GDK_dead_a)
+KEY_MAP_GTK     (Dead, GDK_dead_A)
+KEY_MAP_GTK     (Dead, GDK_dead_e)
+KEY_MAP_GTK     (Dead, GDK_dead_E)
+KEY_MAP_GTK     (Dead, GDK_dead_i)
+KEY_MAP_GTK     (Dead, GDK_dead_I)
+KEY_MAP_GTK     (Dead, GDK_dead_o)
+KEY_MAP_GTK     (Dead, GDK_dead_O)
+KEY_MAP_GTK     (Dead, GDK_dead_u)
+KEY_MAP_GTK     (Dead, GDK_dead_U)
+KEY_MAP_GTK     (Dead, GDK_dead_small_schwa)
+KEY_MAP_GTK     (Dead, GDK_dead_capital_schwa)
+KEY_MAP_GTK     (Dead, GDK_dead_greek)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Grave)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Acute)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Circumflex)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Tilde)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Macron)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Breve)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Abovedot)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Diaeresis)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Abovering)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Doubleacute)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Caron)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Cedilla)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Ogonek)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Iota)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Voiced_Sound)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Semivoiced_Sound)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Belowdot)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Hook)
+KEY_MAP_QT      (Dead, Qt::Key_Dead_Horn)
+
 // FinalMode
 KEY_MAP_WIN     (FinalMode, VK_FINAL)
 
 // ModeChange
 KEY_MAP_WIN     (ModeChange, VK_MODECHANGE)
 KEY_MAP_ANDROID (ModeChange, AKEYCODE_SWITCH_CHARSET)
 
 // NonConvert
@@ -993,83 +1059,16 @@ KEY_MAP_ANDROID (Settings, AKEYCODE_SETT
 KEY_MAP_GTK     (Subtitle, GDK_Subtitle)
 KEY_MAP_QT      (Subtitle, Qt::Key_Subtitle)
 KEY_MAP_ANDROID (Subtitle, AKEYCODE_CAPTIONS)
 
 // ZoomToggle
 KEY_MAP_WIN     (ZoomToggle, VK_ZOOM)
 KEY_MAP_QT      (ZoomToggle, Qt::Key_Zoom)
 
-/******************************************************************************
- * Deprecated
- ******************************************************************************/
-// DeadGrave
-KEY_MAP_GTK     (DeadGrave, GDK_dead_grave)
-KEY_MAP_QT      (DeadGrave, Qt::Key_Dead_Grave)
-
-// DeadAcute
-KEY_MAP_GTK     (DeadAcute, GDK_dead_acute)
-KEY_MAP_QT      (DeadAcute, Qt::Key_Dead_Acute)
-
-// DeadCircumflex
-KEY_MAP_GTK     (DeadCircumflex, GDK_dead_circumflex)
-KEY_MAP_QT      (DeadCircumflex, Qt::Key_Dead_Circumflex)
-
-// DeadTilde
-KEY_MAP_GTK     (DeadTilde, GDK_dead_tilde)
-KEY_MAP_QT      (DeadTilde, Qt::Key_Dead_Tilde)
-
-// DeadMacron
-KEY_MAP_GTK     (DeadMacron, GDK_dead_macron)
-KEY_MAP_QT      (DeadMacron, Qt::Key_Dead_Macron)
-
-// DeadBreve
-KEY_MAP_GTK     (DeadBreve, GDK_dead_breve)
-KEY_MAP_QT      (DeadBreve, Qt::Key_Dead_Breve)
-
-// DeadAboveDot
-KEY_MAP_GTK     (DeadAboveDot, GDK_dead_abovedot)
-KEY_MAP_QT      (DeadAboveDot, Qt::Key_Dead_Abovedot)
-
-// DeadUmlaut
-KEY_MAP_GTK     (DeadUmlaut, GDK_dead_diaeresis)
-KEY_MAP_QT      (DeadUmlaut, Qt::Key_Dead_Diaeresis)
-
-// DeadAboveRing
-KEY_MAP_GTK     (DeadAboveRing, GDK_dead_abovering)
-KEY_MAP_QT      (DeadAboveRing, Qt::Key_Dead_Abovering)
-
-// DeadDoubleacute
-KEY_MAP_GTK     (DeadDoubleacute, GDK_dead_doubleacute)
-KEY_MAP_QT      (DeadDoubleacute, Qt::Key_Dead_Doubleacute)
-
-// DeadCaron
-KEY_MAP_GTK     (DeadCaron, GDK_dead_caron)
-KEY_MAP_QT      (DeadCaron, Qt::Key_Dead_Caron)
-
-// DeadCedilla
-KEY_MAP_GTK     (DeadCedilla, GDK_dead_cedilla)
-KEY_MAP_QT      (DeadCedilla, Qt::Key_Dead_Cedilla)
-
-// DeadOgonek
-KEY_MAP_GTK     (DeadOgonek, GDK_dead_ogonek)
-KEY_MAP_QT      (DeadOgonek, Qt::Key_Dead_Ogonek)
-
-// DeadIota
-KEY_MAP_GTK     (DeadIota, GDK_dead_iota)
-KEY_MAP_QT      (DeadIota, Qt::Key_Dead_Iota)
-
-// DeadVoicedSound
-KEY_MAP_GTK     (DeadVoicedSound, GDK_dead_voiced_sound)
-KEY_MAP_QT      (DeadVoicedSound, Qt::Key_Dead_Voiced_Sound)
-
-// DeadSemivoicedSound
-KEY_MAP_GTK     (DeadSemivoicedSound, GDK_dead_semivoiced_sound)
-KEY_MAP_QT      (DeadSemivoicedSound, Qt::Key_Dead_Semivoiced_Sound)
-
 #undef KEY_MAP_WIN
 #undef KEY_MAP_WIN_JPN
 #undef KEY_MAP_WIN_KOR
 #undef KEY_MAP_WIN_OTH
 #undef KEY_MAP_COCOA
 #undef KEY_MAP_GTK
 #undef KEY_MAP_QT
 #undef KEY_MAP_ANDROID
--- a/widget/SharedWidgetUtils.cpp
+++ b/widget/SharedWidgetUtils.cpp
@@ -161,81 +161,10 @@ WidgetUtils::GetLatinCharCodeForKeyCode(
     case NS_VK_OPEN_BRACKET:        *aUnshiftedCharCode = '['; break;
     case NS_VK_BACK_SLASH:          *aUnshiftedCharCode = '\\'; break;
     case NS_VK_CLOSE_BRACKET:       *aUnshiftedCharCode = ']'; break;
     case NS_VK_QUOTE:               *aUnshiftedCharCode = '\''; break;
     default:                        *aUnshiftedCharCode = 0; break;
   }
 }
 
-// static
-KeyNameIndex
-WidgetUtils::GetDeadKeyNameIndex(char16_t aChar)
-{
-  switch (aChar) {
-    case '`':
-    case 0x02CB: // MODIFIER LETTER GRAVE ACCENT
-    case 0x0300: // COMBINING GRAVE ACCENT
-      return KEY_NAME_INDEX_DeadGrave;
-    case '\'':
-    case 0x00B4: // ACUTE ACCENT
-    case 0x02B9: // MODIFIER LETTER PRIME
-    case 0x02CA: // MODIFIER LETTER ACUTE ACCENT
-    case 0x0301: // COMBINING ACUTE ACCENT
-    case 0x0384: // GREEK TONOS
-      return KEY_NAME_INDEX_DeadAcute;
-    case '^':
-    case 0x02C6: // MODIFIER LETTER CIRCUMFLEX ACCENT
-    case 0x0302: // COMBINING CIRCUMFLEX ACCENT
-      return KEY_NAME_INDEX_DeadCircumflex;
-    case '~':
-    case 0x02DC: // SMALL TILDE
-    case 0x0303: // COMBINING TILDE
-      return KEY_NAME_INDEX_DeadTilde;
-    case 0x00AF: // MACRON
-    case 0x02C9: // MODIFIER LETTER MACRON
-    case 0x0304: // COMBINING MACRON
-      return KEY_NAME_INDEX_DeadMacron;
-    case 0x02D8: // BRAVE
-    case 0xA67C: // COMBINING CYRILLIC KAVYKA
-    case 0x0306: // COMBINING BRAVE
-      return KEY_NAME_INDEX_DeadBreve;
-    case 0x02D9: // DOT ABOVE
-    case 0x0307: // COMBINING DOT ABOVE
-      return KEY_NAME_INDEX_DeadAboveDot;
-    case 0x00A8: // DIAERESIS
-    case 0x0308: // COMBINING DIAERESIS
-      return KEY_NAME_INDEX_DeadUmlaut;
-    case 0x00B0: // DEGREE SIGN
-    case 0x02DA: // RING ABOVE
-    case 0x030A: // COMBINING RING ABOVE
-      return KEY_NAME_INDEX_DeadAboveRing;
-    case '"':
-    case 0x02BA: // MODIFIER LETTER DOUBLE PRIME
-    case 0x02DD: // DOUBLE ACUTE ACCENT
-    case 0x030B: // COMBINING DOUBLE ACUTE ACCENT
-      return KEY_NAME_INDEX_DeadDoubleacute;
-    case 0x02C7: // CARON
-    case 0x030C: // COMBINING CARON
-      return KEY_NAME_INDEX_DeadCaron;
-    case 0x00B8: // CEDILLA
-    case 0x0327: // COMBINING CEDILLA
-      return KEY_NAME_INDEX_DeadCedilla;
-    case 0x02DB: // OGONEK
-    case 0x0328: // COMBINING OGONEK
-      return KEY_NAME_INDEX_DeadOgonek;
-    case 0x0345: // COMBINING GREEK YPOGEGRAMMENI
-    case 0x037A: // GREEK YPOGEGRAMMENI
-    case 0x0399: // GREEK CAPITAL LETTER IOTA
-      return KEY_NAME_INDEX_DeadIota;
-    case 0x3099: // COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
-    case 0x309B: // KATAKANA-HIRAGANA VOICED SOUND MARK
-      return KEY_NAME_INDEX_DeadVoicedSound;
-    case 0x309A: // COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
-    case 0x309C: // KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
-      return KEY_NAME_INDEX_DeadSemivoicedSound;
-    default:
-      return KEY_NAME_INDEX_Unidentified;
-  }
-}
-
 } // namespace widget
 } // namespace mozilla
--- a/widget/WidgetUtils.h
+++ b/widget/WidgetUtils.h
@@ -70,22 +70,14 @@ public:
    *                            This is always 0 when aKeyCode isn't
    *                            NS_VK_[A-Z].
    *                            Note that must not be nullptr.
    */
   static void GetLatinCharCodeForKeyCode(uint32_t aKeyCode,
                                          bool aIsCapsLock,
                                          uint32_t* aUnshiftedCharCode,
                                          uint32_t* aShiftedCharCode);
-
-  /**
-   * GetDeadKeyNameIndex() returns a key name index for dead key or
-   * "Unidentified".  This method can return the index from non-combining
-   * unicode character, e.g., '`' returns KEY_NAME_INDEX_DeadGrave.
-   * So, you cannot use this method for checking if the char is a dead char.
-   */
-  static KeyNameIndex GetDeadKeyNameIndex(char16_t aChar);
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif // mozilla_WidgetUtils_h
--- a/widget/qt/nsQtKeyUtils.cpp
+++ b/widget/qt/nsQtKeyUtils.cpp
@@ -380,19 +380,16 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         case Qt::Key_Hangul_Hanja:
         case Qt::Key_Hangul_Jamo:
         case Qt::Key_Hangul_Romaja:
         case Qt::Key_Hangul_Jeonja:
         case Qt::Key_Hangul_Banja:
         case Qt::Key_Hangul_PreHanja:
         case Qt::Key_Hangul_PostHanja:
         case Qt::Key_Hangul_Special:
-        case Qt::Key_Dead_Belowdot:
-        case Qt::Key_Dead_Hook:
-        case Qt::Key_Dead_Horn:
         case Qt::Key_TrebleUp:
         case Qt::Key_TrebleDown:
         case Qt::Key_Standby:
         case Qt::Key_OpenUrl:
         case Qt::Key_LaunchMedia:
         case Qt::Key_KeyboardLightOnOff:
         case Qt::Key_KeyboardBrightnessUp:
         case Qt::Key_KeyboardBrightnessDown:
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -2058,18 +2058,17 @@ KeyboardLayout::InitNativeKey(NativeKey&
         // Dead-key state activated at keydown.
         mActiveDeadKey = virtualKey;
         mDeadKeyShiftState = shiftState;
       }
       UniCharsAndModifiers deadChars =
         mVirtualKeys[virtualKeyIndex].GetNativeUniChars(shiftState);
       NS_ASSERTION(deadChars.mLength == 1,
                    "dead key must generate only one character");
-      aNativeKey.mKeyNameIndex =
-        WidgetUtils::GetDeadKeyNameIndex(deadChars.mChars[0]);
+      aNativeKey.mKeyNameIndex = KEY_NAME_INDEX_Dead;
       return;
     }
 
     // Dead key followed by another dead key causes inputting both character.
     // However, at keydown message handling, we need to forget the first
     // dead key because there is no guarantee coming WM_KEYUP for the second
     // dead key before next WM_KEYDOWN.  E.g., due to auto key repeat or
     // pressing another dead key before releasing current key.  Therefore,