author | Masayuki Nakano <masayuki@d-toybox.com> |
Sun, 05 Feb 2012 21:19:31 +0900 | |
changeset 86205 | 9ff7a8136813c7e37d25beabc0ddd3ea9b857d64 |
parent 86204 | 4bf865ecf51532193d0c6a8f5b03f81afece27e2 |
child 86206 | ed55586b06770245172fb65d7a8db2e1f96883bb |
push id | 5719 |
push user | masayuki@d-toybox.com |
push date | Sun, 05 Feb 2012 12:19:52 +0000 |
treeherder | mozilla-inbound@9ff7a8136813 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | emk |
bugs | 713628 |
milestone | 13.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
|
--- a/widget/windows/nsIMM32Handler.cpp +++ b/widget/windows/nsIMM32Handler.cpp @@ -1099,34 +1099,16 @@ nsIMM32Handler::HandleComposition(nsWind PM_NOREMOVE) && msg2.message == WM_IME_COMPOSITION) { PR_LOG(gIMM32Log, PR_LOG_ALWAYS, ("IMM32: HandleComposition, Ignores due to find a WM_IME_STARTCOMPOSITION\n")); return ShouldDrawCompositionStringOurselves(); } } - if (!IS_COMMITTING_LPARAM(lParam) && !IS_COMPOSING_LPARAM(lParam)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, - ("IMM32: HandleComposition, Handle 0 length TextEvent\n")); - - // XXX This block should be wrong. If composition string is not change, - // we should do nothing. - - if (!mIsComposing) { - HandleStartComposition(aWindow, aIMEContext); - } - - mCompositionString.Truncate(); - DispatchTextEvent(aWindow, aIMEContext, false); - - return ShouldDrawCompositionStringOurselves(); - } - - bool startCompositionMessageHasBeenSent = mIsComposing; // // This catches a fixed result // if (IS_COMMITTING_LPARAM(lParam)) { if (!mIsComposing) { HandleStartComposition(aWindow, aIMEContext); @@ -1156,16 +1138,42 @@ nsIMM32Handler::HandleComposition(nsWind //-------------------------------------------------------- // 1. Get GCS_COMPSTR //-------------------------------------------------------- PR_LOG(gIMM32Log, PR_LOG_ALWAYS, ("IMM32: HandleComposition, GCS_COMPSTR\n")); GetCompositionString(aIMEContext, GCS_COMPSTR); + if (!IS_COMPOSING_LPARAM(lParam)) { + PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + ("IMM32: HandleComposition, lParam doesn't indicate composing, " + "mCompositionString=\"%s\", mLastDispatchedCompositionString=\"%s\"", + NS_ConvertUTF16toUTF8(mCompositionString).get(), + NS_ConvertUTF16toUTF8(mLastDispatchedCompositionString).get())); + + // If composition string isn't changed, we can trust the lParam. + // So, we need to do nothing. + if (mLastDispatchedCompositionString == mCompositionString) { + return ShouldDrawCompositionStringOurselves(); + } + + // IME may send WM_IME_COMPOSITION without composing lParam values + // when composition string becomes empty (e.g., using Backspace key). + // If composition string is empty, we should dispatch a text event with + // empty string. + if (mCompositionString.IsEmpty()) { + DispatchTextEvent(aWindow, aIMEContext, false); + return ShouldDrawCompositionStringOurselves(); + } + + // Otherwise, we cannot trust the lParam value. We might need to + // dispatch text event with the latest composition string information. + } + // See https://bugzilla.mozilla.org/show_bug.cgi?id=296339 if (mCompositionString.IsEmpty() && !startCompositionMessageHasBeenSent) { // In this case, maybe, the sender is MSPinYin. That sends *only* // WM_IME_COMPOSITION with GCS_COMP* and GCS_RESULT* when // user inputted the Chinese full stop. So, that doesn't send // WM_IME_STARTCOMPOSITION and WM_IME_ENDCOMPOSITION. // If WM_IME_STARTCOMPOSITION was not sent and the composition // string is null (it indicates the composition transaction ended),