Skip to content

Commit

Permalink
Bug 938987 Use 'Dead' key value for all dead keys r=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
masayuki-nakano committed Dec 30, 2014
1 parent bbdb77b commit 6422530
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 172 deletions.
22 changes: 1 addition & 21 deletions dom/events/KeyNameList.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ 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)
Expand Down Expand Up @@ -351,25 +351,5 @@ DEFINE_KEYNAME_WITH_SAME_NAME(Subtitle)
// 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
133 changes: 66 additions & 67 deletions widget/NativeKeyToDOMKeyName.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,72 @@ 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)

Expand Down Expand Up @@ -998,73 +1064,6 @@ KEY_MAP_ANDROID (Subtitle, AKEYCODE_CAPTIONS)
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
Expand Down
71 changes: 0 additions & 71 deletions widget/SharedWidgetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,76 +166,5 @@ WidgetUtils::GetLatinCharCodeForKeyCode(uint32_t aKeyCode,
}
}

// 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
8 changes: 0 additions & 8 deletions widget/WidgetUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ class WidgetUtils
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
Expand Down
3 changes: 0 additions & 3 deletions widget/qt/nsQtKeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,6 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
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:
Expand Down
3 changes: 1 addition & 2 deletions widget/windows/KeyboardLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2063,8 +2063,7 @@ KeyboardLayout::InitNativeKey(NativeKey& aNativeKey,
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;
}

Expand Down

0 comments on commit 6422530

Please sign in to comment.