зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176954 part.5 IMENotification::TextChangeDataBase should have a state which indicates that it's not initialized r=smaug
This commit is contained in:
Родитель
c1fdc81cac
Коммит
b5c03e059a
|
@ -1737,6 +1737,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
|||
// combine with this text change, and overflow might occur if
|
||||
// we just use INT32_MAX
|
||||
IMENotification notification(NOTIFY_IME_OF_TEXT_CHANGE);
|
||||
notification.mTextChangeData.mStartOffset = 0;
|
||||
notification.mTextChangeData.mRemovedEndOffset =
|
||||
notification.mTextChangeData.mAddedEndOffset = INT32_MAX / 2;
|
||||
NotifyIMEOfTextChange(notification);
|
||||
|
|
|
@ -189,6 +189,8 @@ protected:
|
|||
MOZ_ASSERT(aIMENotification.mMessage ==
|
||||
mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE,
|
||||
"IMEChange initialized with wrong notification");
|
||||
MOZ_ASSERT(aIMENotification.mTextChangeData.IsValid(),
|
||||
"The text change notification isn't initialized");
|
||||
MOZ_ASSERT(aIMENotification.mTextChangeData.IsInInt32Range(),
|
||||
"The text change notification is out of range");
|
||||
}
|
||||
|
|
|
@ -616,10 +616,7 @@ struct IMENotification
|
|||
mSelectionChangeData.mCausedByComposition = false;
|
||||
break;
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
mTextChangeData.mStartOffset = 0;
|
||||
mTextChangeData.mRemovedEndOffset = 0;
|
||||
mTextChangeData.mAddedEndOffset = 0;
|
||||
mTextChangeData.mCausedByComposition = false;
|
||||
mTextChangeData.Clear();
|
||||
break;
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
mMouseButtonEventData.mEventMessage = 0;
|
||||
|
@ -734,15 +731,36 @@ struct IMENotification
|
|||
|
||||
bool mCausedByComposition;
|
||||
|
||||
uint32_t OldLength() const { return mRemovedEndOffset - mStartOffset; }
|
||||
uint32_t NewLength() const { return mAddedEndOffset - mStartOffset; }
|
||||
uint32_t OldLength() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mRemovedEndOffset - mStartOffset;
|
||||
}
|
||||
uint32_t NewLength() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mAddedEndOffset - mStartOffset;
|
||||
}
|
||||
|
||||
bool IsInInt32Range() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mStartOffset <= INT32_MAX &&
|
||||
mRemovedEndOffset <= INT32_MAX &&
|
||||
mAddedEndOffset <= INT32_MAX;
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
return !(mStartOffset == UINT32_MAX &&
|
||||
!mRemovedEndOffset && !mAddedEndOffset);
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
mStartOffset = UINT32_MAX;
|
||||
mRemovedEndOffset = mAddedEndOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
union
|
||||
|
|
Загрузка…
Ссылка в новой задаче