Bug 1307112 part.5 NativeKey should skip non-printable char messages when it initializes mCommittedCharsAndModifiers with following char messages r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 03 Oct 2016 18:20:29 +0900
changeset 316879 38f802fc35a0944031248d677b60e67c3adc8d78
parent 316878 a041e03e326859f84aa68dac9541b1890d8e2722
child 316880 6d50e95e5494dd263c0e98ca2d04567e47ba86df
push id32935
push usermasayuki@d-toybox.com
push dateFri, 07 Oct 2016 05:19:38 +0000
treeherderautoland@1de5e07bed66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1307112
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1307112 part.5 NativeKey should skip non-printable char messages when it initializes mCommittedCharsAndModifiers with following char messages r=m_kato NativeKey shouldn't include characters which are provided by WM_SYSCHAR message or WM_DEADCHAR message into mCommittedCharsAndModifiers. MozReview-Commit-ID: Ax1BmO5wTy0
widget/windows/KeyboardLayout.cpp
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1515,21 +1515,21 @@ NativeKey::InitWithKeyChar()
       // TODO: Like Edge, we shouldn't dispatch two sets of keyboard events
       //       for a Unicode character in non-BMP because its key value looks
       //       broken and not good thing for our editor if only one keydown or
       //       keypress event's default is prevented.  I guess, we should store
       //       key message information globally and we should wait following
       //       WM_KEYDOWN if following WM_CHAR is a part of a Unicode character.
       mCommittedCharsAndModifiers.Clear();
       for (size_t i = 0; i < mFollowingCharMsgs.Length(); ++i) {
-        char16_t ch = static_cast<char16_t>(mFollowingCharMsgs[i].wParam);
-        // Skip control characters.
-        if (IsControlChar(ch)) {
+        // Ignore non-printable char messages.
+        if (!IsPrintableCharMessage(mFollowingCharMsgs[i])) {
           continue;
         }
+        char16_t ch = static_cast<char16_t>(mFollowingCharMsgs[i].wParam);
         mCommittedCharsAndModifiers.Append(ch, mModKeyState.GetModifiers());
       }
     }
     // Remove odd char messages if there are.
     RemoveFollowingOddCharMessages();
   }
 }