Bug 1683534 - Make `editor` buildable outside of `unified-build` environment. r=sg
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Mon, 04 Jan 2021 14:18:50 +0000
changeset 561870 dcf530eb3c57da249ef8dc3cf10577b04d75ccae
parent 561869 dad43f96a46d74bf451818600e5903cecaf13a4b
child 561871 3152eaef8deb827ebf6abcebb2f2d219c9c6afab
push id38075
push userdluca@mozilla.com
push dateTue, 05 Jan 2021 04:31:31 +0000
treeherdermozilla-central@1d89f3cb5bb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssg
bugs1683534
milestone86.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 1683534 - Make `editor` buildable outside of `unified-build` environment. r=sg Differential Revision: https://phabricator.services.mozilla.com/D100206
build/non-unified-compat
editor/composer/nsEditingSession.cpp
editor/libeditor/EditAggregateTransaction.cpp
editor/libeditor/EditorUtils.cpp
editor/libeditor/HTMLAbsPositionEditor.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorEventListener.h
editor/libeditor/HTMLEditorState.cpp
editor/libeditor/WSRunObject.h
editor/txmgr/TransactionStack.cpp
xpcom/ds/nsDeque.h
--- a/build/non-unified-compat
+++ b/build/non-unified-compat
@@ -72,9 +72,14 @@ dom/webgpu/
 dom/webidl/
 dom/webshare/
 dom/websocket/
 dom/workers/
 dom/worklet/
 dom/xhr/
 dom/xml/
 dom/xslt/
-dom/xul/
\ No newline at end of file
+dom/xul/
+editor/composer/
+editor/libeditor/
+editor/reftests/
+editor/spellchecker/
+editor/txmgr/
--- a/editor/composer/nsEditingSession.cpp
+++ b/editor/composer/nsEditingSession.cpp
@@ -14,40 +14,41 @@
 #include "mozilla/PresShell.h"                // for PresShell
 #include "nsAString.h"
 #include "nsBaseCommandController.h"  // for nsBaseCommandController
 #include "nsCommandManager.h"         // for nsCommandManager
 #include "nsComponentManagerUtils.h"  // for do_CreateInstance
 #include "nsContentUtils.h"
 #include "nsDebug.h"  // for NS_ENSURE_SUCCESS, etc
 #include "nsEditingSession.h"
