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
This commit is contained in:
Masayuki Nakano
2016-10-12 16:42:28 +09:00
parent 0232edda5d
commit 12c44fc34d
2 changed files with 21 additions and 18 deletions

View File

@@ -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()) {