Bug 1655706 - part 3-2: Move AutoTransactionsConserveSelection in HTMLEditor::TryToJoinBlocksWithTransaction() into each WhiteSpaceVisibilityKeeper method r=m_kato

Differential Revision: https://phabricator.services.mozilla.com/D85534
This commit is contained in:
Masayuki Nakano 2020-08-03 08:25:33 +00:00
parent 92735646e3
commit 8147272ea7
2 changed files with 6 additions and 2 deletions

View File

@ -4485,8 +4485,6 @@ EditActionResult HTMLEditor::TryToJoinBlocksWithTransaction(
}
}
AutoTransactionsConserveSelection dontChangeMySelection(*this);
// If the left block element is in the right block element, move the hard
// line including the right block element to end of the left block.
// However, if we are merging list elements, we don't join them.

View File

@ -146,6 +146,8 @@ EditActionResult WhiteSpaceVisibilityKeeper::
// - to delete invisible white-spaces before afterRightBlockChild.GetChild()
// - to delete invisible `<br>` element at end of aLeftBlockElement
AutoTransactionsConserveSelection dontChangeMySelection(aHTMLEditor);
EditorDOMPoint afterRightBlockChild = aAtRightBlockChild.NextPoint();
MOZ_ASSERT(afterRightBlockChild.IsSetAndValid());
nsresult rv = WhiteSpaceVisibilityKeeper::DeleteInvisibleASCIIWhiteSpaces(
@ -269,6 +271,8 @@ EditActionResult WhiteSpaceVisibilityKeeper::
// - to delete invisible white-spaces before aAtLeftBlockChild.GetChild()
// - to delete invisible `<br>` element before aAtLeftBlockChild.GetChild()
AutoTransactionsConserveSelection dontChangeMySelection(aHTMLEditor);
nsresult rv = WhiteSpaceVisibilityKeeper::DeleteInvisibleASCIIWhiteSpaces(
aHTMLEditor, EditorDOMPoint(&aRightBlockElement, 0));
if (NS_FAILED(rv)) {
@ -435,6 +439,8 @@ EditActionResult WhiteSpaceVisibilityKeeper::
// - to delete invisible white-spaces at start of aRightBlockElement
// - to delete invisible `<br>` element at end of aLeftBlockElement
AutoTransactionsConserveSelection dontChangeMySelection(aHTMLEditor);
// Adjust white-space at block boundaries
nsresult rv = WhiteSpaceVisibilityKeeper::
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange(