зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306549 part.5 Create KeyboardLayout::GetCompositeChar() for wrapping VirtualKey::GetCompositeChar() r=m_kato
VirtualKey::GetCompositeChar() needs index of virtual keycode which may make around the caller messy. So, KeyboardLayout::GetCompositeChar() should wrap it and KeyboardLayout::MaybeInitNativeKeyWithCompositeChar() should use it. MozReview-Commit-ID: 8KLTJpCFZ8u --HG-- extra : rebase_source : fd13c009330fd485c8cba30f469fc645b560c623
This commit is contained in:
Родитель
da22fd3b2b
Коммит
c5efc36210
|
@ -3757,12 +3757,8 @@ KeyboardLayout::MaybeInitNativeKeyWithCompositeChar(
|
|||
return false;
|
||||
}
|
||||
|
||||
int32_t activeDeadKeyIndex = GetKeyIndex(mActiveDeadKey);
|
||||
if (NS_WARN_IF(activeDeadKeyIndex < 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!IsPrintableCharKey(aNativeKey.mOriginalVirtualKeyCode))) {
|
||||
if (NS_WARN_IF(!IsPrintableCharKey(mActiveDeadKey)) ||
|
||||
NS_WARN_IF(!IsPrintableCharKey(aNativeKey.mOriginalVirtualKeyCode))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3773,8 +3769,7 @@ KeyboardLayout::MaybeInitNativeKeyWithCompositeChar(
|
|||
}
|
||||
|
||||
char16_t compositeChar =
|
||||
mVirtualKeys[activeDeadKeyIndex].GetCompositeChar(mDeadKeyShiftState,
|
||||
baseChars.mChars[0]);
|
||||
GetCompositeChar(mActiveDeadKey, mDeadKeyShiftState, baseChars.mChars[0]);
|
||||
if (!compositeChar) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3816,6 +3811,18 @@ KeyboardLayout::GetNativeUniCharsAndModifiers(
|
|||
return mVirtualKeys[key].GetNativeUniChars(shiftState);
|
||||
}
|
||||
|
||||
char16_t
|
||||
KeyboardLayout::GetCompositeChar(uint8_t aVirtualKeyOfDeadKey,
|
||||
VirtualKey::ShiftState aShiftStateOfDeadKey,
|
||||
char16_t aBaseChar) const
|
||||
{
|
||||
int32_t key = GetKeyIndex(aVirtualKeyOfDeadKey);
|
||||
if (key < 0) {
|
||||
return 0;
|
||||
}
|
||||
return mVirtualKeys[key].GetCompositeChar(aShiftStateOfDeadKey, aBaseChar);
|
||||
}
|
||||
|
||||
void
|
||||
KeyboardLayout::LoadLayout(HKL aLayout)
|
||||
{
|
||||
|
|
|
@ -668,6 +668,17 @@ private:
|
|||
uint8_t aVirtualKey,
|
||||
VirtualKey::ShiftState aShiftState) const;
|
||||
|
||||
/**
|
||||
* GetCompositeChar() returns a composite character with dead character
|
||||
* caused by aVirtualKeyOfDeadKey and aShiftStateOfDeadKey and a base
|
||||
* character (aBaseChar).
|
||||
* If the combination of the dead character and the base character doesn't
|
||||
* cause a composite character, this returns 0.
|
||||
*/
|
||||
char16_t GetCompositeChar(uint8_t aVirtualKeyOfDeadKey,
|
||||
VirtualKey::ShiftState aShiftStateOfDeadKey,
|
||||
char16_t aBaseChar) const;
|
||||
|
||||
public:
|
||||
static KeyboardLayout* GetInstance();
|
||||
static void Shutdown();
|
||||
|
|
Загрузка…
Ссылка в новой задаче