Bug 1309515 part.2 TextInputHandler::InsertText() should consume current key event when it dispatches composition events r=m_kato

The cause of bug 1309515 is, HandleKeyDownEvent() dispatches eKeyPress events even after InsertText() dispatches composition events via InsertTextAsCommittingComposition().

Therefore, this patch consumes the current key event after dispatching composition events.

Note that for consistency with Windows, InsertText() should use eKeyPress events rather than composition events at least in this case.  However, changing the behavior has some risk.  So, we should fix this bug with the safest hack for uplift.

MozReview-Commit-ID: 7FYR5N2lATe

--HG--
extra : rebase_source : 4485bd76a68567e8c20a84c2fbca78c626f592c5
This commit is contained in:
Masayuki Nakano 2016-10-13 13:18:58 +09:00
Родитель d7f167f262
Коммит 6ca17cf78c
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -2190,6 +2190,14 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString,
if (str.Length() != 1 || IsIMEComposing()) {
InsertTextAsCommittingComposition(aAttrString, aReplacementRange);
// For now, consume keypress events when we dispatch the string with a
// composition for preventing to dispatch keypress events later.
// TODO: When there is a currentKeyEvent, we should dispatch keypress
// events even if the length of the string is over 1.
if (currentKeyEvent) {
currentKeyEvent->mKeyPressHandled = true;
currentKeyEvent->mKeyPressDispatched = true;
}
return;
}