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:
Bobby Holley 2015-08-19 16:48:42 -07:00
Родитель 696de26763
Коммит d9d8ef80a5
1 изменённых файлов: 2 добавлений и 3 удалений

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

@ -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;