Skip to content

Commit

Permalink
Bug 1491199 - Get rid of nsIEditorBlobListener. r=masayuki
Browse files Browse the repository at this point in the history
Since bug 1489812 is landed, we can get rid of nsIEditorBlobListener.

Differential Revision: https://phabricator.services.mozilla.com/D5844
  • Loading branch information
makotokato committed Sep 18, 2018
1 parent bebef5d commit d1d086c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
11 changes: 7 additions & 4 deletions editor/libeditor/HTMLEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "nsICSSLoaderObserver.h"
#include "nsIDocumentObserver.h"
#include "nsIDOMEventListener.h"
#include "nsIEditorBlobListener.h"
#include "nsIEditorMailSupport.h"
#include "nsIEditorStyleSheets.h"
#include "nsIHTMLAbsPosEditor.h"
Expand Down Expand Up @@ -1490,16 +1489,19 @@ class HTMLEditor final : public TextEditor
MaybeCollapseSelectionAtFirstEditableNode(
bool aIgnoreIfSelectionInEditingHost);

class BlobReader final : public nsIEditorBlobListener
class BlobReader final
{
public:
BlobReader(dom::BlobImpl* aBlob, HTMLEditor* aHTMLEditor,
bool aIsSafe, nsIDocument* aSourceDoc,
nsINode* aDestinationNode, int32_t aDestOffset,
bool aDoDeleteSelection);

NS_DECL_ISUPPORTS
NS_DECL_NSIEDITORBLOBLISTENER
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(BlobReader)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(BlobReader)

nsresult OnResult(const nsACString& aResult);
nsresult OnError(const nsAString& aErrorName);

private:
~BlobReader()
Expand Down Expand Up @@ -2265,6 +2267,7 @@ class HTMLEditor final : public TextEditor
friend class EditorBase;
friend class EmptyEditableFunctor;
friend class HTMLEditRules;
friend class SlurpBlobEventListener;
friend class TextEditor;
friend class WSRunObject;
};
Expand Down
27 changes: 22 additions & 5 deletions editor/libeditor/HTMLEditorDataTransfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,24 @@ ImgFromData(const nsACString& aType, const nsACString& aData, nsString& aOutput)
return NS_OK;
}

NS_IMPL_ISUPPORTS(HTMLEditor::BlobReader, nsIEditorBlobListener)
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLEditor::BlobReader)

NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HTMLEditor::BlobReader)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBlob)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHTMLEditor)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceDoc)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDestinationNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(HTMLEditor::BlobReader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBlob)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHTMLEditor)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceDoc)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDestinationNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(HTMLEditor::BlobReader, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(HTMLEditor::BlobReader, Release)

HTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob,
HTMLEditor* aHTMLEditor,
Expand All @@ -978,7 +995,7 @@ HTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob,
MOZ_ASSERT(mDestinationNode);
}

NS_IMETHODIMP
nsresult
HTMLEditor::BlobReader::OnResult(const nsACString& aResult)
{
nsString blobType;
Expand All @@ -1000,7 +1017,7 @@ HTMLEditor::BlobReader::OnResult(const nsACString& aResult)
return rv;
}

NS_IMETHODIMP
nsresult
HTMLEditor::BlobReader::OnError(const nsAString& aError)
{
const nsPromiseFlatString& flat = PromiseFlatString(aError);
Expand All @@ -1020,7 +1037,7 @@ class SlurpBlobEventListener final : public nsIDOMEventListener
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(SlurpBlobEventListener)

explicit SlurpBlobEventListener(nsIEditorBlobListener* aListener)
explicit SlurpBlobEventListener(HTMLEditor::BlobReader* aListener)
: mListener(aListener)
{ }

Expand All @@ -1029,7 +1046,7 @@ class SlurpBlobEventListener final : public nsIDOMEventListener
private:
~SlurpBlobEventListener() = default;

RefPtr<nsIEditorBlobListener> mListener;
RefPtr<HTMLEditor::BlobReader> mListener;
};

NS_IMPL_CYCLE_COLLECTION(SlurpBlobEventListener, mListener)
Expand Down
1 change: 0 additions & 1 deletion editor/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ XPIDL_SOURCES += [
'nsIDocumentStateListener.idl',
'nsIEditActionListener.idl',
'nsIEditor.idl',
'nsIEditorBlobListener.idl',
'nsIEditorMailSupport.idl',
'nsIEditorObserver.idl',
'nsIEditorSpellCheck.idl',
Expand Down
14 changes: 0 additions & 14 deletions editor/nsIEditorBlobListener.idl

This file was deleted.

0 comments on commit d1d086c

Please sign in to comment.