-#include "nsError.h"                     // for NS_ERROR_FAILURE, NS_OK, etc
-#include "nsIChannel.h"                  // for nsIChannel
-#include "nsIContentViewer.h"            // for nsIContentViewer
-#include "nsIControllers.h"              // for nsIControllers
-#include "nsID.h"                        // for NS_GET_IID, etc
-#include "nsHTMLDocument.h"              // for nsHTMLDocument
-#include "nsIDocShell.h"                 // for nsIDocShell
-#include "mozilla/dom/Document.h"        // for Document
-#include "nsIEditor.h"                   // for nsIEditor
-#include "nsIInterfaceRequestorUtils.h"  // for do_GetInterface
-#include "nsIRefreshURI.h"               // for nsIRefreshURI
-#include "nsIRequest.h"                  // for nsIRequest
-#include "nsITimer.h"                    // for nsITimer, etc
-#include "nsIWeakReference.h"            // for nsISupportsWeakReference, etc
-#include "nsIWebNavigation.h"            // for nsIWebNavigation
-#include "nsIWebProgress.h"              // for nsIWebProgress, etc
-#include "nsLiteralString.h"             // for NS_LITERAL_STRING
-#include "nsPIDOMWindow.h"               // for nsPIDOMWindow
-#include "nsPresContext.h"               // for nsPresContext
-#include "nsReadableUtils.h"             // for AppendUTF16toUTF8
-#include "nsStringFwd.h"                 // for nsString
-#include "mozilla/dom/Selection.h"       // for AutoHideSelectionChanges, etc
-#include "nsFrameSelection.h"            // for nsFrameSelection
-#include "nsBaseCommandController.h"     // for nsBaseCommandController
+#include "nsError.h"                      // for NS_ERROR_FAILURE, NS_OK, etc
+#include "nsIChannel.h"                   // for nsIChannel
+#include "nsIContentViewer.h"             // for nsIContentViewer
+#include "nsIControllers.h"               // for nsIControllers
+#include "nsID.h"                         // for NS_GET_IID, etc
+#include "nsHTMLDocument.h"               // for nsHTMLDocument
+#include "nsIDocShell.h"                  // for nsIDocShell
+#include "mozilla/dom/Document.h"         // for Document
+#include "nsIEditor.h"                    // for nsIEditor
+#include "nsIInterfaceRequestorUtils.h"   // for do_GetInterface
+#include "nsIRefreshURI.h"                // for nsIRefreshURI
+#include "nsIRequest.h"                   // for nsIRequest
+#include "nsITimer.h"                     // for nsITimer, etc
+#include "nsIWeakReference.h"             // for nsISupportsWeakReference, etc
+#include "nsIWebNavigation.h"             // for nsIWebNavigation
+#include "nsIWebProgress.h"               // for nsIWebProgress, etc
+#include "nsLiteralString.h"              // for NS_LITERAL_STRING
+#include "nsPIDOMWindow.h"                // for nsPIDOMWindow
+#include "nsPresContext.h"                // for nsPresContext
+#include "nsReadableUtils.h"              // for AppendUTF16toUTF8
+#include "nsStringFwd.h"                  // for nsString
+#include "mozilla/dom/BrowsingContext.h"  // for BrowsingContext
+#include "mozilla/dom/Selection.h"        // for AutoHideSelectionChanges, etc
+#include "nsFrameSelection.h"             // for nsFrameSelection
+#include "nsBaseCommandController.h"      // for nsBaseCommandController
 #include "mozilla/dom/LoadURIOptionsBinding.h"
 
 class nsISupports;
 class nsIURI;
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
--- a/editor/libeditor/EditAggregateTransaction.cpp
+++ b/editor/libeditor/EditAggregateTransaction.cpp
@@ -1,14 +1,15 @@
 /* -*- 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 "EditAggregateTransaction.h"
+#include "mozilla/ReverseIterator.h"  // for Reversed
 #include "nsAString.h"
 #include "nsCOMPtr.h"          // for nsCOMPtr
 #include "nsError.h"           // for NS_OK, etc.
 #include "nsISupportsUtils.h"  // for NS_ADDREF
 #include "nsString.h"          // for nsAutoString
 
 namespace mozilla {
 
--- a/editor/libeditor/EditorUtils.cpp
+++ b/editor/libeditor/EditorUtils.cpp
@@ -1,15 +1,16 @@
 /* -*- 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 "EditorUtils.h"
 
+#include "gfxFontUtils.h"
 #include "WSRunObject.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/ContentIterator.h"
 #include "mozilla/EditorDOMPoint.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/TextEditor.h"
 #include "mozilla/dom/Document.h"
--- a/editor/libeditor/HTMLAbsPositionEditor.cpp
+++ b/editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -4,16 +4,17 @@
 
 #include "HTMLEditor.h"
 
 #include <math.h>
 
 #include "HTMLEditorEventListener.h"
 #include "HTMLEditUtils.h"
 #include "mozilla/EditAction.h"
+#include "mozilla/EventListenerManager.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/dom/AncestorIterator.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -17,16 +17,17 @@
 #include "mozilla/ContentIterator.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EditAction.h"
 #include "mozilla/EditorDOMPoint.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/mozInlineSpellChecker.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/StaticPrefs_editor.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TextServicesDocument.h"
 #include "mozilla/css/Loader.h"
--- a/editor/libeditor/HTMLEditorEventListener.h
+++ b/editor/libeditor/HTMLEditorEventListener.h
@@ -2,20 +2,25 @@
 /* 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 HTMLEditorEventListener_h
 #define HTMLEditorEventListener_h
 
 #include "EditorEventListener.h"
+#include "mozilla/HTMLEditor.h"
 #include "nscore.h"
 
 namespace mozilla {
 
+namespace dom {
+class Element;
+}
+
 class EditorBase;
 
 class HTMLEditorEventListener final : public EditorEventListener {
  public:
   HTMLEditorEventListener()
       : EditorEventListener(),
         mListeningToMouseMoveEventForResizers(false),
         mListeningToMouseMoveEventForGrabber(false),
@@ -75,22 +80,22 @@ class HTMLEditorEventListener final : pu
       dom::MouseEvent* aMouseEvent) override;
   MOZ_CAN_RUN_SCRIPT virtual nsresult MouseClick(
       WidgetMouseEvent* aMouseClickEvent) override;
 
   nsresult ListenToMouseMoveEventForResizersOrGrabber(bool aListen,
                                                       bool aForGrabber);
 
   MOZ_CAN_RUN_SCRIPT void MaybeDisplayResizers(HTMLEditor& aHTMLEditor,
-                                               Element& aElement,
-                                               MouseEvent& aMouseEvent);
+                                               dom::Element& aElement,
+                                               dom::MouseEvent& aMouseEvent);
   MOZ_CAN_RUN_SCRIPT nsresult HandlePrimaryMouseButtonDown(
-      HTMLEditor& aHTMLEditor, MouseEvent& aMouseEvent);
+      HTMLEditor& aHTMLEditor, dom::MouseEvent& aMouseEvent);
   MOZ_CAN_RUN_SCRIPT nsresult HandleSecondaryMouseButtonDown(
-      HTMLEditor& aHTMLEditor, MouseEvent& aMouseEvent);
+      HTMLEditor& aHTMLEditor, dom::MouseEvent& aMouseEvent);
 
   bool mListeningToMouseMoveEventForResizers;
   bool mListeningToMouseMoveEventForGrabber;
   bool mListeningToResizeEvent;
 };
 
 }  // namespace mozilla
 
--- a/editor/libeditor/HTMLEditorState.cpp
+++ b/editor/libeditor/HTMLEditorState.cpp
@@ -77,17 +77,17 @@ ListElementSelectionState::ListElementSe
   for (const auto& content : arrayOfContents) {
     if (!content->IsElement()) {
       mIsOtherContentSelected = true;
     } else if (content->IsHTMLElement(nsGkAtoms::ul)) {
       mIsULElementSelected = true;
     } else if (content->IsHTMLElement(nsGkAtoms::ol)) {
       mIsOLElementSelected = true;
     } else if (content->IsHTMLElement(nsGkAtoms::li)) {
-      if (Element* parent = content->GetParentElement()) {
+      if (dom::Element* parent = content->GetParentElement()) {
         if (parent->IsHTMLElement(nsGkAtoms::ul)) {
           mIsULElementSelected = true;
         } else if (parent->IsHTMLElement(nsGkAtoms::ol)) {
           mIsOLElementSelected = true;
         }
       }
     } else if (content->IsAnyOfHTMLElements(nsGkAtoms::dl, nsGkAtoms::dt,
                                             nsGkAtoms::dd)) {
@@ -205,17 +205,17 @@ AlignStateAtSelection::AlignStateAtSelec
   // This routine assumes that alignment is done ONLY by `<div>` elements
   // if aHTMLEditor is not in CSS mode.
 
   if (NS_WARN_IF(!aHTMLEditor.GetRoot())) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  OwningNonNull<Element> bodyOrDocumentElement = *aHTMLEditor.GetRoot();
+  OwningNonNull<dom::Element> bodyOrDocumentElement = *aHTMLEditor.GetRoot();
   EditorRawDOMPoint atBodyOrDocumentElement(bodyOrDocumentElement);
 
   const nsRange* firstRange = aHTMLEditor.SelectionRefPtr()->GetRangeAt(0);
   mFoundSelectionRanges = !!firstRange;
   if (!mFoundSelectionRanges) {
     NS_WARNING("There was no selection range");
     aRv.Throw(NS_ERROR_FAILURE);
     return;
@@ -276,17 +276,17 @@ AlignStateAtSelection::AlignStateAtSelec
           "HTMLEditor::CollectEditTargetNodes(eSetOrClearAlignment, "
           "CollectNonEditableNodes::Yes) returned no contents");
       aRv.Throw(NS_ERROR_FAILURE);
       return;
     }
     editTargetContent = arrayOfContents[0];
   }
 
-  RefPtr<Element> blockElementAtEditTarget =
+  RefPtr<dom::Element> blockElementAtEditTarget =
       HTMLEditUtils::GetInclusiveAncestorBlockElement(*editTargetContent);
   if (NS_WARN_IF(!blockElementAtEditTarget)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   if (aHTMLEditor.IsCSSEnabled() &&
       CSSEditUtils::IsCSSEditableProperty(blockElementAtEditTarget, nullptr,
@@ -463,17 +463,17 @@ ParagraphStateAtSelection::ParagraphStat
     nsIContent* content = atCaret.GetContainerAsContent();
     if (NS_WARN_IF(!content)) {
       aRv.Throw(NS_ERROR_FAILURE);
       return;
     }
     arrayOfContents.AppendElement(*content);
   }
 
-  Element* bodyOrDocumentElement = aHTMLEditor.GetRoot();
+  dom::Element* bodyOrDocumentElement = aHTMLEditor.GetRoot();
   if (NS_WARN_IF(!bodyOrDocumentElement)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   for (auto& content : Reversed(arrayOfContents)) {
     nsAtom* paragraphStateOfNode = nsGkAtoms::_empty;
     if (HTMLEditUtils::IsFormatNode(content)) {
@@ -513,17 +513,17 @@ ParagraphStateAtSelection::ParagraphStat
       break;
     }
   }
 }
 
 // static
 void ParagraphStateAtSelection::AppendDescendantFormatNodesAndFirstInlineNode(
     nsTArray<OwningNonNull<nsIContent>>& aArrayOfContents,
-    Element& aNonFormatBlockElement) {
+    dom::Element& aNonFormatBlockElement) {
   MOZ_ASSERT(HTMLEditUtils::IsBlockElement(aNonFormatBlockElement));
   MOZ_ASSERT(!HTMLEditUtils::IsFormatNode(&aNonFormatBlockElement));
 
   // We only need to place any one inline inside this node onto
   // the list.  They are all the same for purposes of determining
   // paragraph style.  We use foundInline to track this as we are
   // going through the children in the loop below.
   bool foundInline = false;
--- a/editor/libeditor/WSRunObject.h
+++ b/editor/libeditor/WSRunObject.h
@@ -17,16 +17,20 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLBRElement.h"
 #include "mozilla/dom/Text.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 
 namespace mozilla {
 
+namespace dom {
+class Element;
+}
+
 class WSRunScanner;
 
 /**
  * WSScanResult is result of ScanNextVisibleNodeOrBlockBoundaryFrom(),
  * ScanPreviousVisibleNodeOrBlockBoundaryFrom(), and their static wrapper
  * methods.  This will have information of found visible content (and its
  * position) or reached block element or topmost editable content at the
  * start of scanner.
@@ -343,20 +347,20 @@ class MOZ_STACK_CLASS WSRunScanner final
    * I.e., this returns a point immediately before or after invisible
    * white-spaces of aTextNode if aTextNode ends or begins with some invisible
    * white-spaces.
    * Note that the result may not be in different text node if aTextNode has
    * only invisible white-spaces and there is previous or next text node.
    */
   template <typename EditorDOMPointType>
   static EditorDOMPointType GetAfterLastVisiblePoint(
-      Text& aTextNode, const Element* aAncestorLimiter);
+      dom::Text& aTextNode, const dom::Element* aAncestorLimiter);
   template <typename EditorDOMPointType>
   static EditorDOMPointType GetFirstVisiblePoint(
-      Text& aTextNode, const Element* aAncestorLimiter);
+      dom::Text& aTextNode, const dom::Element* aAncestorLimiter);
 
   /**
    * GetRangeInTextNodesToForwardDeleteFrom() returns the range to remove
    * text when caret is at aPoint.
    */
   static Result<EditorDOMRangeInTexts, nsresult>
   GetRangeInTextNodesToForwardDeleteFrom(const HTMLEditor& aHTMLEditor,
                                          const EditorDOMPoint& aPoint);
