Bug 1716728 - Part 1: Use IsEmpty() instead of mPaddingBRElementForEmptyEditor existence check r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D118063
This commit is contained in:
Kagami Sascha Rosylight 2021-06-21 01:48:58 +00:00
Родитель 1cc55fd4cf
Коммит 7851edce6e
2 изменённых файлов: 3 добавлений и 7 удалений

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

@ -1510,7 +1510,7 @@ nsresult EditorBase::ComputeValueInternal(const nsAString& aFormatType,
!(aDocumentEncoderFlags & (nsIDocumentEncoder::OutputSelectionOnly |
nsIDocumentEncoder::OutputWrap))) {
// Shortcut for empty editor case.
if (mPaddingBRElementForEmptyEditor) {
if (IsEmpty()) {
aOutputString.Truncate();
return NS_OK;
}

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

@ -1100,9 +1100,7 @@ EditActionResult HTMLEditor::HandleDeleteSelection(
// CreateStyleForInsertText()
TopLevelEditSubActionDataRef().mDidDeleteSelection = true;
// If there is only padding `<br>` element for empty editor, cancel the
// operation.
if (mPaddingBRElementForEmptyEditor) {
if (IsEmpty()) {
return EditActionCanceled();
}
@ -1400,9 +1398,7 @@ EditActionResult HTMLEditor::AutoDeleteRangesHandler::Run(
mOriginalDirectionAndAmount = aDirectionAndAmount;
mOriginalStripWrappers = aStripWrappers;
// If there is only padding `<br>` element for empty editor, cancel the
// operation.
if (aHTMLEditor.mPaddingBRElementForEmptyEditor) {
if (aHTMLEditor.IsEmpty()) {
return EditActionCanceled();
}