diff --git a/widget/ContentCache.cpp b/widget/ContentCache.cpp index 9b2d0da27d33..74cd2942479b 100644 --- a/widget/ContentCache.cpp +++ b/widget/ContentCache.cpp @@ -510,7 +510,7 @@ ContentCacheInParent::ContentCacheInParent() : ContentCache() , mCommitStringByRequest(nullptr) , mPendingEventsNeedingAck(0) - , mIsComposing(false) + , mWidgetHasComposition(false) { } @@ -527,7 +527,7 @@ ContentCacheInParent::AssignContent(const ContentCache& aOther, mTextRectArray = aOther.mTextRectArray; mEditorRect = aOther.mEditorRect; - if (mIsComposing) { + if (mWidgetHasComposition) { NS_WARNING_ASSERTION(mCompositionStart != UINT32_MAX, "mCompositionStart"); IMEStateManager::MaybeStartOffsetUpdatedInChild(aWidget, mCompositionStart); } else { @@ -541,8 +541,8 @@ ContentCacheInParent::AssignContent(const ContentCache& aOther, "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(), @@ -552,7 +552,7 @@ ContentCacheInParent::AssignContent(const ContentCache& aOther, 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())); } @@ -601,7 +601,7 @@ ContentCacheInParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent, 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 " @@ -1058,16 +1058,16 @@ 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; @@ -1076,9 +1076,9 @@ ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent) } } - mIsComposing = !aEvent.CausesDOMCompositionEndEvent(); + mWidgetHasComposition = !aEvent.CausesDOMCompositionEndEvent(); - if (!mIsComposing) { + if (!mWidgetHasComposition) { mCompositionStart = UINT32_MAX; } @@ -1108,13 +1108,13 @@ ContentCacheInParent::OnSelectionEvent( ("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++; } @@ -1146,8 +1146,8 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget, { 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); @@ -1170,8 +1170,8 @@ ContentCacheInParent::RequestIMEToCommitComposition(nsIWidget* aWidget, 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()) { diff --git a/widget/ContentCache.h b/widget/ContentCache.h index 1b9ea305f67a..f3a7a3505e06 100644 --- a/widget/ContentCache.h +++ b/widget/ContentCache.h @@ -415,7 +415,10 @@ private: // 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