Bug 1189396 part.6 IMEContentObserver shouldn't notify IME of selection change when the range isn't actually changed r=smaug

This commit is contained in:
Masayuki Nakano 2015-08-22 01:43:42 +09:00
Родитель 0ac9d740da
Коммит 121929fce3
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -1086,6 +1086,7 @@ IMEContentObserver::SelectionChangeEvent::Run()
return NS_OK;
}
SelectionChangeData lastSelChangeData = mIMEContentObserver->mSelectionData;
if (NS_WARN_IF(!mIMEContentObserver->UpdateSelectionCache())) {
return NS_OK;
}
@ -1103,6 +1104,17 @@ IMEContentObserver::SelectionChangeEvent::Run()
return NS_OK;
}
// If the selection isn't changed actually, we shouldn't notify IME of
// selection change.
SelectionChangeData& newSelChangeData = mIMEContentObserver->mSelectionData;
if (lastSelChangeData.IsValid() &&
lastSelChangeData.mOffset == newSelChangeData.mOffset &&
lastSelChangeData.String() == newSelChangeData.String() &&
lastSelChangeData.GetWritingMode() == newSelChangeData.GetWritingMode() &&
lastSelChangeData.mReversed == newSelChangeData.mReversed) {
return NS_OK;
}
IMENotification notification(NOTIFY_IME_OF_SELECTION_CHANGE);
notification.SetData(mIMEContentObserver->mSelectionData,
mCausedByComposition, mCausedBySelectionEvent);