Bug 1508252 - Set temporary range when replacement range is available. r=masayuki

This issue is e10s only.

Even if calling SetSelection, it doesn't reset selection cache in
TextInputHandler.  Since selection cache is updated by OnSelectionChange
asynchronous, we should set temporary range when having replacement range.

Also, even if marking dirty doesn't fix this issue. Content cache may return
other range such as caret position instead of replacement range by SetSelection.

Differential Revision: https://phabricator.services.mozilla.com/D14002

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2018-12-10 03:17:15 +00:00
Родитель 3dec5bb706
Коммит e1efe6db2a
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -4065,7 +4065,12 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString,
// range as selection.
if (aReplacementRange && aReplacementRange->location != NSNotFound &&
!NSEqualRanges(SelectedRange(), *aReplacementRange)) {
NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange));
// Set temporary selection range since OnSelectionChange is async.
mSelectedRange = *aReplacementRange;
if (NS_WARN_IF(!SetSelection(*aReplacementRange))) {
mSelectedRange.location = NSNotFound; // Marking dirty
return;
}
}
mMarkedRange.location = SelectedRange().location;