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

--HG--
extra : rebase_source : 69be70f22fb9b9dd6125ce390026b0740bd6de8f
This commit is contained in:
Masayuki Nakano 2016-10-12 16:42:28 +09:00
Родитель 124ddbc375
Коммит e9727adbec
2 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

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

Просмотреть файл

@ -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