Bug 1304620 part.3 The start offset of TextComposition instance in the parent process shouldn't be updated with older composition in the remote process r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 12 Oct 2016 22:03:16 +0900
changeset 362883 64f030acc66bae6f210b5d8a2d82e38993bde2cf
parent 362882 97cb51652c868d8698c966ad0483f1421be1d449
child 362884 aa2c12432274f8926ffbc3b35502eedf176034b1
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.3 The start offset of TextComposition instance in the parent process shouldn't be updated with older composition in the remote process r=m_kato When ContentCacheInParent receives content information from the remote process, it notifies TextComposition of the latest composition start offset in the remote process. However, the information may be older composition's, i.e., the composition was already committed in the process but is still being handled by the remote process. TextComposition shouldn't work with such obsolete information. Note that TextComposition instance is created and destroyed when WidgetCompostionEvent is handled by IMEStateManager. Then, TextComposition instance guarantees that all following composition events for a composition are sent to same EventTarget (including TabParent). So, TextComposition is always synced with a composition in widget. MozReview-Commit-ID: 78NuvpE2rPx
widget/ContentCache.cpp
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -523,43 +523,45 @@ ContentCacheInParent::AssignContent(cons
   mCompositionStart = aOther.mCompositionStart;
   mText = aOther.mText;
   mSelection = aOther.mSelection;
   mFirstCharRect = aOther.mFirstCharRect;
   mCaret = aOther.mCaret;
   mTextRectArray = aOther.mTextRectArray;
   mEditorRect = aOther.mEditorRect;
 
-  if (mWidgetHasComposition) {
-    NS_WARNING_ASSERTION(mCompositionStart != UINT32_MAX, "mCompositionStart");
+  // Only when there is one composition, the TextComposition instance in this
+  // process is managing the composition in the remote process.  Therefore,
+  // we shouldn't update composition start offset of TextComposition with
+  // old composition which is still being handled by the child process.
+  if (mWidgetHasComposition && mPendingCompositionCount == 1) {
     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 }, mWidgetHasComposition=%s, "
-     "mCompositionStart=%u, mEditorRect=%s",
+     "mPendingCompositionCount=%u, 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(mWidgetHasComposition),
-     mCompositionStart, GetRectText(mEditorRect).get()));
+     mPendingCompositionCount, mCompositionStart,
+     GetRectText(mEditorRect).get()));
 }
 
 bool
 ContentCacheInParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent,
                                               nsIWidget* aWidget) const
 {
   MOZ_ASSERT(aWidget);