Bug 1405832 - part 3: ContentCacheInParent::RequestIMEToCommitComposition() should call nsIWidget::NotifyIME() via TextComposition::RequestToCommit() r?m_kato
Now, TextComposition::RequestToCommit() manages if it has already requested
IME to commit or cancel composition and this is important for redundant
requests. Therefore, ContentCacheInParent::RequestIMEToCommitComposition()
shouldn't call nsIWidget::NotifyIME() directly.
MozReview-Commit-ID: 69VpgyK9Jk5
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -1342,18 +1342,22 @@ ContentCacheInParent::RequestIMEToCommit
AppendElement(RequestIMEToCommitCompositionResult::
eReceivedButNoTextComposition);
#endif // #ifdef MOZ_CRASHREPORTER
return false;
}
mCommitStringByRequest = &aCommittedString;
- aWidget->NotifyIME(IMENotification(aCancel ? REQUEST_TO_CANCEL_COMPOSITION :
- REQUEST_TO_COMMIT_COMPOSITION));
+ // Request commit or cancel composition with TextComposition because we may
+ // have already requested to commit or cancel the composition or we may
+ // have already received eCompositionCommit(AsIs) event. Those status are
+ // managed by composition. So, if we don't request commit composition,
+ // we should do nothing with native IME here.
+ composition->RequestToCommit(aWidget, aCancel);
mCommitStringByRequest = nullptr;
MOZ_LOG(sContentCacheLog, LogLevel::Info,
(" 0x%p RequestToCommitComposition(), "
"mWidgetHasComposition=%s, the composition %s committed synchronously",
this, GetBoolName(mWidgetHasComposition),
composition->Destroyed() ? "WAS" : "has NOT been"));