Bug 1304620 part.1 Rename ContentCacheInParent::mIsComposing to mWidgetHasComposition r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 12 Oct 2016 16:42:28 +0900
changeset 362881 8bea9647dc86865e874f346a3fccc14565ce3f65
parent 362880 84286e454b4e67a193470eb68fb2a504835999fd
child 362882 97cb51652c868d8698c966ad0483f1421be1d449
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1304620
milestone52.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
Bug 1304620 part.1 Rename ContentCacheInParent::mIsComposing to mWidgetHasComposition r=m_kato For making the meaning of ContentCacheInParent::mIsComposing clearer, let's rename it to mWidgetHasComposition. It becomes true when the parent process sends eCompositionStart to the remote process and false when the parent process sends eCompositionCommit(AsIs). So, it represents if the widget (i.e., the native IME handler in the chrome process) has composition. MozReview-Commit-ID: 5k05IXMgJxw
widget/ContentCache.cpp
widget/ContentCache.h
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -505,59 +505,59 @@ ContentCacheInChild::SetSelection(nsIWid
 /*****************************************************************************
  * mozilla::ContentCacheInParent
  *****************************************************************************/
 
 ContentCacheInParent::ContentCacheInParent()
   : ContentCache()
   , mCommitStringByRequest(nullptr)
   , mPendingEventsNeedingAck(0)
-  , mIsComposing(false)
+  , mWidgetHasComposition(false)
 {
 }
 
 void
 ContentCacheInParent::AssignContent(const ContentCache& aOther,
                                     nsIWidget* aWidget,
                                     const IMENotification* aNotification)
 {
   mCompositionStart = aOther.mCompositionStart;
   mText = aOther.mText;
   mSelection = aOther.mSelection;
   mFirstCharRect = aOther.mFirstCharRect;
   mCaret = aOther.mCaret;
   mTextRectArray = aOther.mTextRectArray;
   mEditorRect = aOther.mEditorRect;
 
-  if (mIsComposing) {
+  if (mWidgetHasComposition) {
     NS_WARNING_ASSERTION(mCompositionStart != UINT32_MAX, "mCompositionStart");
     IMEStateManager::MaybeStartOffsetUpdatedInChild(aWidget, mCompositionStart);
   } else {
     NS_WARNING_ASSERTION(mCompositionStart == UINT32_MAX, "mCompositionStart");
   }
 
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
     ("0x%p AssignContent(aNotification=%s), "
      "Succeeded, mText.Length()=%u, mSelection={ mAnchor=%u, mFocus=%u, "
      "mWritingMode=%s, mAnchorCharRects[eNextCharRect]=%s, "
      "mAnchorCharRects[ePrevCharRect]=%s, mFocusCharRects[eNextCharRect]=%s, "
      "mFocusCharRects[ePrevCharRect]=%s, mRect=%s }, "
      "mFirstCharRect=%s, mCaret={ mOffset=%u, mRect=%s }, mTextRectArray={ "
-     "mStart=%u, mRects.Length()=%u }, mIsComposing=%s, mCompositionStart=%u, "
-     "mEditorRect=%s",
+     "mStart=%u, mRects.Length()=%u }, mWidgetHasComposition=%s, "
+     "mCompositionStart=%u, mEditorRect=%s",
      this, GetNotificationName(aNotification),
      mText.Length(), mSelection.mAnchor, mSelection.mFocus,
      GetWritingModeName(mSelection.mWritingMode).get(),
      GetRectText(mSelection.mAnchorCharRects[eNextCharRect]).get(),
      GetRectText(mSelection.mAnchorCharRects[ePrevCharRect]).get(),
      GetRectText(mSelection.mFocusCharRects[eNextCharRect]).get(),
      GetRectText(mSelection.mFocusCharRects[ePrevCharRect]).get(),
      GetRectText(mSelection.mRect).get(), GetRectText(mFirstCharRect).get(),
      mCaret.mOffset, GetRectText(mCaret.mRect).get(), mTextRectArray.mStart,
-     mTextRectArray.mRects.Length(), GetBoolName(mIsComposing),
+     mTextRectArray.mRects.Length(), GetBoolName(mWidgetHasComposition),
      mCompositionStart, GetRectText(mEditorRect).get()));
 }
 
 bool
 ContentCacheInParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent,
                                               nsIWidget* aWidget) const
 {
   MOZ_ASSERT(aWidget);
@@ -596,17 +596,17 @@ ContentCacheInParent::HandleQueryContent
         MOZ_LOG(sContentCacheLog, LogLevel::Error,
           ("0x%p HandleQueryContentEvent(), FAILED due to "
            "aEvent.mInput.MakeOffsetAbsolute(0) failure, aEvent={ mMessage=%s, "
            "mInput={ mOffset=%d, mLength=%d } }",
            this, ToChar(aEvent.mMessage), aEvent.mInput.mOffset,
            aEvent.mInput.mLength));
         return false;
       }
