Bug 1300003 part.4 Remove NativeKey::mIsFollowedByNonControlCharMessage because calling NativeKey::IsFollowedByNonControlCharMessage() is enough fast r=m_kato

NativeKey is now removing and storing following char messages when it's created for a keydown message.  Therefore, IsFollowedByNonControlCharMessage() just refers the stored messages and it's enough fast.  So, we can get rid of mIsFollowedByNonControlCharMessage.

MozReview-Commit-ID: 542A2sHNXeC
This commit is contained in:
Masayuki Nakano
2016-09-05 21:47:58 +09:00
parent 1a3ddc2842
commit 4899014cff
2 changed files with 4 additions and 9 deletions

View File

@@ -861,7 +861,6 @@ NativeKey::NativeKey(nsWindowBase* aWidget,
, mScanCode(0)
, mIsExtended(false)
, mIsDeadKey(false)
, mIsFollowedByNonControlCharMessage(false)
, mFakeCharMsgs(aFakeCharMsgs && aFakeCharMsgs->Length() ?
aFakeCharMsgs : nullptr)
{
@@ -1064,9 +1063,9 @@ NativeKey::NativeKey(nsWindowBase* aWidget,
keyboardLayout->ConvertNativeKeyCodeToDOMKeyCode(mOriginalVirtualKeyCode);
// Be aware, keyboard utilities can change non-printable keys to printable
// keys. In such case, we should make the key value as a printable key.
mIsFollowedByNonControlCharMessage =
IsKeyDownMessage() && IsFollowedByNonControlCharMessage();
mKeyNameIndex = mIsFollowedByNonControlCharMessage ?
// FYI: IsFollowedByNonControlCharMessage() returns true only when it's
// handling a keydown message.
mKeyNameIndex = IsFollowedByNonControlCharMessage() ?
KEY_NAME_INDEX_USE_STRING :
keyboardLayout->ConvertNativeKeyCodeToKeyNameIndex(mOriginalVirtualKeyCode);
mCodeNameIndex =
@@ -2042,7 +2041,7 @@ NativeKey::NeedsToHandleWithoutFollowingCharMessages() const
// If keydown message is followed by WM_CHAR whose wParam isn't a control
// character, we should dispatch keypress event with the char message
// even with any modifier state.
if (mIsFollowedByNonControlCharMessage) {
if (IsFollowedByNonControlCharMessage()) {
return false;
}

View File

@@ -321,10 +321,6 @@ private:
// mIsOverridingKeyboardLayout is true if the instance temporarily overriding
// keyboard layout with specified by the constructor.
bool mIsOverridingKeyboardLayout;
// mIsFollowedByNonControlCharMessage may be true when mMsg is a keydown
// message. When the keydown message is followed by a char message, this
// is true.
bool mIsFollowedByNonControlCharMessage;
nsTArray<FakeCharMsg>* mFakeCharMsgs;