@@ -393,44 +397,44 @@ class MOZ_STACK_CLASS WSRunScanner final
    *                            aLeftBlockElement, this must be set and the
    *                            container must be aRightBlockElement.
    *                            When aLeftBlockElement is an ancestor of
    *                            aRightBlockElement, this must be set and the
    *                            container must be aLeftBlockElement.
    *                            Otherwise, must not be set.
    */
   static EditorDOMRange GetRangeForDeletingBlockElementBoundaries(
-      const HTMLEditor& aHTMLEditor, const Element& aLeftBlockElement,
-      const Element& aRightBlockElement,
+      const HTMLEditor& aHTMLEditor, const dom::Element& aLeftBlockElement,
+      const dom::Element& aRightBlockElement,
       const EditorDOMPoint& aPointContainingTheOtherBlock);
 
   /**
    * ShrinkRangeIfStartsFromOrEndsAfterAtomicContent() may shrink aRange if it
    * starts and/or ends with an atomic content, but the range boundary
    * is in adjacent text nodes.  Returns true if this modifies the range.
    */
   static Result<bool, nsresult> ShrinkRangeIfStartsFromOrEndsAfterAtomicContent(
       const HTMLEditor& aHTMLEditor, nsRange& aRange,
-      const Element* aEditingHost);
+      const dom::Element* aEditingHost);
 
   /**
    * GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries() returns
    * extended range if range boundaries of aRange are in invisible white-spaces.
    */
   static EditorDOMRange GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
       const HTMLEditor& aHTMLEditor, const EditorDOMRange& aRange);
 
   /**
    * GetPrecedingBRElementUnlessVisibleContentFound() scans a `<br>` element
    * backward, but stops scanning it if the scanner finds visible character
    * or something.  In other words, this method ignores only invisible
    * white-spaces between `<br>` element and aPoint.
    */
   template <typename EditorDOMPointType>
