Bug 1717178 - part 7: Get rid of nsIEditor::AddEditorObserver() and nsIEditorObserver interface because of unused r=m_kato

Depends on D118802

Differential Revision: https://phabricator.services.mozilla.com/D118803
This commit is contained in:
Masayuki Nakano 2021-06-28 12:08:51 +00:00
parent 5017e990c8
commit 917dc274f8
5 changed files with 0 additions and 69 deletions

View File

@ -100,7 +100,6 @@
#include "nsIDocumentStateListener.h" // for nsIDocumentStateListener
#include "nsIDocShell.h" // for nsIDocShell
#include "nsIEditActionListener.h" // for nsIEditActionListener
#include "nsIEditorObserver.h" // for nsIEditorObserver
#include "nsIFrame.h" // for nsIFrame
#include "nsIInlineSpellChecker.h" // for nsIInlineSpellChecker, etc.
#include "nsNameSpaceManager.h" // for kNameSpaceID_None, etc.
@ -213,7 +212,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EditorBase)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextInputListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTransactionManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mActionListeners)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEditorObservers)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocStateListeners)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventTarget)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaceholderTransaction)
@ -237,7 +235,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EditorBase)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextInputListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransactionManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mActionListeners)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEditorObservers)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocStateListeners)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEventTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEventListener)
@ -622,7 +619,6 @@ void EditorBase::PreDestroyInternal() {
// If this editor is still hiding the caret, we need to restore it.
HideCaret(false);
mActionListeners.Clear();
mEditorObservers.Clear();
mDocStateListeners.Clear();
mInlineSpellChecker = nullptr;
mTextServicesDocument = nullptr;
@ -2259,26 +2255,6 @@ nsresult EditorBase::DeleteNodeWithTransaction(nsIContent& aContent) {
return rv;
}
NS_IMETHODIMP EditorBase::AddEditorObserver(nsIEditorObserver* aObserver) {
// we don't keep ownership of the observers. They must
// remove themselves as observers before they are destroyed.
if (NS_WARN_IF(!aObserver)) {
return NS_ERROR_INVALID_ARG;
}
// Make sure the listener isn't already on the list
if (mEditorObservers.Contains(aObserver)) {
return NS_OK;
}
mEditorObservers.AppendElement(*aObserver);
NS_WARNING_ASSERTION(
mEditorObservers.Length() != 1,
"nsIEditorObserver installed, this editor becomes slower");
return NS_OK;
}
NS_IMETHODIMP EditorBase::NotifySelectionChanged(Document* aDocument,
Selection* aSelection,
int16_t aReason) {
@ -2336,17 +2312,6 @@ void EditorBase::NotifyEditorObservers(
observer->OnEditActionHandled();
}
if (!mEditorObservers.IsEmpty()) {
// Copy the observers since EditAction()s can modify mEditorObservers.
AutoEditorObserverArray observers(mEditorObservers.Clone());
for (auto& observer : observers) {
DebugOnly<nsresult> rvIgnored = observer->EditAction();
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rvIgnored),
"nsIEditorObserver::EditAction() failed, but ignored");
}
}
if (!mDispatchInputEvent || IsEditActionAborted() ||
IsEditActionCanceled()) {
return;

View File

@ -47,7 +47,6 @@ class nsIContent;
class nsIDocumentEncoder;
class nsIDocumentStateListener;
class nsIEditActionListener;
class nsIEditorObserver;
class nsINode;
class nsIPrincipal;
class nsISupports;
@ -2834,12 +2833,6 @@ class EditorBase : public nsIEditor,
typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 2>
AutoActionListenerArray;
AutoActionListenerArray mActionListeners;
// Just notify once per high level change.
// Editor observer is used only by legacy addons for Thunderbird and
// BlueGriffon. So, we don't need to reserve the space for them.
typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 0>
AutoEditorObserverArray;
AutoEditorObserverArray mEditorObservers;
// Listen to overall doc state (dirty or not, just created, etc.).
// Document state listener is currently used by FinderHighlighter and
// BlueGriffon so that reserving only one is enough.

View File

@ -16,7 +16,6 @@ XPIDL_SOURCES += [
"nsIEditActionListener.idl",
"nsIEditor.idl",
"nsIEditorMailSupport.idl",
"nsIEditorObserver.idl",
"nsIEditorSpellCheck.idl",
"nsIHTMLAbsPosEditor.idl",
"nsIHTMLEditor.idl",

View File

@ -14,7 +14,6 @@ interface nsIDocumentStateListener;
interface nsIOutputStream;
interface nsITransactionManager;
interface nsITransaction;
interface nsIEditorObserver;
interface nsIEditActionListener;
interface nsIInlineSpellChecker;
interface nsITransferable;
@ -470,9 +469,6 @@ interface nsIEditor : nsISupports
* and document state listeners.
*/
/** add an EditorObserver to the editors list of observers. */
void addEditorObserver(in nsIEditorObserver observer);
/** add an EditActionListener to the editors list of listeners. */
void addEditActionListener(in nsIEditActionListener listener);

View File

@ -1,22 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/**
* nsIEditorObserver is the interface used by applications wishing to be
* notified when the editor has completed a user action.
* Note that when you want to use this from C++, please check if EditorBase
* can treat your class directly since using this interface may make editor
* slower.
*/
[scriptable, uuid(f3ee57a6-890c-4ce0-a584-8a84bba0292e)]
interface nsIEditorObserver : nsISupports
{
/**
* Called after the editor completes a user action.
*/
void EditAction();
};