Bug 1405832 - part 3: ContentCacheInParent::RequestIMEToCommitComposition() should call nsIWidget::NotifyIME() via TextComposition::RequestToCommit() r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 20 Nov 2017 23:08:37 +0900
changeset 701893 1f47ff0bac04bb97961cc85bbab12db60a9ffb92
parent 701892 b3640d730d7ac1fbc287887cd3e94967ee9cc55e
child 701894 48c4741c2126c9e6664ad5ec65bf8fa6e6ca1c1b
push id90306
push usermasayuki@d-toybox.com
push dateWed, 22 Nov 2017 12:43:08 +0000
reviewersm_kato
bugs1405832
milestone59.0a1
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
widget/ContentCache.cpp
--- 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"));