Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug, a=lizzard
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 28 Jan 2016 13:28:53 +0900
changeset 316911 f5920d193c3053e649a7bc4aaafe495dfd978fb0
parent 316910 34f8a6632e872692ae179a0bb5a6d3134f73d56a
child 316912 f7e1f93e24fa5db8e62b043fcffc9979d79a043b
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lizzard
bugs1242331
milestone46.0a2
Bug 1242331 part.2 Rename TextChangeDataBase::mCausedByComposition to mCausedOnlyByComposition r=smaug, a=lizzard
dom/events/IMEContentObserver.cpp
dom/ipc/TabParent.cpp
widget/IMEData.h
widget/PuppetWidget.cpp
widget/nsBaseWidget.cpp
widget/nsGUIEventIPC.h
widget/windows/TSFTextStore.cpp
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -129,19 +129,19 @@ public:
   explicit TextChangeDataToString(
              const IMENotification::TextChangeDataBase& aData)
   {
     if (!aData.IsValid()) {
       AppendLiteral("{ IsValid()=false }");
       return;
     }
     AppendPrintf("{ mStartOffset=%u, mRemovedEndOffset=%u, mAddedEndOffset=%u, "
-                 "mCausedByComposition=%s }", aData.mStartOffset,
+                 "mCausedOnlyByComposition=%s }", aData.mStartOffset,
                  aData.mRemovedEndOffset, aData.mAddedEndOffset,
-                 ToChar(aData.mCausedByComposition));
+                 ToChar(aData.mCausedOnlyByComposition));
   }
   virtual ~TextChangeDataToString() {}
 };
 
 /******************************************************************************
  * mozilla::IMEContentObserver
  ******************************************************************************/
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1994,17 +1994,17 @@ TabParent::RecvNotifyIMETextChange(const
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return true;
 
 #ifdef DEBUG
   nsIMEUpdatePreference updatePreference = widget->GetIMEUpdatePreference();
   NS_ASSERTION(updatePreference.WantTextChange(),
                "Don't call Send/RecvNotifyIMETextChange without NOTIFY_TEXT_CHANGE");
-  MOZ_ASSERT(!aIMENotification.mTextChangeData.mCausedByComposition ||
+  MOZ_ASSERT(!aIMENotification.mTextChangeData.mCausedOnlyByComposition ||
                updatePreference.WantChangesCausedByComposition(),
     "The widget doesn't want text change notification caused by composition");
 #endif
 
   mContentCache.AssignContent(aContentCache, &aIMENotification);
   mContentCache.MaybeNotifyIME(widget, aIMENotification);
   return true;
 }
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -720,17 +720,22 @@ struct IMENotification final
     // mRemovalEndOffset is the end offset of modified or removed text in
     // original content.  If the value is same as mStartOffset, no text hasn't
     // been removed yet.
     uint32_t mRemovedEndOffset;
     // mAddedEndOffset is the end offset of inserted text or same as
     // mStartOffset if just removed.  The vlaue is offset in the new content.
     uint32_t mAddedEndOffset;
 
-    bool mCausedByComposition;
+    // Note that TextChangeDataBase may be the result of merging two or more
+    // changes especially in e10s mode.
+
+    // mCausedOnlyByComposition is true only when *all* merged changes are
+    // caused by composition.
+    bool mCausedOnlyByComposition;
     bool mOccurredDuringComposition;
 
     uint32_t OldLength() const
     {
       MOZ_ASSERT(IsValid());
       return mRemovedEndOffset - mStartOffset;
     }
     uint32_t NewLength() const
@@ -792,17 +797,17 @@ struct IMENotification final
     {
       MOZ_ASSERT(aRemovedEndOffset >= aStartOffset,
                  "removed end offset must not be smaller than start offset");
       MOZ_ASSERT(aAddedEndOffset >= aStartOffset,
                  "added end offset must not be smaller than start offset");
       mStartOffset = aStartOffset;
       mRemovedEndOffset = aRemovedEndOffset;
       mAddedEndOffset = aAddedEndOffset;
-      mCausedByComposition = aCausedByComposition;
+      mCausedOnlyByComposition = aCausedByComposition;
       mOccurredDuringComposition = aOccurredDuringComposition;
     }
   };
 
   struct MouseButtonEventData
   {
     // The value of WidgetEvent::mMessage
     EventMessage mEventMessage;
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -850,17 +850,17 @@ PuppetWidget::NotifyIMEOfTextChange(cons
   if (NS_WARN_IF(!mContentCache.CacheText(this, &aIMENotification))) {
     return NS_ERROR_FAILURE;
   }
 
   // TabParent doesn't this this to cache.  we don't send the notification
   // if parent process doesn't request NOTIFY_TEXT_CHANGE.
   if (mIMEPreferenceOfParent.WantTextChange() &&
       (mIMEPreferenceOfParent.WantChangesCausedByComposition() ||
-       !aIMENotification.mTextChangeData.mCausedByComposition)) {
+       !aIMENotification.mTextChangeData.mCausedOnlyByComposition)) {
     mTabChild->SendNotifyIMETextChange(mContentCache, aIMENotification);
   } else {
     mTabChild->SendUpdateContentCache(mContentCache);
   }
   return NS_OK;
 }
 
 nsresult
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -2159,20 +2159,20 @@ IMENotification::TextChangeDataBase::Mer
   // adjusted to be in same text.  The |oldData.mAddedEndOffset| should be
   // computed as in the new text because |mAddedEndOffset| indicates the end
   // offset of inserted text in the new text but |oldData.mAddedEndOffset|
   // doesn't include any changes of the text before |newData.mAddedEndOffset|.
 
   const TextChangeDataBase& newData = aOther;
   const TextChangeDataBase oldData = *this;
 
