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
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -5320,16 +5320,23 @@ TSFTextStore::OnUpdateComposition(ITfCom
MOZ_LOG(sTextStoreLog, LogLevel::Error,
("0x%p TSFTextStore::OnUpdateComposition() FAILED due to "
"different composition view specified", this));
return E_UNEXPECTED;
}
// pRangeNew is null when the update is not complete
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();
action->mIncomplete = true;
MOZ_LOG(sTextStoreLog, LogLevel::Info,
("0x%p TSFTextStore::OnUpdateComposition() succeeded but "
"not complete", this));
return S_OK;
}