Bug 1448282 - TSFTextStore should append a pending action for dispatching keyboard event into the queue if OnUpdateComposition() is called without new range r=m_kato

OnUpdateComposition() may be called without new range instance by some TIPs
when they starts to modify composition string.  At this timing, TSFTextStore
should append a pending action for dispatching keyboard event into the queue.
Without this patch, OnUpdateComposition() creates incomplete pending action
for composition update and then, MaybeDispatchKeyboardEventAsProcessedByIME()
appends pending action for dispatching keyboard event from another point
immediately (e.g., from SetText()), then, finally, the caller of
MaybeDispatchKeyboardEventAsProcessedByIME() appends another pending action
for composition update with proper composition string.  Therefore, the
first pending action for composition update clears composition string before
actually updating it with new composition string.  In other words, new
pending action for dispatching keyboard event splits a pending composition
update.  So, this patch prevents the splitting.

MozReview-Commit-ID: 9pYO9pm3Vh9

--HG--
extra : rebase_source : a8fb903174c0f1af61a71175dbbf01b7b1c5cb53
This commit is contained in:
Masayuki Nakano 2018-03-26 15:07:59 +09:00
parent 5beb4527ab
commit e9d257856b

View File

@ -5325,6 +5325,13 @@ TSFTextStore::OnUpdateComposition(ITfCompositionView* pComposition,
// pRangeNew is null when the update is not complete // pRangeNew is null when the update is not complete
if (!pRangeNew) { if (!pRangeNew) {
MaybeDispatchKeyboardEventAsProcessedByIME();
if (mDestroyed) {
MOZ_LOG(sTextStoreLog, LogLevel::Error,
("0x%p TSFTextStore::OnUpdateComposition() FAILED due to "
"destroyed during dispatching a keyboard event", this));
return E_FAIL;
}
PendingAction* action = LastOrNewPendingCompositionUpdate(); PendingAction* action = LastOrNewPendingCompositionUpdate();
action->mIncomplete = true; action->mIncomplete = true;
MOZ_LOG(sTextStoreLog, LogLevel::Info, MOZ_LOG(sTextStoreLog, LogLevel::Info,