-    } else if (mIsComposing) {
+    } else if (mWidgetHasComposition) {
       if (NS_WARN_IF(!aEvent.mInput.MakeOffsetAbsolute(mCompositionStart))) {
         MOZ_LOG(sContentCacheLog, LogLevel::Error,
           ("0x%p HandleQueryContentEvent(), FAILED due to "
            "aEvent.mInput.MakeOffsetAbsolute(mCompositionStart) failure, "
            "mCompositionStart=%d, aEvent={ mMessage=%s, "
            "mInput={ mOffset=%d, mLength=%d } }",
            this, mCompositionStart, ToChar(aEvent.mMessage),
            aEvent.mInput.mOffset, aEvent.mInput.mLength));
@@ -1053,37 +1053,37 @@ ContentCacheInParent::GetCaretRect(uint3
 }
 
 bool
 ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent)
 {
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
     ("0x%p OnCompositionEvent(aEvent={ "
      "mMessage=%s, mData=\"%s\" (Length()=%u), mRanges->Length()=%u }), "
-     "mPendingEventsNeedingAck=%u, mIsComposing=%s, "
+     "mPendingEventsNeedingAck=%u, mWidgetHasComposition=%s, "
      "mCommitStringByRequest=0x%p",
      this, ToChar(aEvent.mMessage),
      GetEscapedUTF8String(aEvent.mData).get(), aEvent.mData.Length(),
      aEvent.mRanges ? aEvent.mRanges->Length() : 0, mPendingEventsNeedingAck,
-     GetBoolName(mIsComposing), mCommitStringByRequest));
+     GetBoolName(mWidgetHasComposition), mCommitStringByRequest));
 
   // We must be able to simulate the selection because
   // we might not receive selection updates in time
