Bug 1455533 - Part 3. Remove unused nsIEditor.outputToStream. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 20 Apr 2018 16:41:07 +0900
changeset 468626 dcfb7f0bb6a9171b8bcffaf488f152680ed82b65
parent 468625 0f70e84b0a3244fcbe5fa5752d251f1e0ff47cbd
child 468627 d1c67d1afe266d91994533cf9e31e3ead393efe8
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1455533
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455533 - Part 3. Remove unused nsIEditor.outputToStream. r=masayuki No one uses outputToStream even if c-c and BlueGriffon. We should remove this. MozReview-Commit-ID: LEUtfc89DBe
editor/libeditor/EditorBase.cpp
editor/libeditor/TextEditor.cpp
editor/libeditor/TextEditor.h
editor/nsIEditor.idl
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2263,26 +2263,16 @@ EditorBase::OutputToString(const nsAStri
                            uint32_t aFlags,
                            nsAString& aOutputString)
 {
   // these should be implemented by derived classes.
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-EditorBase::OutputToStream(nsIOutputStream* aOutputStream,
-                           const nsAString& aFormatType,
-                           const nsACString& aCharsetOverride,
-                           uint32_t aFlags)
-{
-  // these should be implemented by derived classes.
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 EditorBase::DumpContentTree()
 {
 #ifdef DEBUG
   if (mRootElement) {
     mRootElement->List(stdout);
   }
 #endif
   return NS_OK;
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -1593,17 +1593,17 @@ TextEditor::CanCopy(bool* aCanCopy)
 NS_IMETHODIMP
 TextEditor::CanDelete(bool* aCanDelete)
 {
   NS_ENSURE_ARG_POINTER(aCanDelete);
   *aCanDelete = IsModifiable() && CanCutOrCopy(ePasswordFieldAllowed);
   return NS_OK;
 }
 
-// Shared between OutputToString and OutputToStream
+// Used by OutputToString
 already_AddRefed<nsIDocumentEncoder>
 TextEditor::GetAndInitDocEncoder(const nsAString& aFormatType,
                                  uint32_t aFlags,
                                  const nsACString& aCharset)
 {
   nsCOMPtr<nsIDocumentEncoder> docEncoder;
   if (!mCachedDocumentEncoder ||
       !mCachedDocumentEncoderType.Equals(aFormatType)) {
@@ -1709,46 +1709,16 @@ TextEditor::OutputToString(const nsAStri
   if (NS_WARN_IF(!encoder)) {
     return NS_ERROR_FAILURE;
   }
 
   return encoder->EncodeToString(aOutputString);
 }
 
 NS_IMETHODIMP
-TextEditor::OutputToStream(nsIOutputStream* aOutputStream,
-                           const nsAString& aFormatType,
-                           const nsACString& aCharset,
-                           uint32_t aFlags)
-{
-  nsresult rv;
-
-  // special-case for empty document when requesting plain text,
-  // to account for the bogus text node.
-  // XXX Should there be a similar test in OutputToString?
-  if (aFormatType.EqualsLiteral("text/plain")) {
-    bool docEmpty;
-    rv = GetDocumentIsEmpty(&docEmpty);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (docEmpty) {
-      return NS_OK; // Output nothing.
-    }
-  }
-
-  nsCOMPtr<nsIDocumentEncoder> encoder =
-    GetAndInitDocEncoder(aFormatType, aFlags, aCharset);
-  if (NS_WARN_IF(!encoder)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return encoder->EncodeToStream(aOutputStream);
-}
-
-NS_IMETHODIMP
 TextEditor::InsertTextWithQuotations(const nsAString& aStringToInsert)
 {
   nsresult rv = InsertTextAsAction(aStringToInsert);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
--- a/editor/libeditor/TextEditor.h
+++ b/editor/libeditor/TextEditor.h
@@ -75,21 +75,16 @@ public:
   NS_IMETHOD PasteTransferable(nsITransferable* aTransferable) override;
   NS_IMETHOD CanPasteTransferable(nsITransferable* aTransferable,
                                   bool* aCanPaste) override;
 
   NS_IMETHOD OutputToString(const nsAString& aFormatType,
                             uint32_t aFlags,
                             nsAString& aOutputString) override;
 
-  NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
-                            const nsAString& aFormatType,
-                            const nsACString& aCharsetOverride,
-                            uint32_t aFlags) override;
-
   // Overrides of EditorBase
   virtual nsresult RemoveAttributeOrEquivalent(
                      Element* aElement,
                      nsAtom* aAttribute,
                      bool aSuppressTransaction) override;
   virtual nsresult SetAttributeOrEquivalent(Element* aElement,
                                             nsAtom* aAttribute,
                                             const nsAString& aValue,
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -458,21 +458,16 @@ interface nsIEditor  : nsISupports
 /* ------------ Output methods -------------- */
 
   /**
    * Output methods:
    * aFormatType is a mime type, like text/plain.
    */
   AString outputToString(in AString formatType,
                          in unsigned long flags);
-  void outputToStream(in nsIOutputStream aStream,
-                      in AString formatType,
-                      in ACString charsetOverride,
-                      in unsigned long flags);
-
 
   /* ------------ Various listeners methods --------------
    * nsIEditor holds strong references to the editor observers, action listeners
    * and document state listeners.
    */
 
   /** add an EditorObserver to the editors list of observers. */
   void addEditorObserver(in nsIEditorObserver observer);