Bug 1370806 - Part 1. Use RAII class for StartBatchChanges and EndBatchChanges. r=masayuki

Although we use StartBatchChanges and EndBatchChanges in nsTextEditorState::SetValue, we have a path that EndBatchChanges isn't called.  So we should use RAII class to call EndBatchChanges correctly.

MozReview-Commit-ID: 6bjtTT9wItA

--HG--
extra : rebase_source : dc9bdcb1a5ac4bca026e378c79355041d7f2384a
This commit is contained in:
Makoto Kato 2017-06-07 14:11:31 +09:00
Родитель dd69b19ef0
Коммит 5644a572f6
1 изменённых файлов: 2 добавлений и 12 удалений

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

@ -2616,16 +2616,10 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
AutoNoJSAPI nojsapi;
nsCOMPtr<nsISelection> domSel;
nsCOMPtr<nsISelectionPrivate> selPriv;
mSelCon->GetSelection(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(domSel));
if (domSel)
{
selPriv = do_QueryInterface(domSel);
if (selPriv) {
selPriv->StartBatchChanges();
}
}
SelectionBatcher selectionBatcher(domSel ? domSel->AsSelection() :
nullptr);
nsCOMPtr<nsIPlaintextEditor> plaintextEditor = do_QueryInterface(mEditor);
if (!plaintextEditor || !weakFrame.IsAlive()) {
@ -2692,10 +2686,6 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
return false;
}
}
if (selPriv) {
selPriv->EndBatchChanges();
}
}
}
} else {