Bug 1137561 part.9 NativeKey should dispatch keypress events after removing following char messages if there are two or more characters to be inputted r=m_kato

This commit is contained in:
Masayuki Nakano 2016-03-16 13:47:49 +09:00
parent bd594893c8
commit ca2f7e94a8

View File

@ -1732,6 +1732,12 @@ NativeKey::NeedsToHandleWithoutFollowingCharMessages() const
return true;
}
// If inputting two or more characters, should be dispatched after removing
// whole following char messages.
if (mCommittedCharsAndModifiers.mLength > 1) {
return true;
}
// If any modifier keys which may cause printable keys becoming non-printable
// are not pressed, we don't need special handling for the key.
if (!mModKeyState.IsControl() && !mModKeyState.IsAlt() &&
@ -1827,17 +1833,20 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) const
aCharMsg.message = WM_NULL;
if (mFakeCharMsgs) {
FakeCharMsg& fakeCharMsg = mFakeCharMsgs->ElementAt(0);
if (fakeCharMsg.mConsumed) {
return false;
for (size_t i = 0; i < mFakeCharMsgs->Length(); i++) {
FakeCharMsg& fakeCharMsg = mFakeCharMsgs->ElementAt(i);
if (fakeCharMsg.mConsumed) {
continue;
}
MSG charMsg = fakeCharMsg.GetCharMsg(mMsg.hwnd);
fakeCharMsg.mConsumed = true;
if (!IsCharMessage(charMsg)) {
return false;
}
aCharMsg = charMsg;
return true;
}
MSG charMsg = fakeCharMsg.GetCharMsg(mMsg.hwnd);
fakeCharMsg.mConsumed = true;
if (!IsCharMessage(charMsg)) {
return false;
}
aCharMsg = charMsg;
return true;
return false;
}
// If next key message is not char message, we should give up to find a
@ -2162,7 +2171,7 @@ bool
NativeKey::DispatchKeyPressEventsWithoutCharMessage() const
{
MOZ_ASSERT(IsKeyDownMessage());
MOZ_ASSERT(!mIsDeadKey);
MOZ_ASSERT(!mIsDeadKey || !mCommittedCharsAndModifiers.IsEmpty());
nsresult rv = mDispatcher->BeginNativeInputTransaction();
if (NS_WARN_IF(NS_FAILED(rv))) {