-  MOZ_NEVER_INLINE_DEBUG static HTMLBRElement*
+  MOZ_NEVER_INLINE_DEBUG static dom::HTMLBRElement*
   GetPrecedingBRElementUnlessVisibleContentFound(
       const HTMLEditor& aHTMLEditor, const EditorDOMPointType& aPoint) {
     MOZ_ASSERT(aPoint.IsSetAndValid());
     // XXX This method behaves differently even in similar point.
     //     If aPoint is in a text node following `<br>` element, reaches the
     //     `<br>` element when all characters between the `<br>` and
     //     aPoint are ASCII whitespaces.
     //     But if aPoint is not in a text node, e.g., at start of an inline
@@ -723,17 +727,17 @@ class MOZ_STACK_CLASS WSRunScanner final
        * @param aEditingHost      Active editing host.
        * @param aNBSPData         Optional.  If set, this recodes first and last
        *                          NBSP positions.
        */
       template <typename EditorDOMPointType>
       static BoundaryData ScanCollapsibleWhiteSpaceStartFrom(
           const EditorDOMPointType& aPoint,
           const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent,
-          const Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
+          const dom::Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
 
       /**
        * ScanCollapsibleWhiteSpaceEndFrom() returns end boundary data of
        * white-spaces containing aPoint.  When aPoint is in a text node and
        * points a non-white-space character or the text node is preformatted,
        * this returns the data at aPoint.
        *
        * @param aPoint            Scan start point.
@@ -743,17 +747,17 @@ class MOZ_STACK_CLASS WSRunScanner final
        * @param aEditingHost      Active editing host.
        * @param aNBSPData         Optional.  If set, this recodes first and last
        *                          NBSP positions.
        */
       template <typename EditorDOMPointType>
       static BoundaryData ScanCollapsibleWhiteSpaceEndFrom(
           const EditorDOMPointType& aPoint,
           const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent,
-          const Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
+          const dom::Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
 
       enum class Preformatted : bool { Yes, No };
       BoundaryData()
           : mReason(WSType::NotInitialized),
             mAcrossPreformattedCharacter(Preformatted::No) {}
       template <typename EditorDOMPointType>
       BoundaryData(const EditorDOMPointType& aPoint, nsIContent& aReasonContent,
                    WSType aReason, Preformatted aDidCrossPreformattedCharacter)
@@ -851,17 +855,17 @@ class MOZ_STACK_CLASS WSRunScanner final
       EditorDOMPointInText mFirst;
       EditorDOMPointInText mLast;
     };
 
    public:
     TextFragmentData() = delete;
     template <typename EditorDOMPointType>
     TextFragmentData(const EditorDOMPointType& aPoint,
-                     const Element* aEditingHost);
+                     const dom::Element* aEditingHost);
 
     bool IsInitialized() const {
       return mStart.Initialized() && mEnd.Initialized();
     }
 
     nsIContent* GetStartReasonContent() const {
       return mStart.GetReasonContent();
     }
@@ -1180,17 +1184,17 @@ class MOZ_STACK_CLASS WSRunScanner final
               (EndsByNormalText() || EndsBySpecialContent() ||
                EndsByBRElement()));
     }
 
     EditorDOMPoint mScanStartPoint;
     BoundaryData mStart;
     BoundaryData mEnd;
     NoBreakingSpaceData mNBSPData;
