Skip to content

Commit

Permalink
Bug 1716728 - Part 4: Remove EnsureNoPaddingBRElementForEmptyEditor c…
Browse files Browse the repository at this point in the history
…all for TextEditor r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D118066
  • Loading branch information
saschanaz committed Jun 21, 2021
1 parent 9ce4c9c commit b704155
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
24 changes: 3 additions & 21 deletions editor/libeditor/TextEditSubActionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ EditActionResult TextEditor::InsertLineFeedCharacterAtSelection() {
}
}

nsresult rv = EnsureNoPaddingBRElementForEmptyEditor();
if (NS_FAILED(rv)) {
NS_WARNING("EditorBase::EnsureNoPaddingBRElementForEmptyEditor() failed");
return EditActionIgnored(rv);
}

// get the (collapsed) selection location
const nsRange* firstRange = SelectionRef().GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
Expand All @@ -204,8 +198,8 @@ EditActionResult TextEditor::InsertLineFeedCharacterAtSelection() {

// Insert a linefeed character.
EditorRawDOMPoint pointAfterInsertedLineFeed;
rv = InsertTextWithTransaction(*document, u"\n"_ns, pointToInsert,
&pointAfterInsertedLineFeed);
nsresult rv = InsertTextWithTransaction(*document, u"\n"_ns, pointToInsert,
&pointAfterInsertedLineFeed);
if (!pointAfterInsertedLineFeed.IsSet()) {
NS_WARNING(
"EditorBase::InsertTextWithTransaction(\\n) didn't return position of "
Expand Down Expand Up @@ -405,12 +399,6 @@ EditActionResult TextEditor::HandleInsertText(

MaybeDoAutoPasswordMasking();

nsresult rv = EnsureNoPaddingBRElementForEmptyEditor();
if (NS_FAILED(rv)) {
NS_WARNING("EditorBase::EnsureNoPaddingBRElementForEmptyEditor() failed");
return EditActionHandled(rv);
}

// People have lots of different ideas about what text fields
// should do with multiline pastes. See bugs 21032, 23485, 23485, 50935.
// The six possible options are:
Expand Down Expand Up @@ -540,12 +528,6 @@ EditActionResult TextEditor::SetTextWithoutTransaction(

MaybeDoAutoPasswordMasking();

nsresult rv = EnsureNoPaddingBRElementForEmptyEditor();
if (NS_FAILED(rv)) {
NS_WARNING("EditorBase::EnsureNoPaddingBRElementForEmptyEditor() failed");
return EditActionResult(rv);
}

RefPtr<Element> anonymousDivElement = GetRoot();
RefPtr<Text> textNode =
Text::FromNodeOrNull(anonymousDivElement->GetFirstChild());
Expand Down Expand Up @@ -574,7 +556,7 @@ EditActionResult TextEditor::SetTextWithoutTransaction(
HandleNewLinesInStringForSingleLineEditor(sanitizedValue);
}

rv = SetTextNodeWithoutTransaction(sanitizedValue, *textNode);
nsresult rv = SetTextNodeWithoutTransaction(sanitizedValue, *textNode);
if (NS_FAILED(rv)) {
NS_WARNING("EditorBase::SetTextNodeWithoutTransaction() failed");
return EditActionResult(rv);
Expand Down
6 changes: 0 additions & 6 deletions editor/libeditor/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,6 @@ nsresult TextEditor::InsertWithQuotationsAsSubAction(
// also in single line editor)?
MaybeDoAutoPasswordMasking();

rv = EnsureNoPaddingBRElementForEmptyEditor();
if (NS_FAILED(rv)) {
NS_WARNING("EditorBase::EnsureNoPaddingBRElementForEmptyEditor() failed");
return rv;
}

rv = InsertTextAsSubAction(quotedStuff);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"EditorBase::InsertTextAsSubAction() failed");
Expand Down

0 comments on commit b704155

Please sign in to comment.