diff --git a/editor/libeditor/CSSEditUtils.h b/editor/libeditor/CSSEditUtils.h index a5f604b8f4d0..74f3b42dfd1d 100644 --- a/editor/libeditor/CSSEditUtils.h +++ b/editor/libeditor/CSSEditUtils.h @@ -7,7 +7,8 @@ #define mozilla_CSSEditUtils_h #include "mozilla/ChangeStyleTransaction.h" // for ChangeStyleTransaction -#include "nsCOMPtr.h" // for already_AddRefed +#include "mozilla/EditorForwards.h" +#include "nsCOMPtr.h" // for already_AddRefed #include "nsStringFwd.h" #include "nsTArray.h" // for nsTArray #include "nscore.h" // for nsAString, nsresult, nullptr @@ -21,8 +22,6 @@ class nsStaticAtom; class nsStyledElement; namespace mozilla { - -class HTMLEditor; namespace dom { class Element; } // namespace dom diff --git a/editor/libeditor/ChangeAttributeTransaction.h b/editor/libeditor/ChangeAttributeTransaction.h index 3e37f54b3e22..b21a64f221af 100644 --- a/editor/libeditor/ChangeAttributeTransaction.h +++ b/editor/libeditor/ChangeAttributeTransaction.h @@ -6,9 +6,10 @@ #ifndef ChangeAttributeTransaction_h #define ChangeAttributeTransaction_h -#include "mozilla/Attributes.h" // override -#include "mozilla/EditTransactionBase.h" // base class -#include "nsCOMPtr.h" // nsCOMPtr members +#include "EditTransactionBase.h" // base class + +#include "mozilla/Attributes.h" // override +#include "nsCOMPtr.h" // nsCOMPtr members #include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED #include "nsISupportsImpl.h" // NS_DECL_ISUPPORTS_INHERITED #include "nsString.h" // nsString members @@ -16,7 +17,6 @@ class nsAtom; namespace mozilla { - namespace dom { class Element; } // namespace dom diff --git a/editor/libeditor/ChangeStyleTransaction.h b/editor/libeditor/ChangeStyleTransaction.h index 58a27e99230a..5e65ee2a2da6 100644 --- a/editor/libeditor/ChangeStyleTransaction.h +++ b/editor/libeditor/ChangeStyleTransaction.h @@ -6,7 +6,8 @@ #ifndef mozilla_ChangeStyleTransaction_h #define mozilla_ChangeStyleTransaction_h -#include "mozilla/EditTransactionBase.h" // base class +#include "mozilla/EditTransactionBase.h" // base class + #include "nsCOMPtr.h" // nsCOMPtr members #include "nsCycleCollectionParticipant.h" // various macros #include "nsString.h" // nsString members diff --git a/editor/libeditor/CompositionTransaction.h b/editor/libeditor/CompositionTransaction.h index bf330c0814f6..c780aa362443 100644 --- a/editor/libeditor/CompositionTransaction.h +++ b/editor/libeditor/CompositionTransaction.h @@ -6,16 +6,15 @@ #ifndef CompositionTransaction_h #define CompositionTransaction_h -#include "mozilla/EditTransactionBase.h" // base class +#include "EditTransactionBase.h" // base class + +#include "EditorForwards.h" -#include "mozilla/EditorDOMPoint.h" // EditorDOMPointInText #include "mozilla/WeakPtr.h" #include "nsCycleCollectionParticipant.h" // various macros #include "nsString.h" // mStringToInsert namespace mozilla { - -class EditorBase; class TextComposition; class TextRangeArray; diff --git a/editor/libeditor/DeleteNodeTransaction.h b/editor/libeditor/DeleteNodeTransaction.h index 6ff3195f3703..dcae9f46cb9f 100644 --- a/editor/libeditor/DeleteNodeTransaction.h +++ b/editor/libeditor/DeleteNodeTransaction.h @@ -6,7 +6,10 @@ #ifndef DeleteNodeTransaction_h #define DeleteNodeTransaction_h -#include "mozilla/EditTransactionBase.h" +#include "EditTransactionBase.h" + +#include "EditorForwards.h" + #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsIContent.h" @@ -16,8 +19,6 @@ namespace mozilla { -class EditorBase; - /** * A transaction that deletes a single element */ diff --git a/editor/libeditor/DeleteRangeTransaction.h b/editor/libeditor/DeleteRangeTransaction.h index c7bce5001408..4de8fd09e775 100644 --- a/editor/libeditor/DeleteRangeTransaction.h +++ b/editor/libeditor/DeleteRangeTransaction.h @@ -7,6 +7,9 @@ #define DeleteRangeTransaction_h #include "EditAggregateTransaction.h" + +#include "EditorForwards.h" + #include "mozilla/RangeBoundary.h" #include "nsCycleCollectionParticipant.h" #include "nsID.h" @@ -19,9 +22,6 @@ class nsINode; namespace mozilla { -class EditorBase; -class RangeUpdater; - /** * A transaction that deletes an entire range in the content tree */ diff --git a/editor/libeditor/DeleteTextTransaction.h b/editor/libeditor/DeleteTextTransaction.h index caf9e1c45b20..8db1d4ae5fa4 100644 --- a/editor/libeditor/DeleteTextTransaction.h +++ b/editor/libeditor/DeleteTextTransaction.h @@ -6,7 +6,10 @@ #ifndef DeleteTextTransaction_h #define DeleteTextTransaction_h -#include "mozilla/EditTransactionBase.h" +#include "EditTransactionBase.h" + +#include "EditorForwards.h" + #include "mozilla/dom/Text.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" @@ -16,9 +19,6 @@ namespace mozilla { -class EditorBase; -class RangeUpdater; - /** * A transaction that removes text from a content node. */ diff --git a/editor/libeditor/EditActionListener.h b/editor/libeditor/EditActionListener.h deleted file mode 100644 index 0d814314e17b..000000000000 --- a/editor/libeditor/EditActionListener.h +++ /dev/null @@ -1,14 +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/. */ - -#ifndef __editActionListener_h__ -#define __editActionListener_h__ - -class EditActionListener { - public: - virtual void EditAction() = 0; -}; - -#endif /* __editActionListener_h__ */ diff --git a/editor/libeditor/EditAggregateTransaction.h b/editor/libeditor/EditAggregateTransaction.h index d9ae9b7f786f..6a24e202806a 100644 --- a/editor/libeditor/EditAggregateTransaction.h +++ b/editor/libeditor/EditAggregateTransaction.h @@ -6,7 +6,8 @@ #ifndef EditAggregateTransaction_h #define EditAggregateTransaction_h -#include "mozilla/EditTransactionBase.h" +#include "EditTransactionBase.h" + #include "mozilla/OwningNonNull.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" diff --git a/editor/libeditor/EditTransactionBase.h b/editor/libeditor/EditTransactionBase.h index b33221ea698b..408ef270b13f 100644 --- a/editor/libeditor/EditTransactionBase.h +++ b/editor/libeditor/EditTransactionBase.h @@ -6,6 +6,8 @@ #ifndef mozilla_EditTransactionBase_h #define mozilla_EditTransactionBase_h +#include "mozilla/EditorForwards.h" + #include "nsCycleCollectionParticipant.h" #include "nsISupportsImpl.h" #include "nsITransaction.h" @@ -21,21 +23,7 @@ nsITransaction::GetAsEditTransactionBase() { } namespace mozilla { - -class ChangeAttributeTransaction; -class ChangeStyleTransaction; -class CompositionTransaction; -class DeleteNodeTransaction; -class DeleteRangeTransaction; -class DeleteTextTransaction; -class EditAggregateTransaction; -class InsertNodeTransaction; -class InsertTextTransaction; -class JoinNodesTransaction; class LogModule; -class PlaceholderTransaction; -class ReplaceTextTransaction; -class SplitNodeTransaction; #define NS_DECL_GETASTRANSACTION_BASE(aClass) \ virtual aClass* GetAs##aClass(); \ diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index 80cfdf7488b0..2294bd6facf5 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -7,9 +7,10 @@ #define mozilla_EditorBase_h #include "mozilla/intl/BidiEmbeddingLevel.h" -#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc. -#include "mozilla/EditAction.h" // for EditAction and EditSubAction -#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint +#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc. +#include "mozilla/EditAction.h" // for EditAction and EditSubAction +#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint +#include "mozilla/EditorForwards.h" #include "mozilla/EventForwards.h" // for InputEventTargetRanges #include "mozilla/Likely.h" // for MOZ_UNLIKELY, MOZ_LIKELY #include "mozilla/Maybe.h" // for Maybe @@ -61,47 +62,17 @@ class nsRange; namespace mozilla { class AlignStateAtSelection; -class AutoRangeArray; -class AutoTopLevelEditSubActionNotifier; class AutoTransactionsConserveSelection; class AutoUpdateViewBatch; -class ChangeAttributeTransaction; -class CompositionTransaction; -class CSSEditUtils; -class DeleteNodeTransaction; -class DeleteRangeTransaction; -class DeleteTextTransaction; -class EditActionResult; -class EditAggregateTransaction; -class EditorEventListener; -class EditTransactionBase; class ErrorResult; -class HTMLEditor; -class HTMLEditUtils; class IMEContentObserver; -class InsertNodeTransaction; -class InsertTextTransaction; -class JoinNodesTransaction; class ListElementSelectionState; class ListItemElementSelectionState; class ParagraphStateAtSelection; -class PlaceholderTransaction; class PresShell; -class ReplaceTextTransaction; -class SplitNodeResult; -class SplitNodeTransaction; class TextComposition; -class TextEditor; class TextInputListener; class TextServicesDocument; -class TypeInState; -class WhiteSpaceVisibilityKeeper; - -enum class SplitNodeDirection; // Declrared in HTMLEditor.h - -template -class CreateNodeResultBase; -typedef CreateNodeResultBase CreateElementResult; namespace dom { class AbstractRange; @@ -1251,11 +1222,8 @@ class EditorBase : public nsIEditor, case EditSubAction::eComputeTextToOutput: case EditSubAction::eCreatePaddingBRElementForEmptyEditor: case EditSubAction::eNone: - MOZ_ASSERT(aDirection == eNone); - mDirectionOfTopLevelEditSubAction = eNone; - break; case EditSubAction::eReplaceHeadWithHTMLSource: - // NOTE: Not used with AutoTopLevelEditSubActionNotifier. + MOZ_ASSERT(aDirection == eNone); mDirectionOfTopLevelEditSubAction = eNone; break; case EditSubAction::eDeleteNode: diff --git a/editor/libeditor/EditorCommands.h b/editor/libeditor/EditorCommands.h index 356edf2f5ec2..6cfa6d9d92e2 100644 --- a/editor/libeditor/EditorCommands.h +++ b/editor/libeditor/EditorCommands.h @@ -6,6 +6,7 @@ #ifndef mozilla_EditorCommands_h #define mozilla_EditorCommands_h +#include "mozilla/EditorForwards.h" #include "mozilla/EventForwards.h" #include "mozilla/Maybe.h" #include "mozilla/StaticPtr.h" @@ -26,9 +27,6 @@ class nsStaticAtom; namespace mozilla { -class EditorBase; -class HTMLEditor; - /** * EditorCommandParamType tells you that EditorCommand subclasses refer * which type in nsCommandParams (e.g., bool or nsString) or do not refer. diff --git a/editor/libeditor/EditorDOMPoint.h b/editor/libeditor/EditorDOMPoint.h index 6b3e58172556..2db43859df4e 100644 --- a/editor/libeditor/EditorDOMPoint.h +++ b/editor/libeditor/EditorDOMPoint.h @@ -8,6 +8,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/EditorForwards.h" #include "mozilla/Maybe.h" #include "mozilla/RangeBoundary.h" #include "mozilla/ToString.h" @@ -26,9 +27,6 @@ namespace mozilla { -template -class EditorDOMPointBase; - /** * EditorDOMPoint and EditorRawDOMPoint are simple classes which refers * a point in the DOM tree at creating the instance or initializing the @@ -71,12 +69,6 @@ class EditorDOMPointBase; * AutoEditorDOMPointOffsetInvalidator and AutoEditorDOMPointChildInvalidator. */ -typedef EditorDOMPointBase, nsCOMPtr> - EditorDOMPoint; -typedef EditorDOMPointBase EditorRawDOMPoint; -typedef EditorDOMPointBase, nsIContent*> EditorDOMPointInText; -typedef EditorDOMPointBase EditorRawDOMPointInText; - #define NS_INSTANTIATE_EDITOR_DOM_POINT_METHOD(aResultType, aMethodName) \ template aResultType EditorDOMPoint::aMethodName; \ template aResultType EditorRawDOMPoint::aMethodName; \ @@ -1165,20 +1157,11 @@ inline void ImplCycleCollectionTraverse( ImplCycleCollectionTraverse(aCallback, aField.mChild, "mChild", 0); } -template -class EditorDOMRangeBase; - /** * EditorDOMRangeBase class stores a pair of same EditorDOMPointBase type. * The instance must be created with valid DOM points and start must be * before or same as end. */ - -typedef EditorDOMRangeBase EditorDOMRange; -typedef EditorDOMRangeBase EditorRawDOMRange; -typedef EditorDOMRangeBase EditorDOMRangeInTexts; -typedef EditorDOMRangeBase EditorRawDOMRangeInTexts; - template class EditorDOMRangeBase final { public: diff --git a/editor/libeditor/EditorEventListener.h b/editor/libeditor/EditorEventListener.h index 64f20739c5ce..fb85cbfdd505 100644 --- a/editor/libeditor/EditorEventListener.h +++ b/editor/libeditor/EditorEventListener.h @@ -6,6 +6,8 @@ #ifndef EditorEventListener_h #define EditorEventListener_h +#include "EditorForwards.h" + #include "mozilla/Attributes.h" #include "mozilla/EventForwards.h" #include "nsCOMPtr.h" @@ -29,10 +31,7 @@ class nsPresContext; #endif namespace mozilla { - -class EditorBase; class PresShell; - namespace dom { class DragEvent; class MouseEvent; diff --git a/editor/libeditor/EditorForwards.h b/editor/libeditor/EditorForwards.h new file mode 100644 index 000000000000..812a4d8a88bd --- /dev/null +++ b/editor/libeditor/EditorForwards.h @@ -0,0 +1,142 @@ +/* -*- 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/. */ + +#ifndef mozilla_EditorHelperForwards_h +#define mozilla_EditorHelperForwards_h + +#include + +/****************************************************************************** + * Forward declarations of other modules' + ******************************************************************************/ +class nsIContent; +class nsINode; + +template +class nsCOMPtr; + +template +class RefPtr; + +namespace mozilla { + +template +class OwningNonNull; + +namespace dom { +class Element; +class Text; +} // namespace dom + +/****************************************************************************** + * enum classes + ******************************************************************************/ + +enum class EditAction; // mozilla/EditAction.h +enum class EditorCommandParamType : uint16_t; // mozilla/EditorCommands.h +enum class EditSubAction : int32_t; // mozilla/EditAction.h +enum class ParagraphSeparator; // mozilla/HTMLEditor.h +enum class SpecifiedStyle : uint8_t; // mozilla/TypeInState.h + +enum class JoinNodesDirection; // HTMLEditHelper.h +enum class SplitNodeDirection; // HTMLEditHelper.h + +/****************************************************************************** + * classes or structs which are required for template classes/structs + ******************************************************************************/ + +template +class EditorDOMPointBase; // mozilla/EditorDOMPoint.h + +using EditorDOMPoint = + EditorDOMPointBase, nsCOMPtr>; +using EditorRawDOMPoint = EditorDOMPointBase; +using EditorDOMPointInText = EditorDOMPointBase, nsIContent*>; +using EditorRawDOMPointInText = EditorDOMPointBase; + +/****************************************************************************** + * classes + ******************************************************************************/ + +class AutoRangeArray; // mozilla/EditorUtils.h +class AutoSelectionRangeArray; // mozilla/EditorUtils.h +class AutoStyleCacheArray; // mozilla/TypeInState.h +class ChangeStyleTransaction; // mozilla/ChangeStyleTransaction.h +class CSSEditUtils; // mozilla/CSSEditUtils.h +class EditActionResult; // mozilla/EditorUtils.h +class EditTransactionBase; // mozilla/EditTransactionBase.h +class EditorBase; // mozilla/EditorBase.h +class HTMLEditor; // mozilla/HTMLEditor.h +class ManualNACPtr; // mozilla/ManualNAC.h +class RangeUpdater; // mozilla/SelectionState.h +class SelectionState; // mozilla/SelectionState.h +class StyleCache; // mozilla/TypeInState.h +class TextEditor; // mozilla/TextEditor.h +class TypeInState; // mozilla/TypeInState.h + +class ChangeAttributeTransaction; // ChangeAttributeTransaction.h +class CompositionTransaction; // CompositionTransaction.h +class DeleteNodeTransaction; // DeleteNodeTransaction.h +class DeleteRangeTransaction; // DeleteRangeTransaction.h +class DeleteTextTransaction; // DeleteTextTransaction.h +class EditAggregateTransaction; // EditAggregateTransaction.h +class EditorEventListener; // EditorEventListener.h +class EditResult; // HTMLEditHelpers.h +class HTMLEditorEventListener; // HTMLEditorEventListener.h +class InsertNodeTransaction; // IntertNodeTransaction.h +class InsertTextTransaction; // InsertTextTransaction.h +class InterCiter; // InterCiter.h +class JoinNodesResult; // HTMLEditHelpers.h +class JoinNodesTransaction; // JoinNodesTransaction.h +class MoveNodeResult; // HTMLEditHelpers.h +class PlaceholderTransaction; // PlaceholderTransaction.h +class ReplaceTextTransaction; // ReplaceTextTransaction.h +class SplitNodeResult; // HTMLEditHelpers.h +class SplitNodeTransaction; // SplitNodeTransaction.h +class SplitRangeOffFromNodeResult; // HTMLEditHelpers.h +class SplitRangeOffResult; // HTMLEditHelpers.h +class WhiteSpaceVisibilityKeeper; // WSRunObject.h +class WSRunScanner; // WSRunObject.h +class WSScanResult; // WSRunObject.h + +/****************************************************************************** + * structs + ******************************************************************************/ + +struct PropItem; // mozilla/TypeInState.h +struct RangeItem; // mozilla/SelectionState.h + +/****************************************************************************** + * template classes + ******************************************************************************/ + +template +class EditorDOMRangeBase; // mozilla/EditorDOMPoint.h + +template +class CreateNodeResultBase; // mozilla/EditorUtils.h + +template +class ReplaceRangeDataBase; // mozilla/EditorUtils.h + +/****************************************************************************** + * aliases + ******************************************************************************/ + +using CreateContentResult = CreateNodeResultBase; +using CreateElementResult = CreateNodeResultBase; +using CreateTextResult = CreateNodeResultBase; + +using EditorDOMRange = EditorDOMRangeBase; +using EditorRawDOMRange = EditorDOMRangeBase; +using EditorDOMRangeInTexts = EditorDOMRangeBase; +using EditorRawDOMRangeInTexts = EditorDOMRangeBase; + +using ReplaceRangeData = ReplaceRangeDataBase; +using ReplaceRangeInTextsData = ReplaceRangeDataBase; + +} // namespace mozilla + +#endif // #ifndef mozilla_EditorHelperForwards_h diff --git a/editor/libeditor/EditorUtils.h b/editor/libeditor/EditorUtils.h index f806c70aa586..7aec7a04ea3d 100644 --- a/editor/libeditor/EditorUtils.h +++ b/editor/libeditor/EditorUtils.h @@ -9,6 +9,7 @@ #include "mozilla/EditAction.h" #include "mozilla/EditorBase.h" #include "mozilla/EditorDOMPoint.h" +#include "mozilla/EditorForwards.h" #include "mozilla/IntegerRange.h" #include "mozilla/RangeBoundary.h" #include "mozilla/Result.h" @@ -28,7 +29,6 @@ class nsITransferable; namespace mozilla { -class MoveNodeResult; template class OwningNonNull; diff --git a/editor/libeditor/HTMLEditUtils.h b/editor/libeditor/HTMLEditUtils.h index 2315bf175697..ffaf03c04bb1 100644 --- a/editor/libeditor/HTMLEditUtils.h +++ b/editor/libeditor/HTMLEditUtils.h @@ -15,6 +15,7 @@ #include "mozilla/Attributes.h" #include "mozilla/EditorBase.h" #include "mozilla/EditorDOMPoint.h" +#include "mozilla/EditorForwards.h" #include "mozilla/EditorUtils.h" #include "mozilla/EnumSet.h" #include "mozilla/IntegerRange.h" @@ -35,8 +36,6 @@ class nsPresContext; namespace mozilla { -enum class EditAction; - class HTMLEditUtils final { using AbstractRange = dom::AbstractRange; using Element = dom::Element; diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index bf07872061e0..68966313d700 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -1394,10 +1394,9 @@ nsresult HTMLEditor::ReplaceHeadContentsWithSourceWithTransaction( CommitComposition(); - // Do not use AutoTopLevelEditSubActionNotifier -- rules code won't let us - // insert in . Use the head node as a parent and delete/insert - // directly. - // XXX We're using AutoTopLevelEditSubActionNotifier above... + // Do not use AutoEditSubActionNotifier -- rules code won't let us insert in + // . Use the head node as a parent and delete/insert directly. + // XXX We're using AutoEditSubActionNotifier above... RefPtr document = GetDocument(); if (NS_WARN_IF(!document)) { return NS_ERROR_NOT_INITIALIZED; diff --git a/editor/libeditor/HTMLEditor.h b/editor/libeditor/HTMLEditor.h index cd54595c88bb..2a2c9da80975 100644 --- a/editor/libeditor/HTMLEditor.h +++ b/editor/libeditor/HTMLEditor.h @@ -10,6 +10,7 @@ #include "mozilla/ComposerCommandsUpdater.h" #include "mozilla/CSSEditUtils.h" #include "mozilla/EditorBase.h" +#include "mozilla/EditorForwards.h" #include "mozilla/EditorUtils.h" #include "mozilla/HTMLEditHelpers.h" #include "mozilla/ManualNAC.h" @@ -47,25 +48,12 @@ namespace mozilla { class AlignStateAtSelection; class AutoSelectionSetterAfterTableEdit; class AutoSetTemporaryAncestorLimiter; -class EditActionResult; -class EditResult; class EmptyEditableFunctor; -class JoinNodesTransaction; class ListElementSelectionState; class ListItemElementSelectionState; -class MoveNodeResult; class ParagraphStateAtSelection; class ResizerSelectionListener; class Runnable; -class SplitNodeTransaction; -class SplitRangeOffFromNodeResult; -class SplitRangeOffResult; -class WhiteSpaceVisibilityKeeper; -class WSRunScanner; -class WSScanResult; -enum class EditSubAction : int32_t; -enum class SpecifiedStyle : uint8_t; -struct PropItem; template class OwningNonNull; namespace dom { diff --git a/editor/libeditor/HTMLEditorEventListener.h b/editor/libeditor/HTMLEditorEventListener.h index 1b9ff3b2afe2..201265dfabe8 100644 --- a/editor/libeditor/HTMLEditorEventListener.h +++ b/editor/libeditor/HTMLEditorEventListener.h @@ -7,7 +7,10 @@ #define HTMLEditorEventListener_h #include "EditorEventListener.h" -#include "mozilla/HTMLEditor.h" + +#include "EditorForwards.h" +#include "HTMLEditor.h" + #include "nscore.h" namespace mozilla { @@ -16,8 +19,6 @@ namespace dom { class Element; } -class EditorBase; - class HTMLEditorEventListener final : public EditorEventListener { public: HTMLEditorEventListener() diff --git a/editor/libeditor/InsertNodeTransaction.h b/editor/libeditor/InsertNodeTransaction.h index 7dbb3d7b8bd6..6806fcd4e1ae 100644 --- a/editor/libeditor/InsertNodeTransaction.h +++ b/editor/libeditor/InsertNodeTransaction.h @@ -6,9 +6,12 @@ #ifndef InsertNodeTransaction_h #define InsertNodeTransaction_h -#include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc. -#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint -#include "nsCOMPtr.h" // for nsCOMPtr +#include "EditTransactionBase.h" // for EditTransactionBase, etc. + +#include "EditorDOMPoint.h" // for EditorDOMPoint +#include "EditorForwards.h" + +#include "nsCOMPtr.h" // for nsCOMPtr #include "nsCycleCollectionParticipant.h" #include "nsIContent.h" // for nsIContent #include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED diff --git a/editor/libeditor/InsertTextTransaction.h b/editor/libeditor/InsertTextTransaction.h index 88c532d3a31a..6b839a777364 100644 --- a/editor/libeditor/InsertTextTransaction.h +++ b/editor/libeditor/InsertTextTransaction.h @@ -6,9 +6,10 @@ #ifndef InsertTextTransaction_h #define InsertTextTransaction_h -#include "mozilla/EditTransactionBase.h" // base class +#include "EditTransactionBase.h" // base class + +#include "EditorForwards.h" -#include "mozilla/EditorDOMPoint.h" // EditorDOMPointInText #include "nsCycleCollectionParticipant.h" // various macros #include "nsID.h" // NS_DECLARE_STATIC_IID_ACCESSOR #include "nsISupportsImpl.h" // NS_DECL_ISUPPORTS_INHERITED @@ -16,9 +17,6 @@ #include "nscore.h" // NS_IMETHOD, nsAString namespace mozilla { - -class EditorBase; - namespace dom { class Text; } // namespace dom diff --git a/editor/libeditor/JoinNodesTransaction.h b/editor/libeditor/JoinNodesTransaction.h index 8e883d417b42..e762cec47338 100644 --- a/editor/libeditor/JoinNodesTransaction.h +++ b/editor/libeditor/JoinNodesTransaction.h @@ -9,6 +9,7 @@ #include "EditTransactionBase.h" // for EditTransactionBase, etc. #include "EditorDOMPoint.h" // for EditorDOMPoint, etc. +#include "EditorForwards.h" #include "nsCOMPtr.h" // for nsCOMPtr #include "nsCycleCollectionParticipant.h" @@ -20,8 +21,6 @@ class nsINode; namespace mozilla { -class HTMLEditor; - /** * A transaction that joins two nodes E1 (left node) and E2 (right node) into a * single node E. The children of E are the children of E1 followed by the diff --git a/editor/libeditor/PlaceholderTransaction.h b/editor/libeditor/PlaceholderTransaction.h index 30d4d6131dc3..f70d9bb4a79d 100644 --- a/editor/libeditor/PlaceholderTransaction.h +++ b/editor/libeditor/PlaceholderTransaction.h @@ -7,14 +7,14 @@ #define PlaceholderTransaction_h #include "EditAggregateTransaction.h" +#include "EditorForwards.h" +#include "SelectionState.h" + #include "mozilla/Maybe.h" -#include "mozilla/SelectionState.h" #include "mozilla/WeakPtr.h" namespace mozilla { -class EditorBase; - /** * An aggregate transaction that knows how to absorb all subsequent * transactions with the same name. This transaction does not "Do" anything. diff --git a/editor/libeditor/ReplaceTextTransaction.h b/editor/libeditor/ReplaceTextTransaction.h index a4fc4388a7eb..cbdd62d38ec2 100644 --- a/editor/libeditor/ReplaceTextTransaction.h +++ b/editor/libeditor/ReplaceTextTransaction.h @@ -6,10 +6,12 @@ #ifndef ReplaceTextTransaction_h #define ReplaceTextTransaction_h +#include "EditorBase.h" +#include "EditorDOMPoint.h" +#include "EditorForwards.h" +#include "EditTransactionBase.h" + #include "mozilla/Attributes.h" -#include "mozilla/EditorBase.h" -#include "mozilla/EditorDOMPoint.h" -#include "mozilla/EditTransactionBase.h" #include "mozilla/Maybe.h" #include "mozilla/RefPtr.h" #include "mozilla/dom/Text.h" @@ -18,8 +20,6 @@ namespace mozilla { -class EditorBase; - class ReplaceTextTransaction final : public EditTransactionBase { private: ReplaceTextTransaction(EditorBase& aEditorBase, diff --git a/editor/libeditor/SelectionState.h b/editor/libeditor/SelectionState.h index d2f17e8cdee4..4091962829c5 100644 --- a/editor/libeditor/SelectionState.h +++ b/editor/libeditor/SelectionState.h @@ -7,6 +7,7 @@ #define mozilla_SelectionState_h #include "mozilla/EditorDOMPoint.h" +#include "mozilla/EditorForwards.h" #include "mozilla/Maybe.h" #include "mozilla/OwningNonNull.h" #include "nsCOMPtr.h" @@ -19,16 +20,12 @@ class nsCycleCollectionTraversalCallback; class nsRange; namespace mozilla { -class RangeUpdater; namespace dom { class Element; class Selection; class Text; } // namespace dom -enum class JoinNodesDirection; // Declared in HTMLEditHelpers.h -enum class SplitNodeDirection; // Declared in HTMLEditHelpers.h - /** * A helper struct for saving/setting ranges. */ diff --git a/editor/libeditor/SplitNodeTransaction.h b/editor/libeditor/SplitNodeTransaction.h index 63669297a689..a165530cf6f9 100644 --- a/editor/libeditor/SplitNodeTransaction.h +++ b/editor/libeditor/SplitNodeTransaction.h @@ -6,6 +6,7 @@ #ifndef SplitNodeTransaction_h #define SplitNodeTransaction_h +#include "EditorForwards.h" #include "EditTransactionBase.h" // for EditorTransactionBase #include "nsCOMPtr.h" // for nsCOMPtr @@ -16,12 +17,6 @@ namespace mozilla { -class HTMLEditor; -class SplitNodeResult; - -template -class EditorDOMPointBase; - /** * A transaction that splits a node into two identical nodes, with the children * divided between the new nodes. diff --git a/editor/libeditor/TextEditor.h b/editor/libeditor/TextEditor.h index 802132276661..0ad7e480a9e0 100644 --- a/editor/libeditor/TextEditor.h +++ b/editor/libeditor/TextEditor.h @@ -7,6 +7,7 @@ #define mozilla_TextEditor_h #include "mozilla/EditorBase.h" +#include "mozilla/EditorForwards.h" #include "mozilla/TextControlState.h" #include "mozilla/UniquePtr.h" @@ -25,10 +26,6 @@ class nsISelectionController; class nsITransferable; namespace mozilla { -class DeleteNodeTransaction; -class InsertNodeTransaction; -enum class EditSubAction : int32_t; - namespace dom { class Selection; } // namespace dom diff --git a/editor/libeditor/TypeInState.h b/editor/libeditor/TypeInState.h index 44c3d415f3e1..af7f69281616 100644 --- a/editor/libeditor/TypeInState.h +++ b/editor/libeditor/TypeInState.h @@ -7,6 +7,7 @@ #define mozilla_TypeInState_h #include "mozilla/EditorDOMPoint.h" +#include "mozilla/EditorForwards.h" #include "mozilla/EventForwards.h" #include "mozilla/UniquePtr.h" #include "nsCOMPtr.h" @@ -26,7 +27,6 @@ class nsAtom; class nsINode; namespace mozilla { -class HTMLEditor; namespace dom { class MouseEvent; class Selection; diff --git a/editor/libeditor/WSRunObject.h b/editor/libeditor/WSRunObject.h index c623d09bc479..34d49eef067f 100644 --- a/editor/libeditor/WSRunObject.h +++ b/editor/libeditor/WSRunObject.h @@ -6,12 +6,14 @@ #ifndef WSRunObject_h #define WSRunObject_h +#include "EditAction.h" +#include "EditorBase.h" +#include "EditorForwards.h" +#include "EditorDOMPoint.h" // for EditorDOMPoint +#include "HTMLEditor.h" + #include "HTMLEditUtils.h" #include "mozilla/Assertions.h" -#include "mozilla/EditAction.h" -#include "mozilla/EditorBase.h" -#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint -#include "mozilla/HTMLEditor.h" #include "mozilla/Maybe.h" #include "mozilla/Result.h" #include "mozilla/dom/Element.h" @@ -24,8 +26,6 @@ namespace mozilla { using namespace dom; -class WSRunScanner; - /** * WSScanResult is result of ScanNextVisibleNodeOrBlockBoundaryFrom(), * ScanPreviousVisibleNodeOrBlockBoundaryFrom(), and their static wrapper @@ -296,8 +296,6 @@ class MOZ_STACK_CLASS WSScanResult final { WSType mReason; }; -class WhiteSpaceVisibilityKeeper; - class MOZ_STACK_CLASS WSRunScanner final { public: using WSType = WSScanResult::WSType; diff --git a/editor/libeditor/moz.build b/editor/libeditor/moz.build index 1ed66b0d8656..72cc1a4dd5ae 100644 --- a/editor/libeditor/moz.build +++ b/editor/libeditor/moz.build @@ -21,6 +21,7 @@ EXPORTS.mozilla += [ "EditorCommands.h", "EditorController.h", "EditorDOMPoint.h", + "EditorForwards.h", "EditorUtils.h", "EditTransactionBase.h", "HTMLEditHelpers.h",