зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1170484 - Use {Begin,End}PlaceHolderTransaction from mozInlineSpellCheck::ReplaceWord. r=ehsan
Both InsertText and DeleteSelection do a placeholder transaction. When the placeholder transaction depth drops to zero, we fire input events (which in turn does a microtask checkpoint). So we can prevent that from happening mid-operation by scoping a larger placeholder transaction around both calls.
This commit is contained in:
Родитель
696de26763
Коммит
d9d8ef80a5
|
@ -64,6 +64,7 @@
|
|||
#include "nsRange.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsEditorUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsITextControlElement.h"
|
||||
|
@ -945,7 +946,7 @@ mozInlineSpellChecker::ReplaceWord(nsIDOMNode *aNode, int32_t aOffset,
|
|||
|
||||
if (range)
|
||||
{
|
||||
editor->BeginTransaction();
|
||||
nsAutoPlaceHolderBatch(editor, nullptr);
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
res = editor->GetSelection(getter_AddRefs(selection));
|
||||
|
@ -957,8 +958,6 @@ mozInlineSpellChecker::ReplaceWord(nsIDOMNode *aNode, int32_t aOffset,
|
|||
nsCOMPtr<nsIPlaintextEditor> textEditor(do_QueryReferent(mEditor));
|
||||
if (textEditor)
|
||||
textEditor->InsertText(newword);
|
||||
|
||||
editor->EndTransaction();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче