diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp index 0af32da77284..fa98b74338ff 100644 --- a/editor/libeditor/HTMLEditorDataTransfer.cpp +++ b/editor/libeditor/HTMLEditorDataTransfer.cpp @@ -2916,12 +2916,15 @@ NS_IMETHODIMP HTMLEditor::Rewrap(bool aRespectNewlines) { } nsAutoString current; - bool isCollapsed; - rv = SharedOutputString(nsIDocumentEncoder::OutputFormatted | - nsIDocumentEncoder::OutputLFLineBreak, - &isCollapsed, current); + const bool isCollapsed = SelectionRef().IsCollapsed(); + uint32_t flags = nsIDocumentEncoder::OutputFormatted | + nsIDocumentEncoder::OutputLFLineBreak; + if (!isCollapsed) { + flags |= nsIDocumentEncoder::OutputSelectionOnly; + } + rv = ComputeValueInternal(u"text/plain"_ns, flags, current); if (NS_FAILED(rv)) { - NS_WARNING("TextEditor::SharedOutputString() failed"); + NS_WARNING("TextEditor::ComputeValueInternal(text/plain) failed"); return EditorBase::ToGenericNSResult(rv); } diff --git a/editor/libeditor/TextEditor.cpp b/editor/libeditor/TextEditor.cpp index 694b443b098f..b0dfeb037e5f 100644 --- a/editor/libeditor/TextEditor.cpp +++ b/editor/libeditor/TextEditor.cpp @@ -747,22 +747,6 @@ nsresult TextEditor::InsertWithQuotationsAsSubAction( return rv; } -nsresult TextEditor::SharedOutputString(uint32_t aFlags, bool* aIsCollapsed, - nsAString& aResult) const { - MOZ_ASSERT(IsEditActionDataAvailable()); - - *aIsCollapsed = SelectionRef().IsCollapsed(); - - if (!*aIsCollapsed) { - aFlags |= nsIDocumentEncoder::OutputSelectionOnly; - } - // If the selection isn't collapsed, we'll use the whole document. - nsresult rv = ComputeValueInternal(u"text/plain"_ns, aFlags, aResult); - NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), - "TextEditor::ComputeValueInternal(text/plain) failed"); - return rv; -} - nsresult TextEditor::SelectEntireDocument() { MOZ_ASSERT(IsEditActionDataAvailable()); MOZ_ASSERT(!AsHTMLEditor()); diff --git a/editor/libeditor/TextEditor.h b/editor/libeditor/TextEditor.h index 56fbd61a9c85..7224194cd23b 100644 --- a/editor/libeditor/TextEditor.h +++ b/editor/libeditor/TextEditor.h @@ -556,13 +556,6 @@ class TextEditor : public EditorBase, public nsITimerCallback, public nsINamed { [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult InsertTextFromTransferable(nsITransferable* transferable); - /** - * Shared outputstring; returns whether selection is collapsed and resulting - * string. - */ - nsresult SharedOutputString(uint32_t aFlags, bool* aIsCollapsed, - nsAString& aResult) const; - bool IsCopyToClipboardAllowedInternal() const final; virtual already_AddRefed GetInputEventTargetElement() const override;