-  // mCausedByComposition should be true only when all changes are caused by
-  // composition.
-  mCausedByComposition =
-    newData.mCausedByComposition && oldData.mCausedByComposition;
+  // mCausedOnlyByComposition should be true only when all changes are caused
+  // by composition.
+  mCausedOnlyByComposition =
+    newData.mCausedOnlyByComposition && oldData.mCausedOnlyByComposition;
   // mOccurredDuringComposition should be true only when all changes occurred
   // during composition.
   mOccurredDuringComposition =
     newData.mOccurredDuringComposition && oldData.mOccurredDuringComposition;
 
   if (newData.mStartOffset >= oldData.mAddedEndOffset) {
     // Case 1:
     // If new start is after old end offset of added text, it means that text
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -780,26 +780,26 @@ struct ParamTraits<mozilla::widget::IMEN
 {
   typedef mozilla::widget::IMENotification::TextChangeDataBase paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mStartOffset);
     WriteParam(aMsg, aParam.mRemovedEndOffset);
     WriteParam(aMsg, aParam.mAddedEndOffset);
-    WriteParam(aMsg, aParam.mCausedByComposition);
+    WriteParam(aMsg, aParam.mCausedOnlyByComposition);
     WriteParam(aMsg, aParam.mOccurredDuringComposition);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
            ReadParam(aMsg, aIter, &aResult->mRemovedEndOffset) &&
            ReadParam(aMsg, aIter, &aResult->mAddedEndOffset) &&
-           ReadParam(aMsg, aIter, &aResult->mCausedByComposition) &&
+           ReadParam(aMsg, aIter, &aResult->mCausedOnlyByComposition) &&
            ReadParam(aMsg, aIter, &aResult->mOccurredDuringComposition);
   }
 };
 
 template<>
 struct ParamTraits<mozilla::widget::IMENotification::MouseButtonEventData>
 {
   typedef mozilla::widget::IMENotification::MouseButtonEventData paramType;
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -4596,30 +4596,30 @@ TSFTextStore::OnTextChangeInternal(const
 {
   const IMENotification::TextChangeDataBase& textChangeData =
     aIMENotification.mTextChangeData;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
          ("TSF: 0x%p   TSFTextStore::OnTextChangeInternal(aIMENotification={ "
           "mMessage=0x%08X, mTextChangeData={ mStartOffset=%lu, "
           "mRemovedEndOffset=%lu, mAddedEndOffset=%lu, "
-          "mCausedByComposition=%s, mOccurredDuringComposition=%s }), "
+          "mCausedOnlyByComposition=%s, mOccurredDuringComposition=%s }), "
           "mSink=0x%p, mSinkMask=%s, mComposition.IsComposing()=%s",
           this, aIMENotification.mMessage,
           textChangeData.mStartOffset,
           textChangeData.mRemovedEndOffset,
           textChangeData.mAddedEndOffset,
-          GetBoolName(textChangeData.mCausedByComposition),
+          GetBoolName(textChangeData.mCausedOnlyByComposition),
           GetBoolName(textChangeData.mOccurredDuringComposition),
           mSink.get(),
           GetSinkMaskNameStr(mSinkMask).get(),
           GetBoolName(mComposition.IsComposing())));
 
-  if (textChangeData.mCausedByComposition) {
-    // Ignore text change notifications caused by composition since it's
+  if (textChangeData.mCausedOnlyByComposition) {
+    // Ignore text change notifications caused only by composition since it's
     // already been handled internally.
     return NS_OK;
   }
 
   mDeferNotifyingTSF = false;
 
   if (IsReadLocked()) {
     // XXX If text change occurs during the document is locked, it must be