Bug 1385514 - Part 1: Make SetTextTransaction a selection preserving transaction; r=masayuki

This makes the SetTextTransaction transaction behave more similarly to the rest of
the editor transactions, by making sure the inner transactions don't manipulate
the selections themselves and leave it up to the AfterEdit() method to take care of
adjusting the selection when the entire editing operation is finished.
This commit is contained in:
Ehsan Akhgari 2017-07-28 20:31:35 -04:00
Родитель d29f92675d
Коммит 5c7a6f8e12
1 изменённых файлов: 3 добавлений и 0 удалений

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

@ -901,6 +901,9 @@ TextEditRules::WillSetText(Selection& aSelection,
return NS_OK;
}
// don't spaz my selection in subtransactions
AutoTransactionsConserveSelection dontSpazMySelection(textEditor);
// Even if empty text, we don't remove text node and set empty text
// for performance
nsresult rv = textEditor->SetTextImpl(aSelection, tString,