Bug 1303273 part.9 NativeKey::mFollowingCharMsgs should be AutoTArray r?m_kato
Similarly, NativeKey is a stack class and mFollowingCharMsgs which stores following char messages of WM_(SYS)KEYDOWN should be AutoTArray for preventing to use heap at handling inputs with usual keyboard layout.
5 is enough size for handling usual keyboard layout because we support only 5 or less characters per dead key sequence.
MozReview-Commit-ID: IphcIOmPW0C
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -319,17 +319,19 @@ private:
MSG mReceivedMsg;
RefPtr<nsWindowBase> mWidget;
RefPtr<TextEventDispatcher> mDispatcher;
HKL mKeyboardLayout;
MSG mMsg;
// mFollowingCharMsgs stores WM_CHAR, WM_SYSCHAR, WM_DEADCHAR or
// WM_SYSDEADCHAR message which follows WM_KEYDOWN.
// Note that the stored messaged are already removed from the queue.
- nsTArray<MSG> mFollowingCharMsgs;
+ // FYI: 5 is enough number for usual keyboard layout handling. On Windows,
+ // a dead key sequence may cause inputting up to 5 characters per key press.
+ AutoTArray<MSG, 5> mFollowingCharMsgs;
// mRemovedOddCharMsgs stores WM_CHAR messages which are caused by ATOK or
// WXG (they are Japanese IME) when the user tries to do "Kakutei-undo"
// (it means "undo the last commit").
nsTArray<MSG> mRemovedOddCharMsgs;
// If dispatching eKeyDown or eKeyPress event causes focus change,
// the instance shouldn't handle remaning char messages. For checking it,
// this should store first focused window.
HWND mFocusedWndBeforeDispatch;