-  if (!mIsComposing) {
+  if (!mWidgetHasComposition) {
     if (aEvent.mWidget && aEvent.mWidget->PluginHasFocus()) {
       // If focus is on plugin, we cannot get selection range
       mCompositionStart = 0;
     } else {
       mCompositionStart = mSelection.StartOffset();
     }
   }
 
-  mIsComposing = !aEvent.CausesDOMCompositionEndEvent();
+  mWidgetHasComposition = !aEvent.CausesDOMCompositionEndEvent();
 
-  if (!mIsComposing) {
+  if (!mWidgetHasComposition) {
     mCompositionStart = UINT32_MAX;
   }
 
   // During REQUEST_TO_COMMIT_COMPOSITION or REQUEST_TO_CANCEL_COMPOSITION,
   // widget usually sends a eCompositionChange and/or eCompositionCommit event
   // to finalize or clear the composition, respectively.  In this time,
   // we need to intercept all composition events here and pass the commit
   // string for returning to the remote process as a result of
@@ -1103,23 +1103,23 @@ ContentCacheInParent::OnCompositionEvent
 void
 ContentCacheInParent::OnSelectionEvent(
                         const WidgetSelectionEvent& aSelectionEvent)
 {
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
     ("0x%p OnSelectionEvent(aEvent={ "
      "mMessage=%s, mOffset=%u, mLength=%u, mReversed=%s, "
      "mExpandToClusterBoundary=%s, mUseNativeLineBreak=%s }), "
-     "mPendingEventsNeedingAck=%u, mIsComposing=%s",
+     "mPendingEventsNeedingAck=%u, mWidgetHasComposition=%s",
      this, ToChar(aSelectionEvent.mMessage),
      aSelectionEvent.mOffset, aSelectionEvent.mLength,
      GetBoolName(aSelectionEvent.mReversed),
      GetBoolName(aSelectionEvent.mExpandToClusterBoundary),
      GetBoolName(aSelectionEvent.mUseNativeLineBreak), mPendingEventsNeedingAck,
-     GetBoolName(mIsComposing)));
+     GetBoolName(mWidgetHasComposition)));
 
   mPendingEventsNeedingAck++;
 }
 
 void
 ContentCacheInParent::OnEventNeedingAckHandled(nsIWidget* aWidget,
                                                 EventMessage aMessage)
 {
@@ -1141,18 +1141,18 @@ ContentCacheInParent::OnEventNeedingAckH
 
 bool
 ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget,
                                                     bool aCancel,
                                                     nsAString& aCommittedString)
 {
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
     ("0x%p RequestToCommitComposition(aWidget=%p, "
-     "aCancel=%s), mIsComposing=%s, mCommitStringByRequest=%p",
-     this, aWidget, GetBoolName(aCancel), GetBoolName(mIsComposing),
+     "aCancel=%s), mWidgetHasComposition=%s, mCommitStringByRequest=%p",
+     this, aWidget, GetBoolName(aCancel), GetBoolName(mWidgetHasComposition),
      mCommitStringByRequest));
 
   MOZ_ASSERT(!mCommitStringByRequest);
 
   RefPtr<TextComposition> composition =
     IMEStateManager::GetTextCompositionFor(aWidget);
   if (NS_WARN_IF(!composition)) {
     MOZ_LOG(sContentCacheLog, LogLevel::Warning,
@@ -1165,18 +1165,18 @@ ContentCacheInParent::RequestIMEToCommit
 
   aWidget->NotifyIME(IMENotification(aCancel ? REQUEST_TO_CANCEL_COMPOSITION :
                                                REQUEST_TO_COMMIT_COMPOSITION));
 
   mCommitStringByRequest = nullptr;
 
   MOZ_LOG(sContentCacheLog, LogLevel::Info,
     ("  0x%p RequestToCommitComposition(), "
-     "mIsComposing=%s, the composition %s committed synchronously",
-     this, GetBoolName(mIsComposing),
+     "mWidgetHasComposition=%s, the composition %s committed synchronously",
+     this, GetBoolName(mWidgetHasComposition),
      composition->Destroyed() ? "WAS" : "has NOT been"));
 
   if (!composition->Destroyed()) {
     // When the composition isn't committed synchronously, the remote process's
     // TextComposition instance will synthesize commit events and wait to
     // receive delayed composition events.  When TextComposition instances both
     // in this process and the remote process will be destroyed when delayed
     // composition events received. TextComposition instance in the parent
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -410,17 +410,20 @@ private:
   // composition.  Then, data value of dispatched composition events should
   // be stored into the instance.
   nsAString* mCommitStringByRequest;
   // mPendingEventsNeedingAck is increased before sending a composition event or
   // a selection event and decreased after they are received in the child
   // process.
   uint32_t mPendingEventsNeedingAck;
 
-  bool mIsComposing;
+  // mWidgetHasComposition is true when the widget in this process thinks that
+  // IME has composition.  So, this is set to true when eCompositionStart is
+  // dispatched and set to false when eCompositionCommit(AsIs) is dispatched.
+  bool mWidgetHasComposition;
 
   /**
    * When following methods' aRoundToExistingOffset is true, even if specified
    * offset or range is out of bounds, the result is computed with the existing
    * cache forcibly.
    */
   bool GetCaretRect(uint32_t aOffset,
                     bool aRoundToExistingOffset,