Bug 1612085 - part 3: Remove dirty hack of Selection::mCachedRange r=smaug

Previously, I added `Selection::mCachedRange` to save allocation cost of
`nsRange`.  However, with the previous patch, we don't need the hack anymore
since ranges removed by `Selection::RemoveAllRanges()` are always kept in
the global cache of `nsRange`.  Therefore, we can remove the ugly hack right
now.

Differential Revision: https://phabricator.services.mozilla.com/D61239
This commit is contained in:
Masayuki Nakano
2020-01-30 12:44:33 +00:00
parent e530ecf2a0
commit da5eb5e37c
7 changed files with 26 additions and 161 deletions

View File

@@ -2834,10 +2834,10 @@ bool TextControlState::SetValueWithTextEditor(
if (selection) {
// Since we don't use undo transaction, we don't need to store
// selection state. SetText will set selection to tail.
// Note that textEditor will collapse selection to the end.
// Therefore, it's safe to use RemoveAllRangesTemporarily()
// here.
selection->RemoveAllRangesTemporarily();
IgnoredErrorResult ignoredError;
selection->RemoveAllRanges(ignoredError);
NS_WARNING_ASSERTION(!ignoredError.Failed(),
"Selection::RemoveAllRanges() failed, but ignored");
}
// In this case, we makes the editor stop dispatching "input"