Bug 1242331 part.3 Rename TextChangeDataBase::mOccurredDuringComposition to mIncludingChangesDuringComposition r=smaug

This commit is contained in:
Masayuki Nakano 2016-01-28 13:28:53 +09:00
parent 2315e41c40
commit 88ab0e4e8e
5 changed files with 35 additions and 13 deletions

View File

@ -134,9 +134,12 @@ public:
return;
}
AppendPrintf("{ mStartOffset=%u, mRemovedEndOffset=%u, mAddedEndOffset=%u, "
"mCausedOnlyByComposition=%s }", aData.mStartOffset,
aData.mRemovedEndOffset, aData.mAddedEndOffset,
ToChar(aData.mCausedOnlyByComposition));
"mCausedOnlyByComposition=%s, "
"mIncludingChangesDuringComposition=%s }",
aData.mStartOffset, aData.mRemovedEndOffset,
aData.mAddedEndOffset,
ToChar(aData.mCausedOnlyByComposition),
ToChar(aData.mIncludingChangesDuringComposition));
}
virtual ~TextChangeDataToString() {}
};

View File

@ -731,7 +731,11 @@ struct IMENotification final
// mCausedOnlyByComposition is true only when *all* merged changes are
// caused by composition.
bool mCausedOnlyByComposition;
bool mOccurredDuringComposition;
// mIncludingChangesDuringComposition is true if at least one change which
// is not caused by composition occurred during the last composition.
// Note that if after the last composition is finished and there are some
// changes not caused by composition, this is set to false.
bool mIncludingChangesDuringComposition;
uint32_t OldLength() const
{
@ -803,7 +807,8 @@ struct IMENotification final
mRemovedEndOffset = aRemovedEndOffset;
mAddedEndOffset = aAddedEndOffset;
mCausedOnlyByComposition = aCausedByComposition;
mOccurredDuringComposition = aOccurredDuringComposition;
mIncludingChangesDuringComposition =
!aCausedByComposition && aOccurredDuringComposition;
}
};

View File

@ -2169,10 +2169,23 @@ IMENotification::TextChangeDataBase::MergeWith(
// by composition.
mCausedOnlyByComposition =
newData.mCausedOnlyByComposition && oldData.mCausedOnlyByComposition;
// mOccurredDuringComposition should be true only when all changes occurred
// during composition.
mOccurredDuringComposition =
newData.mOccurredDuringComposition && oldData.mOccurredDuringComposition;
// mIncludingChangesDuringComposition should be true when at least one of
// the merged non-composition changes occurred during the latest composition.
if (!newData.mCausedOnlyByComposition &&
!newData.mIncludingChangesDuringComposition) {
// If new change is neither caused by composition nor occurred during
// composition, set mIncludingChangesDuringComposition to false because
// IME doesn't want outdated text changes as text change during current
// composition.
mIncludingChangesDuringComposition = false;
} else {
// Otherwise, set mIncludingChangesDuringComposition to true if either
// oldData or newData includes changes during composition.
mIncludingChangesDuringComposition =
newData.mIncludingChangesDuringComposition ||
oldData.mIncludingChangesDuringComposition;
}
if (newData.mStartOffset >= oldData.mAddedEndOffset) {
// Case 1:

View File

@ -786,7 +786,7 @@ struct ParamTraits<mozilla::widget::IMENotification::TextChangeDataBase>
WriteParam(aMsg, aParam.mRemovedEndOffset);
WriteParam(aMsg, aParam.mAddedEndOffset);
WriteParam(aMsg, aParam.mCausedOnlyByComposition);
WriteParam(aMsg, aParam.mOccurredDuringComposition);
WriteParam(aMsg, aParam.mIncludingChangesDuringComposition);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@ -795,7 +795,7 @@ struct ParamTraits<mozilla::widget::IMENotification::TextChangeDataBase>
ReadParam(aMsg, aIter, &aResult->mRemovedEndOffset) &&
ReadParam(aMsg, aIter, &aResult->mAddedEndOffset) &&
ReadParam(aMsg, aIter, &aResult->mCausedOnlyByComposition) &&
ReadParam(aMsg, aIter, &aResult->mOccurredDuringComposition);
ReadParam(aMsg, aIter, &aResult->mIncludingChangesDuringComposition);
}
};

View File

@ -4605,14 +4605,15 @@ TSFTextStore::OnTextChangeInternal(const IMENotification& aIMENotification)
("TSF: 0x%p TSFTextStore::OnTextChangeInternal(aIMENotification={ "
"mMessage=0x%08X, mTextChangeData={ mStartOffset=%lu, "
"mRemovedEndOffset=%lu, mAddedEndOffset=%lu, "
"mCausedOnlyByComposition=%s, mOccurredDuringComposition=%s }), "
"mCausedOnlyByComposition=%s, "
"mIncludingChangesDuringComposition=%s }), "
"mSink=0x%p, mSinkMask=%s, mComposition.IsComposing()=%s",
this, aIMENotification.mMessage,
textChangeData.mStartOffset,
textChangeData.mRemovedEndOffset,
textChangeData.mAddedEndOffset,
GetBoolName(textChangeData.mCausedOnlyByComposition),
GetBoolName(textChangeData.mOccurredDuringComposition),
GetBoolName(textChangeData.mIncludingChangesDuringComposition),
mSink.get(),
GetSinkMaskNameStr(mSinkMask).get(),
GetBoolName(mComposition.IsComposing())));