-    RefPtr<const Element> mEditingHost;
+    RefPtr<const dom::Element> mEditingHost;
     mutable Maybe<EditorDOMRange> mLeadingWhiteSpaceRange;
     mutable Maybe<EditorDOMRange> mTrailingWhiteSpaceRange;
     mutable Maybe<VisibleWhiteSpacesData> mVisibleWhiteSpacesData;
     // XXX Currently we set mIsPreformatted to `WSRunScanner::mPRE` value
     //     even if some text nodes between mStart and mEnd are different styled
     //     nodes.  This caused some bugs actually, but we now keep traditional
     //     behavior for now.
     bool mIsPreformatted;
@@ -1320,18 +1324,19 @@ class WhiteSpaceVisibilityKeeper final {
    * @param aAtRightBlockChild  At a child of aRightBlockElement and inclusive
    *                            ancestor of aLeftBlockElement.
    * @param aListElementTagName Set some if aRightBlockElement is a list
    *                            element and it'll be merged with another
    *                            list element.
    */
   [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
   MergeFirstLineOfRightBlockElementIntoDescendantLeftBlockElement(
-      HTMLEditor& aHTMLEditor, Element& aLeftBlockElement,
-      Element& aRightBlockElement, const EditorDOMPoint& aAtRightBlockChild,
+      HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
+      dom::Element& aRightBlockElement,
+      const EditorDOMPoint& aAtRightBlockChild,
       const Maybe<nsAtom*>& aListElementTagName,
       const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
 
   /**
    * MergeFirstLineOfRightBlockElementIntoAncestorLeftBlockElement() merges
    * first line in aRightBlockElement into end of aLeftBlockElement which
    * is an ancestor of aRightBlockElement, then, removes aRightBlockElement
    * if it becomes empty.
@@ -1347,18 +1352,18 @@ class WhiteSpaceVisibilityKeeper final {
    * @param aLeftContentInBlock The content whose inclusive ancestor is
    *                            aLeftBlockElement.
    * @param aListElementTagName Set some if aRightBlockElement is a list
    *                            element and it'll be merged with another
    *                            list element.
    */
   [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
   MergeFirstLineOfRightBlockElementIntoAncestorLeftBlockElement(
-      HTMLEditor& aHTMLEditor, Element& aLeftBlockElement,
-      Element& aRightBlockElement, const EditorDOMPoint& aAtLeftBlockChild,
+      HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
+      dom::Element& aRightBlockElement, const EditorDOMPoint& aAtLeftBlockChild,
       nsIContent& aLeftContentInBlock,
       const Maybe<nsAtom*>& aListElementTagName,
       const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
 
   /**
    * MergeFirstLineOfRightBlockElementIntoLeftBlockElement() merges first
    * line in aRightBlockElement into end of aLeftBlockElement and removes
    * aRightBlockElement when it has only one line.
@@ -1369,34 +1374,35 @@ class WhiteSpaceVisibilityKeeper final {
    * @param aRightBlockElement  The first line in this element will be
    *                            moved to aLeftBlockElement and maybe
    *                            removed when this becomes empty.
    * @param aListElementTagName Set some if aRightBlockElement is a list
    *                            element and its type needs to be changed.
    */
   [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
   MergeFirstLineOfRightBlockElementIntoLeftBlockElement(
-      HTMLEditor& aHTMLEditor, Element& aLeftBlockElement,
-      Element& aRightBlockElement, const Maybe<nsAtom*>& aListElementTagName,
+      HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
+      dom::Element& aRightBlockElement,
+      const Maybe<nsAtom*>& aListElementTagName,
       const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
 
   /**
    * InsertBRElement() inserts a <br> node at (before) aPointToInsert and delete
    * unnecessary white-spaces around there and/or replaces white-spaces with
    * non-breaking spaces.  Note that if the point is in a text node, the
    * text node will be split and insert new <br> node between the left node
    * and the right node.
    *
    * @param aPointToInsert  The point to insert new <br> element.  Note that
    *                        it'll be inserted before this point.  I.e., the
    *                        point will be the point of new <br>.
    * @return                The new <br> node.  If failed to create new <br>
    *                        node, returns nullptr.
    */
-  [[nodiscard]] MOZ_CAN_RUN_SCRIPT static Result<RefPtr<Element>, nsresult>
+  [[nodiscard]] MOZ_CAN_RUN_SCRIPT static Result<RefPtr<dom::Element>, nsresult>
   InsertBRElement(HTMLEditor& aHTMLEditor,
                   const EditorDOMPoint& aPointToInsert);
 
   /**
    * InsertText() inserts aStringToInsert to aPointToInsert and makes any needed
    * adjustments to white-spaces around the insertion point.
    *
    * @param aStringToInsert     The string to insert.
--- a/editor/txmgr/TransactionStack.cpp
+++ b/editor/txmgr/TransactionStack.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "TransactionStack.h"
 
-#include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDebug.h"
 #include "nsISupportsUtils.h"
 #include "nscore.h"
 #include "TransactionItem.h"
 
 namespace mozilla {
 
--- a/xpcom/ds/nsDeque.h
+++ b/xpcom/ds/nsDeque.h
@@ -26,16 +26,17 @@
 #define _NSDEQUE
 #include <cstddef>
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/fallible.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/RefPtr.h"
+#include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsISupports.h"
 
 namespace mozilla {
 
 namespace detail {
 /**
  * The deque (double-ended queue) class is a common container type,