Bug 1242331 part.4 Add TextChangeDataBase::mIncludingChangesWithoutComposition r=smaug
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -130,21 +130,23 @@ public:
const IMENotification::TextChangeDataBase& aData)
{
if (!aData.IsValid()) {
AppendLiteral("{ IsValid()=false }");
return;
}
AppendPrintf("{ mStartOffset=%u, mRemovedEndOffset=%u, mAddedEndOffset=%u, "
"mCausedOnlyByComposition=%s, "
- "mIncludingChangesDuringComposition=%s }",
+ "mIncludingChangesDuringComposition=%s, "
+ "mIncludingChangesWithoutComposition=%s }",
aData.mStartOffset, aData.mRemovedEndOffset,
aData.mAddedEndOffset,
ToChar(aData.mCausedOnlyByComposition),
- ToChar(aData.mIncludingChangesDuringComposition));
+ ToChar(aData.mIncludingChangesDuringComposition),
+ ToChar(aData.mIncludingChangesWithoutComposition));
}
virtual ~TextChangeDataToString() {}
};
/******************************************************************************
* mozilla::IMEContentObserver
******************************************************************************/
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -731,16 +731,19 @@ struct IMENotification final
// mCausedOnlyByComposition is true only when *all* merged changes are
// caused by composition.
bool mCausedOnlyByComposition;
// 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;
+ // mIncludingChangesWithoutComposition is true if there is at least one
+ // change which did occur when there wasn't a composition ongoing.
+ bool mIncludingChangesWithoutComposition;
uint32_t OldLength() const
{
MOZ_ASSERT(IsValid());
return mRemovedEndOffset - mStartOffset;
}
uint32_t NewLength() const
{
@@ -804,16 +807,18 @@ struct IMENotification final
MOZ_ASSERT(aAddedEndOffset >= aStartOffset,
"added end offset must not be smaller than start offset");
mStartOffset = aStartOffset;
mRemovedEndOffset = aRemovedEndOffset;
mAddedEndOffset = aAddedEndOffset;
mCausedOnlyByComposition = aCausedByComposition;
mIncludingChangesDuringComposition =
!aCausedByComposition && aOccurredDuringComposition;
+ mIncludingChangesWithoutComposition =
+ !aCausedByComposition && !aOccurredDuringComposition;
}
};
struct MouseButtonEventData
{
// The value of WidgetEvent::mMessage
EventMessage mEventMessage;
// Character offset from the start of the focused editor under the cursor
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -2164,21 +2164,29 @@ IMENotification::TextChangeDataBase::Mer
const TextChangeDataBase& newData = aOther;
const TextChangeDataBase oldData = *this;
// mCausedOnlyByComposition should be true only when all changes are caused
// by composition.
mCausedOnlyByComposition =
newData.mCausedOnlyByComposition && oldData.mCausedOnlyByComposition;
+
+ // mIncludingChangesWithoutComposition should be true if at least one of
+ // merged changes occurred without composition.
+ mIncludingChangesWithoutComposition =
+ newData.mIncludingChangesWithoutComposition ||
+ oldData.mIncludingChangesWithoutComposition;
+
// mIncludingChangesDuringComposition should be true when at least one of
// the merged non-composition changes occurred during the latest composition.
-
if (!newData.mCausedOnlyByComposition &&
!newData.mIncludingChangesDuringComposition) {
+ MOZ_ASSERT(newData.mIncludingChangesWithoutComposition);
+ MOZ_ASSERT(mIncludingChangesWithoutComposition);
// 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.
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -782,25 +782,29 @@ struct ParamTraits<mozilla::widget::IMEN
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mStartOffset);
WriteParam(aMsg, aParam.mRemovedEndOffset);
WriteParam(aMsg, aParam.mAddedEndOffset);
WriteParam(aMsg, aParam.mCausedOnlyByComposition);
WriteParam(aMsg, aParam.mIncludingChangesDuringComposition);
+ WriteParam(aMsg, aParam.mIncludingChangesWithoutComposition);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
ReadParam(aMsg, aIter, &aResult->mRemovedEndOffset) &&
ReadParam(aMsg, aIter, &aResult->mAddedEndOffset) &&
ReadParam(aMsg, aIter, &aResult->mCausedOnlyByComposition) &&
- ReadParam(aMsg, aIter, &aResult->mIncludingChangesDuringComposition);
+ ReadParam(aMsg, aIter,
+ &aResult->mIncludingChangesDuringComposition) &&
+ ReadParam(aMsg, aIter,
+ &aResult->mIncludingChangesWithoutComposition);
}
};
template<>
struct ParamTraits<mozilla::widget::IMENotification::MouseButtonEventData>
{
typedef mozilla::widget::IMENotification::MouseButtonEventData paramType;
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -4601,24 +4601,26 @@ TSFTextStore::OnTextChangeInternal(const
const IMENotification::TextChangeDataBase& textChangeData =
aIMENotification.mTextChangeData;
MOZ_LOG(sTextStoreLog, LogLevel::Debug,
("TSF: 0x%p TSFTextStore::OnTextChangeInternal(aIMENotification={ "
"mMessage=0x%08X, mTextChangeData={ mStartOffset=%lu, "
"mRemovedEndOffset=%lu, mAddedEndOffset=%lu, "
"mCausedOnlyByComposition=%s, "
- "mIncludingChangesDuringComposition=%s }), "
+ "mIncludingChangesDuringComposition=%s, "
+ "mIncludingChangesWithoutComposition=%s }), "
"mSink=0x%p, mSinkMask=%s, mComposition.IsComposing()=%s",
this, aIMENotification.mMessage,
textChangeData.mStartOffset,
textChangeData.mRemovedEndOffset,
textChangeData.mAddedEndOffset,
GetBoolName(textChangeData.mCausedOnlyByComposition),
GetBoolName(textChangeData.mIncludingChangesDuringComposition),
+ GetBoolName(textChangeData.mIncludingChangesWithoutComposition),
mSink.get(),
GetSinkMaskNameStr(mSinkMask).get(),
GetBoolName(mComposition.IsComposing())));
if (textChangeData.mCausedOnlyByComposition) {
// Ignore text change notifications caused only by composition since it's
// already been handled internally.
return NS_OK;