mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1370806 - Part 2. Remove selection before calling nsIPlaintextEditor.setText. r=masayuki
nsIPlaintestEditor.setText still use BeginPlaceHolderTransaction and EndPlaceHolderTransaction. But since input.value setter doesn't create undo transaction, it is unnecessary to save/restore selection via AutoPlaceHolderBatch. So before calling setText, we should reset selection to reduce saving and restoring selection. Save/Restore selection is ~7% of input.value setter. MozReview-Commit-ID: 6yBKCtRmkQt --HG-- extra : rebase_source : 4df5d0629f083b75615b96b17bc108613fe80c24
This commit is contained in:
parent
5644a572f6
commit
e1017e8b12
@ -2661,6 +2661,11 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
||||
}
|
||||
} else {
|
||||
AutoDisableUndo disableUndo(mEditor);
|
||||
if (domSel) {
|
||||
// Since we don't use undo transaction, we don't need to store
|
||||
// selection state. SetText will set selection to tail.
|
||||
domSel->RemoveAllRanges();
|
||||
}
|
||||
|
||||
plaintextEditor->SetText(newValue);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user