Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 24 May 2018 13:18:34 -0400
changeset 419717 7c12d4b98d22680629d0d1c71a14847d4b0d70e6
parent 419716 96a208d3cceee2f0f0b7aac7fac3278d5a897330
child 419718 fa8a67c2f91b598e5777ba1501b5b1908566ad3e
push id34045
push usercbrindusan@mozilla.com
push dateFri, 25 May 2018 00:02:36 +0000
treeherdermozilla-central@9a8839ee6c9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1463981
milestone62.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 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki
editor/libeditor/CreateElementTransaction.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/libeditor/EditorDOMPoint.h
editor/libeditor/HTMLEditUtils.cpp
editor/libeditor/HTMLEditUtils.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/HTMLTableEditor.cpp
editor/libeditor/InsertNodeTransaction.cpp
editor/libeditor/SplitNodeTransaction.cpp
editor/libeditor/TextEditor.cpp
editor/libeditor/tests/test_root_element_replacement.html
editor/nsIEditor.idl
editor/spellchecker/TextServicesDocument.cpp
editor/spellchecker/TextServicesDocument.h
editor/spellchecker/nsFilteredContentIterator.cpp
editor/spellchecker/nsFilteredContentIterator.h
--- a/editor/libeditor/CreateElementTransaction.cpp
+++ b/editor/libeditor/CreateElementTransaction.cpp
@@ -90,17 +90,17 @@ CreateElementTransaction::DoTransaction(
       NS_WARN_IF(!mPointToInsert.IsSet())) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   mNewNode = mEditorBase->CreateHTMLContent(mTag);
   NS_ENSURE_STATE(mNewNode);
 
   // Try to insert formatting whitespace for the new node:
-  mEditorBase->MarkNodeDirty(GetAsDOMNode(mNewNode));
+  mEditorBase->MarkNodeDirty(mNewNode);
 
   // Insert the new node
   ErrorResult error;
   InsertNewNode(error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
 
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -70,17 +70,16 @@
 #include "nsFrameSelection.h"           // for nsFrameSelection
 #include "nsGenericHTMLElement.h"       // for nsGenericHTMLElement
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::dir
 #include "nsIAbsorbingTransaction.h"    // for nsIAbsorbingTransaction
 #include "nsAtom.h"                    // for nsAtom
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIDocument.h"                // for nsIDocument
 #include "nsIDOMEventListener.h"        // for nsIDOMEventListener
-#include "nsIDOMNode.h"                 // for nsIDOMNode, etc.
 #include "nsIDocumentStateListener.h"   // for nsIDocumentStateListener
 #include "nsIEditActionListener.h"      // for nsIEditActionListener
 #include "nsIEditorObserver.h"          // for nsIEditorObserver
 #include "nsIEditorSpellCheck.h"        // for nsIEditorSpellCheck
 #include "nsIFrame.h"                   // for nsIFrame
 #include "nsIHTMLDocument.h"            // for nsIHTMLDocument
 #include "nsIInlineSpellChecker.h"      // for nsIInlineSpellChecker, etc.
 #include "nsNameSpaceManager.h"        // for kNameSpaceID_None, etc.
@@ -1256,26 +1255,26 @@ EditorBase::RemoveAttributeWithTransacti
   //     the transaction?  Otherwise, there will be added a transaction
   //     which does nothing at doing undo/redo.
   RefPtr<ChangeAttributeTransaction> transaction =
     ChangeAttributeTransaction::CreateToRemove(aElement, aAttribute);
   return DoTransaction(transaction);
 }
 
 NS_IMETHODIMP
-EditorBase::MarkNodeDirty(nsIDOMNode* aNode)
+EditorBase::MarkNodeDirty(nsINode* aNode)
 {
   // Mark the node dirty, but not for webpages (bug 599983)
   if (!OutputsMozDirty()) {
     return NS_OK;
   }
-  nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
-  if (element) {
-    element->SetAttr(kNameSpaceID_None, nsGkAtoms::mozdirty,
-                     EmptyString(), false);
+  if (aNode && aNode->IsElement()) {
+    RefPtr<Element> element = aNode->AsElement();
+    element->SetAttr(kNameSpaceID_None, nsGkAtoms::mozdirty, EmptyString(),
+                     false);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 EditorBase::GetInlineSpellChecker(bool autoCreate,
                                   nsIInlineSpellChecker** aInlineSpellChecker)
 {
@@ -1399,33 +1398,32 @@ EditorBase::CreateNodeWithTransaction(
                               newElement, rv);
     }
   }
 
   return newElement.forget();
 }
 
 NS_IMETHODIMP
-EditorBase::InsertNode(nsIDOMNode* aNodeToInsert,
-                       nsIDOMNode* aContainer,
+EditorBase::InsertNode(nsINode* aNodeToInsert,
+                       nsINode* aContainer,
                        int32_t aOffset)
 {
   nsCOMPtr<nsIContent> contentToInsert = do_QueryInterface(aNodeToInsert);
   if (NS_WARN_IF(!contentToInsert)) {
     return NS_ERROR_NULL_POINTER;
   }
-  nsCOMPtr<nsINode> container = do_QueryInterface(aContainer);
-  if (NS_WARN_IF(!container)) {
+  if (NS_WARN_IF(!aContainer)) {
     return NS_ERROR_NULL_POINTER;
   }
   int32_t offset =
-    aOffset < 0 ? static_cast<int32_t>(container->Length()) :
-                  std::min(aOffset, static_cast<int32_t>(container->Length()));
+    aOffset < 0 ? static_cast<int32_t>(aContainer->Length()) :
+                  std::min(aOffset, static_cast<int32_t>(aContainer->Length()));
   return InsertNodeWithTransaction(*contentToInsert,
-                                   EditorRawDOMPoint(container, offset));
+                                   EditorRawDOMPoint(aContainer, offset));
 }
 
 template<typename PT, typename CT>
 nsresult
 EditorBase::InsertNodeWithTransaction(
               nsIContent& aContentToInsert,
               const EditorDOMPointBase<PT, CT>& aPointToInsert)
 {
@@ -1458,31 +1456,30 @@ EditorBase::InsertNodeWithTransaction(
       listener->DidInsertNode(&aContentToInsert, rv);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-EditorBase::SplitNode(nsIDOMNode* aNode,
+EditorBase::SplitNode(nsINode* aNode,
                       int32_t aOffset,
-                      nsIDOMNode** aNewLeftNode)
+                      nsINode** aNewLeftNode)
 {
-  nsCOMPtr<nsIContent> node = do_QueryInterface(aNode);
-  if (NS_WARN_IF(!node)) {
+  if (NS_WARN_IF(!aNode)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   int32_t offset = std::min(std::max(aOffset, 0),
-                            static_cast<int32_t>(node->Length()));
+                            static_cast<int32_t>(aNode->Length()));
   ErrorResult error;
   nsCOMPtr<nsIContent> newNode =
-    SplitNodeWithTransaction(EditorRawDOMPoint(node, offset), error);
-  *aNewLeftNode = GetAsDOMNode(newNode.forget().take());
+    SplitNodeWithTransaction(EditorRawDOMPoint(aNode, offset), error);
+  newNode.forget(aNewLeftNode);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
 template<typename PT, typename CT>
 already_AddRefed<nsIContent>
@@ -1542,24 +1539,22 @@ EditorBase::SplitNodeWithTransaction(
   if (NS_WARN_IF(aError.Failed())) {
     return nullptr;
   }
 
   return newNode.forget();
 }
 
 NS_IMETHODIMP
-EditorBase::JoinNodes(nsIDOMNode* aLeftNode,
-                      nsIDOMNode* aRightNode,
-                      nsIDOMNode*)
+EditorBase::JoinNodes(nsINode* aLeftNode,
+                      nsINode* aRightNode,
+                      nsINode*)
 {
-  nsCOMPtr<nsINode> leftNode = do_QueryInterface(aLeftNode);
-  nsCOMPtr<nsINode> rightNode = do_QueryInterface(aRightNode);
-  NS_ENSURE_STATE(leftNode && rightNode && leftNode->GetParentNode());
-  return JoinNodesWithTransaction(*leftNode, *rightNode);
+  NS_ENSURE_STATE(aLeftNode && aRightNode && aLeftNode->GetParentNode());
+  return JoinNodesWithTransaction(*aLeftNode, *aRightNode);
 }
 
 nsresult
 EditorBase::JoinNodesWithTransaction(nsINode& aLeftNode,
                                      nsINode& aRightNode)
 {
   nsCOMPtr<nsINode> parent = aLeftNode.GetParentNode();
   MOZ_ASSERT(parent);
@@ -1616,23 +1611,22 @@ EditorBase::JoinNodesWithTransaction(nsI
       listener->DidJoinNodes(&aLeftNode, &aRightNode, parent, rv);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-EditorBase::DeleteNode(nsIDOMNode* aNode)
+EditorBase::DeleteNode(nsINode* aNode)
 {
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  if (NS_WARN_IF(!node)) {
+  if (NS_WARN_IF(!aNode)) {
     return NS_ERROR_INVALID_ARG;
   }
-  return DeleteNodeWithTransaction(*node);
+  return DeleteNodeWithTransaction(*aNode);
 }
 
 nsresult
 EditorBase::DeleteNodeWithTransaction(nsINode& aNode)
 {
   AutoRules beginRulesSniffing(this, EditAction::createNode,
                                nsIEditor::ePrevious);
 
@@ -2438,32 +2432,26 @@ EditorBase::EndOperation()
 {
   mAction = EditAction::none;
   mDirection = eNone;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 EditorBase::CloneAttribute(const nsAString& aAttribute,
-                           nsIDOMNode* aDestNode,
-                           nsIDOMNode* aSourceNode)
+                           Element* aDestElement,
+                           Element* aSourceElement)
 {
-  NS_ENSURE_TRUE(aDestNode && aSourceNode, NS_ERROR_NULL_POINTER);
+  NS_ENSURE_TRUE(aDestElement && aSourceElement, NS_ERROR_NULL_POINTER);
   if (NS_WARN_IF(aAttribute.IsEmpty())) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<Element> destElement = do_QueryInterface(aDestNode);
-  nsCOMPtr<Element> sourceElement = do_QueryInterface(aSourceNode);
-  if (NS_WARN_IF(!destElement) || NS_WARN_IF(!sourceElement)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
   RefPtr<nsAtom> attribute = NS_Atomize(aAttribute);
-  return CloneAttributeWithTransaction(*attribute, *destElement, *sourceElement);
+  return CloneAttributeWithTransaction(*attribute, *aDestElement, *aSourceElement);
 }
 
 nsresult
 EditorBase::CloneAttributeWithTransaction(nsAtom& aAttribute,
                                           Element& aDestElement,
                                           Element& aSourceElement)
 {
   nsAutoString attrValue;
@@ -2473,26 +2461,24 @@ EditorBase::CloneAttributeWithTransactio
   return RemoveAttributeWithTransaction(aDestElement, aAttribute);
 }
 
 /**
  * @param aDest     Must be a DOM element.
  * @param aSource   Must be a DOM element.
  */
 NS_IMETHODIMP
-EditorBase::CloneAttributes(nsIDOMNode* aDestDOMElement,
-                            nsIDOMNode* aSourceDOMElement)
+EditorBase::CloneAttributes(Element* aDestElement,
+                            Element* aSourceElement)
 {
-  nsCOMPtr<Element> destElement = do_QueryInterface(aDestDOMElement);
-  nsCOMPtr<Element> sourceElement = do_QueryInterface(aSourceDOMElement);
-  if (NS_WARN_IF(!destElement) || NS_WARN_IF(!sourceElement)) {
+  if (NS_WARN_IF(!aDestElement) || NS_WARN_IF(!aSourceElement)) {
     return NS_ERROR_INVALID_ARG;
   }
 
-  CloneAttributesWithTransaction(*destElement, *sourceElement);
+  CloneAttributesWithTransaction(*aDestElement, *aSourceElement);
 
   return NS_OK;
 }
 
 void
 EditorBase::CloneAttributesWithTransaction(Element& aDestElement,
                                            Element& aSourceElement)
 {
@@ -3369,30 +3355,16 @@ EditorBase::DoJoinNodes(nsINode* aNodeTo
     selection->Collapse(aNodeToKeep, AssertedCast<int32_t>(firstNodeLength));
   }
 
   return err.StealNSResult();
 }
 
 // static
 int32_t
-EditorBase::GetChildOffset(nsIDOMNode* aChild,
-                           nsIDOMNode* aParent)
-{
-  MOZ_ASSERT(aChild && aParent);
-
-  nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
-  nsCOMPtr<nsINode> child = do_QueryInterface(aChild);
-  MOZ_ASSERT(parent && child);
-
-  return GetChildOffset(child, parent);
-}
-
-// static
-int32_t
 EditorBase::GetChildOffset(nsINode* aChild,
                            nsINode* aParent)
 {
   MOZ_ASSERT(aChild);
   MOZ_ASSERT(aParent);
 
   // nsINode::ComputeIndexOf() is expensive.  So, if we can return index
   // without calling it, we should do that.
@@ -3749,26 +3721,16 @@ EditorBase::TagCanContain(nsAtom& aParen
 bool
 EditorBase::TagCanContainTag(nsAtom& aParentTag,
                              nsAtom& aChildTag) const
 {
   return true;
 }
 
 bool
-EditorBase::IsRoot(nsIDOMNode* inNode)
-{
-  NS_ENSURE_TRUE(inNode, false);
-
-  nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(GetRoot());
-
-  return inNode == rootNode;
-}
-
-bool
 EditorBase::IsRoot(nsINode* inNode)
 {
   NS_ENSURE_TRUE(inNode, false);
 
   nsCOMPtr<nsINode> rootNode = GetRoot();
 
   return inNode == rootNode;
 }
@@ -3777,23 +3739,16 @@ bool
 EditorBase::IsEditorRoot(nsINode* aNode)
 {
   NS_ENSURE_TRUE(aNode, false);
   nsCOMPtr<nsINode> rootNode = GetEditorRoot();
   return aNode == rootNode;
 }
 
 bool
-EditorBase::IsDescendantOfRoot(nsIDOMNode* inNode)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(inNode);
-  return IsDescendantOfRoot(node);
-}
-
-bool
 EditorBase::IsDescendantOfRoot(nsINode* inNode)
 {
   NS_ENSURE_TRUE(inNode, false);
   nsCOMPtr<nsIContent> root = GetRoot();
   NS_ENSURE_TRUE(root, false);
 
   return nsContentUtils::ContentIsDescendantOf(inNode, root);
 }
@@ -3809,23 +3764,16 @@ EditorBase::IsDescendantOfEditorRoot(nsI
 }
 
 bool
 EditorBase::IsContainer(nsINode* aNode)
 {
   return aNode ? true : false;
 }
 
-bool
-EditorBase::IsEditable(nsIDOMNode* aNode)
-{
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
-  return IsEditable(content);
-}
-
 uint32_t
 EditorBase::CountEditableChildren(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   uint32_t count = 0;
   for (nsIContent* child = aNode->GetFirstChild();
        child;
        child = child->GetNextSibling()) {
@@ -3868,50 +3816,25 @@ EditorBase::ResetModificationCount()
   mModCount = 0;
 
   if (doNotify) {
     NotifyDocumentListeners(eDocumentStateChanged);
   }
   return NS_OK;
 }
 
-nsAtom*
-EditorBase::GetTag(nsIDOMNode* aNode)
-{
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
-
-  if (!content) {
-    NS_ASSERTION(aNode, "null node passed to EditorBase::GetTag()");
-    return nullptr;
-  }
-
-  return content->NodeInfo()->NameAtom();
-}
-
 bool
 EditorBase::AreNodesSameType(nsIContent* aNode1,
                              nsIContent* aNode2)
 {
   MOZ_ASSERT(aNode1);
   MOZ_ASSERT(aNode2);
   return aNode1->NodeInfo()->NameAtom() == aNode2->NodeInfo()->NameAtom();
 }
 
-bool
-EditorBase::IsTextNode(nsIDOMNode* aNode)
-{
-  if (!aNode) {
-    NS_NOTREACHED("null node passed to IsTextNode()");
-    return false;
-  }
-
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return IsTextNode(node);
-}
-
 // static
 nsIContent*
 EditorBase::GetNodeAtRangeOffsetPoint(const RawRangeBoundary& aPoint)
 {
   if (NS_WARN_IF(!aPoint.IsSet())) {
     return nullptr;
   }
   if (aPoint.Container()->GetAsText()) {
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -33,17 +33,16 @@
 #include "nsString.h"                   // for nsCString
 #include "nsTArray.h"                   // for nsTArray and nsAutoTArray
 #include "nsWeakReference.h"            // for nsSupportsWeakReference
 #include "nscore.h"                     // for nsresult, nsAString, etc.
 
 class mozInlineSpellChecker;
 class nsAtom;
 class nsIContent;
-class nsIDOMNode;
 class nsIDocumentStateListener;
 class nsIEditActionListener;
 class nsIEditorObserver;
 class nsINode;
 class nsIPresShell;
 class nsISupports;
 class nsITransaction;
 class nsITransactionListener;
@@ -1395,54 +1394,43 @@ protected: // May be called by friends.
   /**
    * Get the leftmost child of aCurrentNode;
    * return nullptr if aCurrentNode has no children.
    */
   nsIContent* GetLeftmostChild(nsINode *aCurrentNode,
                                bool bNoBlockCrossing = false);
 
   /**
-   * Returns true if aNode is of the type implied by aTag.
-   */
-  static inline bool NodeIsType(nsIDOMNode* aNode, nsAtom* aTag)
-  {
-    return GetTag(aNode) == aTag;
-  }
-
-  /**
    * Returns true if aParent can contain a child of type aTag.
    */
   bool CanContain(nsINode& aParent, nsIContent& aChild) const;
   bool CanContainTag(nsINode& aParent, nsAtom& aTag) const;
   bool TagCanContain(nsAtom& aParentTag, nsIContent& aChild) const;
   virtual bool TagCanContainTag(nsAtom& aParentTag, nsAtom& aChildTag) const;
 
   /**
    * Returns true if aNode is our root node.
    */
-  bool IsRoot(nsIDOMNode* inNode);
   bool IsRoot(nsINode* inNode);
   bool IsEditorRoot(nsINode* aNode);
 
   /**
    * Returns true if aNode is a descendant of our root node.
    */
-  bool IsDescendantOfRoot(nsIDOMNode* inNode);
   bool IsDescendantOfRoot(nsINode* inNode);
   bool IsDescendantOfEditorRoot(nsINode* aNode);
 
   /**
    * Returns true if aNode is a container.
    */
   virtual bool IsContainer(nsINode* aNode);
 
   /**
    * returns true if aNode is an editable node.
    */
-  bool IsEditable(nsIDOMNode* aNode);
   bool IsEditable(nsINode* aNode)
   {
     NS_ENSURE_TRUE(aNode, false);
 
     if (!aNode->IsContent() || IsMozEditorBogusNode(aNode) ||
         !IsModifiableNode(aNode)) {
       return false;
     }
@@ -1498,21 +1486,18 @@ protected: // May be called by friends.
   /**
    * Returns true when inserting text should be a part of current composition.
    */
   bool ShouldHandleIMEComposition() const;
 
   /**
    * From html rules code - migration in progress.
    */
-  static nsAtom* GetTag(nsIDOMNode* aNode);
-
   virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2);
 
-  static bool IsTextNode(nsIDOMNode* aNode);
   static bool IsTextNode(nsINode* aNode)
   {
     return aNode->NodeType() == nsINode::TEXT_NODE;
   }
 
   /**
    * GetNodeAtRangeOffsetPoint() returns the node at this position in a range,
    * assuming that the container is the node itself if it's a text node, or
@@ -1791,18 +1776,16 @@ protected: // Shouldn't be used by frien
 
   /**
    * Return the offset of aChild in aParent.  Asserts fatally if parent or
    * child is null, or parent is not child's parent.
    * FYI: aChild must not be being removed from aParent.  In such case, these
    *      methods may return wrong index if aChild doesn't have previous
    *      sibling or next sibling.
    */
-  static int32_t GetChildOffset(nsIDOMNode* aChild,
-                                nsIDOMNode* aParent);
   static int32_t GetChildOffset(nsINode* aChild,
                                 nsINode* aParent);
 
   /**
    * Creates a range with just the supplied node and appends that to the
    * selection.
    */
   nsresult AppendNodeToSelectionAsRange(nsINode* aNode);
--- a/editor/libeditor/EditorDOMPoint.h
+++ b/editor/libeditor/EditorDOMPoint.h
@@ -11,17 +11,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/RangeBoundary.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Text.h"
 #include "nsAtom.h"
 #include "nsCOMPtr.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsINode.h"
 
 namespace mozilla {
 
 template<typename ParentType, typename ChildType>
 class EditorDOMPointBase;
 
 /**
@@ -92,24 +91,16 @@ public:
   {
     NS_WARNING_ASSERTION(!mParent || mOffset.value() <= mParent->Length(),
       "The offset is larger than the length of aContainer or negative");
     if (!mParent) {
       mOffset.reset();
     }
   }
 
-  EditorDOMPointBase(nsIDOMNode* aDOMContainer,
-                     int32_t aOffset)
-    : mIsChildInitialized(false)
-  {
-    nsCOMPtr<nsINode> container = do_QueryInterface(aDOMContainer);
-    this->Set(container, aOffset);
-  }
-
   /**
    * Different from RangeBoundary, aPointedNode should be a child node
    * which you want to refer.
    */
   explicit EditorDOMPointBase(nsINode* aPointedNode)
     : mParent(aPointedNode && aPointedNode->IsContent() ?
                 aPointedNode->GetParentNode() : nullptr)
     , mChild(aPointedNode && aPointedNode->IsContent() ?
@@ -118,26 +109,16 @@ public:
   {
     mIsChildInitialized = aPointedNode && mChild;
     NS_WARNING_ASSERTION(IsSet(),
       "The child is nullptr or doesn't have its parent");
     NS_WARNING_ASSERTION(mChild && mChild->GetParentNode() == mParent,
       "Initializing RangeBoundary with invalid value");
   }
 
-  explicit EditorDOMPointBase(nsIDOMNode* aDOMPointedNode)
-    : mIsChildInitialized(false)
-  {
-    nsCOMPtr<nsIContent> child = do_QueryInterface(aDOMPointedNode);
-    if (NS_WARN_IF(!child)) {
-      return;
-    }
-    this->Set(child);
-  }
-
   EditorDOMPointBase(nsINode* aContainer,
                      nsIContent* aPointedNode,
                      int32_t aOffset)
     : mParent(aContainer)
     , mChild(aPointedNode)
     , mOffset(mozilla::Some(aOffset))
     , mIsChildInitialized(true)
   {
@@ -193,22 +174,16 @@ public:
   }
 
   dom::Text*
   GetContainerAsText() const
   {
     return mParent ? mParent->GetAsText() : nullptr;
   }
 
-  nsIDOMNode*
-  GetContainerAsDOMNode() const
-  {
-    return mParent ? mParent->AsDOMNode() : nullptr;
-  }
-
   /**
    * CanContainerHaveChildren() returns true if the container node can have
    * child nodes.  Otherwise, e.g., when the container is a text node, returns
    * false.
    */
   bool
   CanContainerHaveChildren() const
   {
--- a/editor/libeditor/HTMLEditUtils.cpp
+++ b/editor/libeditor/HTMLEditUtils.cpp
@@ -13,36 +13,27 @@
 #include "nsAString.h"                  // for nsAString::IsEmpty
 #include "nsCOMPtr.h"                   // for nsCOMPtr, operator==, etc.
 #include "nsCaseTreatment.h"
 #include "nsDebug.h"                    // for NS_ASSERTION, etc.
 #include "nsError.h"                    // for NS_SUCCEEDED
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::a, etc.
 #include "nsHTMLTags.h"
 #include "nsAtom.h"                    // for nsAtom
-#include "nsIDOMNode.h"                 // for nsIDOMNode
 #include "nsNameSpaceManager.h"        // for kNameSpaceID_None
 #include "nsLiteralString.h"            // for NS_LITERAL_STRING
 #include "nsString.h"                   // for nsAutoString
 #include "mozilla/dom/HTMLAnchorElement.h"
 
 namespace mozilla {
 
 /**
  * IsInlineStyle() returns true if aNode is an inline style.
  */
 bool
-HTMLEditUtils::IsInlineStyle(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsInlineStyle(node);
-}
-
-bool
 HTMLEditUtils::IsInlineStyle(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::b,
                                     nsGkAtoms::i,
                                     nsGkAtoms::u,
                                     nsGkAtoms::tt,
                                     nsGkAtoms::s,
@@ -53,24 +44,16 @@ HTMLEditUtils::IsInlineStyle(nsINode* aN
                                     nsGkAtoms::sup,
                                     nsGkAtoms::font);
 }
 
 /**
  * IsFormatNode() returns true if aNode is a format node.
  */
 bool
-HTMLEditUtils::IsFormatNode(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsFormatNode(node);
-}
-
-bool
 HTMLEditUtils::IsFormatNode(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::p,
                                     nsGkAtoms::pre,
                                     nsGkAtoms::h1,
                                     nsGkAtoms::h2,
                                     nsGkAtoms::h3,
@@ -106,66 +89,32 @@ HTMLEditUtils::IsHeader(nsINode& aNode)
   return aNode.IsAnyOfHTMLElements(nsGkAtoms::h1,
                                    nsGkAtoms::h2,
                                    nsGkAtoms::h3,
                                    nsGkAtoms::h4,
                                    nsGkAtoms::h5,
                                    nsGkAtoms::h6);
 }
 
-bool
-HTMLEditUtils::IsHeader(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  MOZ_ASSERT(node);
-  return IsHeader(*node);
-}
-
-/**
- * IsParagraph() returns true if aNode is an html paragraph.
- */
-bool
-HTMLEditUtils::IsParagraph(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::p);
-}
-
 /**
  * IsListItem() returns true if aNode is an html list item.
  */
 bool
-HTMLEditUtils::IsListItem(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsListItem(node);
-}
-
-bool
 HTMLEditUtils::IsListItem(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::li,
                                     nsGkAtoms::dd,
                                     nsGkAtoms::dt);
 }
 
 /**
  * IsTableElement() returns true if aNode is an html table, td, tr, ...
  */
 bool
-HTMLEditUtils::IsTableElement(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsTableElement(node);
-}
-
-bool
 HTMLEditUtils::IsTableElement(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::table,
                                     nsGkAtoms::tr,
                                     nsGkAtoms::td,
                                     nsGkAtoms::th,
                                     nsGkAtoms::thead,
@@ -174,24 +123,16 @@ HTMLEditUtils::IsTableElement(nsINode* a
                                     nsGkAtoms::caption);
 }
 
 /**
  * IsTableElementButNotTable() returns true if aNode is an html td, tr, ...
  * (doesn't include table)
  */
 bool
-HTMLEditUtils::IsTableElementButNotTable(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsTableElementButNotTable(node);
-}
-
-bool
 HTMLEditUtils::IsTableElementButNotTable(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::tr,
                                      nsGkAtoms::td,
                                      nsGkAtoms::th,
                                      nsGkAtoms::thead,
                                      nsGkAtoms::tfoot,
@@ -207,39 +148,25 @@ HTMLEditUtils::IsTable(nsINode* aNode)
 {
   return aNode && aNode->IsHTMLElement(nsGkAtoms::table);
 }
 
 /**
  * IsTableRow() returns true if aNode is an html tr.
  */
 bool
-HTMLEditUtils::IsTableRow(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::tr);
-}
-
-bool
 HTMLEditUtils::IsTableRow(nsINode* aNode)
 {
   return aNode && aNode->IsHTMLElement(nsGkAtoms::tr);
 }
 
 /**
  * IsTableCell() returns true if aNode is an html td or th.
  */
 bool
-HTMLEditUtils::IsTableCell(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsTableCell(node);
-}
-
-bool
 HTMLEditUtils::IsTableCell(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th);
 }
 
 /**
  * IsTableCellOrCaption() returns true if aNode is an html td or th or caption.
@@ -250,91 +177,43 @@ HTMLEditUtils::IsTableCellOrCaption(nsIN
   return aNode.IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th,
                                    nsGkAtoms::caption);
 }
 
 /**
  * IsList() returns true if aNode is an html list.
  */
 bool
-HTMLEditUtils::IsList(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsList(node);
-}
-
-bool
 HTMLEditUtils::IsList(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::ul,
                                     nsGkAtoms::ol,
                                     nsGkAtoms::dl);
 }
 
 /**
- * IsOrderedList() returns true if aNode is an html ordered list.
- */
-bool
-HTMLEditUtils::IsOrderedList(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::ol);
-}
-
-
-/**
- * IsUnorderedList() returns true if aNode is an html unordered list.
- */
-bool
-HTMLEditUtils::IsUnorderedList(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::ul);
-}
-
-/**
- * IsBlockquote() returns true if aNode is an html blockquote node.
- */
-bool
-HTMLEditUtils::IsBlockquote(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::blockquote);
-}
-
-/**
  * IsPre() returns true if aNode is an html pre node.
  */
 bool
-HTMLEditUtils::IsPre(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::pre);
-}
-
-bool
 HTMLEditUtils::IsPre(nsINode* aNode)
 {
   return aNode && aNode->IsHTMLElement(nsGkAtoms::pre);
 }
 
 /**
  * IsImage() returns true if aNode is an html image node.
  */
 bool
 HTMLEditUtils::IsImage(nsINode* aNode)
 {
   return aNode && aNode->IsHTMLElement(nsGkAtoms::img);
 }
 
 bool
-HTMLEditUtils::IsImage(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::img);
-}
-
-bool
 HTMLEditUtils::IsLink(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
 
   if (!aNode->IsContent()) {
     return false;
   }
 
@@ -357,47 +236,30 @@ HTMLEditUtils::IsNamedAnchor(nsINode* aN
   }
 
   nsAutoString text;
   return aNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
                                      text) && !text.IsEmpty();
 }
 
 /**
- * IsDiv() returns true if aNode is an html div node.
- */
-bool
-HTMLEditUtils::IsDiv(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::div);
-}
-
-/**
  * IsMozDiv() returns true if aNode is an html div node with |type = _moz|.
  */
 bool
 HTMLEditUtils::IsMozDiv(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::div) &&
          TextEditUtils::HasMozAttr(aNode);
 }
 
 /**
  * IsMailCite() returns true if aNode is an html blockquote with |type=cite|.
  */
 bool
-HTMLEditUtils::IsMailCite(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsMailCite(node);
-}
-
-bool
 HTMLEditUtils::IsMailCite(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
 
   // don't ask me why, but our html mailcites are id'd by "type=cite"...
   if (aNode->IsElement() &&
       aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                       NS_LITERAL_STRING("cite"),
@@ -415,24 +277,16 @@ HTMLEditUtils::IsMailCite(nsINode* aNode
 
   return false;
 }
 
 /**
  * IsFormWidget() returns true if aNode is a form widget of some kind.
  */
 bool
-HTMLEditUtils::IsFormWidget(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return node && IsFormWidget(node);
-}
-
-bool
 HTMLEditUtils::IsFormWidget(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsAnyOfHTMLElements(nsGkAtoms::textarea,
                                     nsGkAtoms::select,
                                     nsGkAtoms::button,
                                     nsGkAtoms::output,
                                     nsGkAtoms::keygen,
--- a/editor/libeditor/HTMLEditUtils.h
+++ b/editor/libeditor/HTMLEditUtils.h
@@ -3,62 +3,42 @@
  * 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 HTMLEditUtils_h
 #define HTMLEditUtils_h
 
 #include <stdint.h>
 
-class nsIDOMNode;
 class nsINode;
 
 namespace mozilla {
 
 class HTMLEditUtils final
 {
 public:
   static bool IsInlineStyle(nsINode* aNode);
-  static bool IsInlineStyle(nsIDOMNode *aNode);
   static bool IsFormatNode(nsINode* aNode);
-  static bool IsFormatNode(nsIDOMNode* aNode);
   static bool IsNodeThatCanOutdent(nsINode* aNode);
   static bool IsHeader(nsINode& aNode);
-  static bool IsHeader(nsIDOMNode* aNode);
-  static bool IsParagraph(nsIDOMNode* aNode);
   static bool IsListItem(nsINode* aNode);
-  static bool IsListItem(nsIDOMNode* aNode);
   static bool IsTable(nsINode* aNode);
-  static bool IsTableRow(nsIDOMNode* aNode);
   static bool IsTableRow(nsINode* aNode);
   static bool IsTableElement(nsINode* aNode);
-  static bool IsTableElement(nsIDOMNode* aNode);
   static bool IsTableElementButNotTable(nsINode* aNode);
-  static bool IsTableElementButNotTable(nsIDOMNode* aNode);
   static bool IsTableCell(nsINode* node);
-  static bool IsTableCell(nsIDOMNode* aNode);
   static bool IsTableCellOrCaption(nsINode& aNode);
   static bool IsList(nsINode* aNode);
-  static bool IsList(nsIDOMNode* aNode);
-  static bool IsOrderedList(nsIDOMNode* aNode);
-  static bool IsUnorderedList(nsIDOMNode* aNode);
-  static bool IsBlockquote(nsIDOMNode* aNode);
-  static bool IsPre(nsIDOMNode* aNode);
   static bool IsPre(nsINode* aNode);
-  static bool IsAnchor(nsIDOMNode* aNode);
   static bool IsImage(nsINode* aNode);
-  static bool IsImage(nsIDOMNode* aNode);
   static bool IsLink(nsINode* aNode);
   static bool IsNamedAnchor(nsINode* aNode);
-  static bool IsDiv(nsIDOMNode* aNode);
   static bool IsMozDiv(nsINode* aNode);
   static bool IsMailCite(nsINode* aNode);
-  static bool IsMailCite(nsIDOMNode* aNode);
   static bool IsFormWidget(nsINode* aNode);
-  static bool IsFormWidget(nsIDOMNode* aNode);
   static bool SupportsAlignAttr(nsINode& aNode);
   static bool CanContain(int32_t aParent, int32_t aChild);
   static bool IsContainer(int32_t aTag);
 
   /**
    * See execCommand spec:
    * https://w3c.github.io/editing/execCommand.html#non-list-single-line-container
    * https://w3c.github.io/editing/execCommand.html#single-line-container
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2585,21 +2585,22 @@ HTMLEditor::GetSelectedElement(const nsA
       nsCOMPtr<nsIContentIterator> iter =
         do_CreateInstance("@mozilla.org/content/post-content-iterator;1",
                           &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       iter->Init(currange);
       // loop through the content iterator for each content node
       while (!iter->IsDone()) {
-        // Query interface to cast nsIContent to nsIDOMNode
+        // Query interface to cast nsIContent to Element
         //  then get tagType to compare to  aTagName
         // Clone node of each desired type and append it to the aDomFrag
         nsINode* currentNode = iter->GetCurrentNode();
-        selectedElement = do_QueryInterface(currentNode);
+        selectedElement = currentNode && currentNode->IsElement() ?
+          currentNode->AsElement() : nullptr;
         if (selectedElement) {
           // If we already found a node, then we have another element,
           //  thus there's not just one element selected
           if (bNodeFound) {
             bNodeFound = false;
             break;
           }
 
@@ -3166,18 +3167,17 @@ HTMLEditor::GetEmbeddedObjects(nsIArray*
       dom::Element* element = node->AsElement();
 
       // See if it's an image or an embed and also include all links.
       // Let mail decide which link to send or not
       if (element->IsAnyOfHTMLElements(nsGkAtoms::img, nsGkAtoms::embed,
                                        nsGkAtoms::a) ||
           (element->IsHTMLElement(nsGkAtoms::body) &&
            element->HasAttr(kNameSpaceID_None, nsGkAtoms::background))) {
-        nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(node);
-        nodes->AppendElement(domNode);
+        nodes->AppendElement(node);
        }
      }
      iter->Next();
    }
 
   nodes.forget(aNodeList);
   return rv;
 }
@@ -3254,23 +3254,22 @@ HTMLEditor::DeleteNodeWithTransaction(ns
   nsresult rv = EditorBase::DeleteNodeWithTransaction(aNode);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLEditor::DeleteNode(nsIDOMNode* aDOMNode)
+HTMLEditor::DeleteNode(nsINode* aNode)
 {
-  nsCOMPtr<nsINode> node = do_QueryInterface(aDOMNode);
-  if (NS_WARN_IF(!node)) {
+  if (NS_WARN_IF(!aNode)) {
     return NS_ERROR_INVALID_ARG;
   }
-  nsresult rv = DeleteNodeWithTransaction(*node);
+  nsresult rv = DeleteNodeWithTransaction(*aNode);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::DeleteTextWithTransaction(CharacterData& aCharData,
@@ -3668,28 +3667,16 @@ HTMLEditor::GetEnclosingTable(nsINode* a
        block = GetBlockNodeParent(block)) {
     if (HTMLEditUtils::IsTable(block)) {
       return block;
     }
   }
   return nullptr;
 }
 
-nsIDOMNode*
-HTMLEditor::GetEnclosingTable(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode, "null node passed to HTMLEditor::GetEnclosingTable");
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  NS_ENSURE_TRUE(node, nullptr);
-  nsCOMPtr<Element> table = GetEnclosingTable(node);
-  nsCOMPtr<nsIDOMNode> ret = do_QueryInterface(table);
-  return ret;
-}
-
-
 /**
  * This method scans the selection for adjacent text nodes
  * and collapses them into a single text node.
  * "adjacent" means literally adjacent siblings of the same parent.
  * Uses EditorBase::JoinNodesWithTransaction() so action is undoable.
  * Should be called within the context of a batch transaction.
  */
 nsresult
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -136,17 +136,17 @@ public:
   NS_IMETHOD BeginningOfDocument() override;
   NS_IMETHOD SetFlags(uint32_t aFlags) override;
 
   NS_IMETHOD Paste(int32_t aSelectionType) override;
   NS_IMETHOD CanPaste(int32_t aSelectionType, bool* aCanPaste) override;
 
   NS_IMETHOD PasteTransferable(nsITransferable* aTransferable) override;
 
-  NS_IMETHOD DeleteNode(nsIDOMNode* aNode) override;
+  NS_IMETHOD DeleteNode(nsINode* aNode) override;
 
   NS_IMETHOD SelectAll() override;
 
   NS_IMETHOD DebugUnitTests(int32_t* outNumTests,
                             int32_t* outNumTestsFailed) override;
 
   virtual nsresult HandleKeyPressEvent(
                      WidgetKeyboardEvent* aKeyboardEvent) override;
@@ -1013,17 +1013,16 @@ protected: // Shouldn't be used by frien
 
   /**
    * Fallback method: Call this after using ClearSelection() and you
    * failed to set selection to some other content in the document.
    */
   nsresult SetSelectionAtDocumentStart(Selection* aSelection);
 
   static Element* GetEnclosingTable(nsINode* aNode);
-  static nsIDOMNode* GetEnclosingTable(nsIDOMNode* aNode);
 
   // Methods for handling plaintext quotations
   nsresult PasteAsPlaintextQuotation(int32_t aSelectionType);
 
   /**
    * Insert a string as quoted text, replacing the selected text (if any).
    * @param aQuotedText     The string to insert.
    * @param aAddCites       Whether to prepend extra ">" to each line
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -33,17 +33,16 @@
 #include "nsIScriptError.h"
 #include "nsContentUtils.h"
 #include "nsDebug.h"
 #include "nsDependentSubstring.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIFile.h"
 #include "nsIInputStream.h"
 #include "nsIMIMEService.h"
 #include "nsNameSpaceManager.h"
 #include "nsINode.h"
 #include "nsIParserUtils.h"
 #include "nsISupportsImpl.h"
--- a/editor/libeditor/HTMLTableEditor.cpp
+++ b/editor/libeditor/HTMLTableEditor.cpp
@@ -19,17 +19,16 @@
 #include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsFrameSelection.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
-#include "nsIDOMNode.h"
 #include "nsIFrame.h"
 #include "nsINode.h"
 #include "nsIPresShell.h"
 #include "nsISupportsUtils.h"
 #include "nsITableCellLayout.h" // For efficient access to table cell
 #include "nsLiteralString.h"
 #include "nsQueryFrame.h"
 #include "nsRange.h"
--- a/editor/libeditor/InsertNodeTransaction.cpp
+++ b/editor/libeditor/InsertNodeTransaction.cpp
@@ -97,17 +97,17 @@ InsertNodeTransaction::DoTransaction()
     } else {
       mPointToInsert.SetToEndOf(mPointToInsert.GetContainer());
       if (NS_WARN_IF(!mPointToInsert.IsSet())) {
         return NS_ERROR_FAILURE;
       }
     }
   }
 
-  mEditorBase->MarkNodeDirty(GetAsDOMNode(mContentToInsert));
+  mEditorBase->MarkNodeDirty(mContentToInsert);
 
   ErrorResult error;
   mPointToInsert.GetContainer()->InsertBefore(*mContentToInsert,
                                               mPointToInsert.GetChild(),
                                               error);
   error.WouldReportJSException();
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
--- a/editor/libeditor/SplitNodeTransaction.cpp
+++ b/editor/libeditor/SplitNodeTransaction.cpp
@@ -80,17 +80,17 @@ SplitNodeTransaction::DoTransaction()
     mStartOfRightNode.GetContainer()->CloneNode(false, error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   if (NS_WARN_IF(!clone)) {
     return NS_ERROR_UNEXPECTED;
   }
   mNewLeftNode = dont_AddRef(clone.forget().take()->AsContent());
-  mEditorBase->MarkNodeDirty(mStartOfRightNode.GetContainerAsDOMNode());
+  mEditorBase->MarkNodeDirty(mStartOfRightNode.GetContainer());
 
   // Get the parent node
   mParent = mStartOfRightNode.GetContainer()->GetParentNode();
   if (NS_WARN_IF(!mParent)) {
     return NS_ERROR_FAILURE;
   }
 
   // Insert the new node
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -36,17 +36,16 @@
 #include "nsDebug.h"
 #include "nsDependentSubstring.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIAbsorbingTransaction.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
-#include "nsIDOMNode.h"
 #include "nsIDocumentEncoder.h"
 #include "nsINode.h"
 #include "nsIPresShell.h"
 #include "nsISelectionController.h"
 #include "nsISupportsPrimitives.h"
 #include "nsITransferable.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsNameSpaceManager.h"
--- a/editor/libeditor/tests/test_root_element_replacement.html
+++ b/editor/libeditor/tests/test_root_element_replacement.html
@@ -85,17 +85,16 @@ function onLoadIFrame()
 
   var selCon = SpecialPowers.wrap(gIFrame).contentWindow.
     QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
     getInterface(SpecialPowers.Ci.nsIWebNavigation).
     QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
     getInterface(SpecialPowers.Ci.nsISelectionDisplay).
     QueryInterface(SpecialPowers.Ci.nsISelectionController);
   var utils = SpecialPowers.getDOMWindowUtils(window);
-  const nsIDOMNode = SpecialPowers.Ci.nsIDOMNode;
 
   // move focus to the HTML editor
   const kTest = kTests[gTestIndex];
   ok(true, "Running " + kTest.description);
   if (kTest.args.length == 1) {
     kTest.initializer(frameDoc, gSetFocusToIFrame, kTest.args[0]);
     ok(selCon.caretVisible, "caret isn't visible -- " + kTest.description);
   } else {
@@ -105,19 +104,19 @@ function onLoadIFrame()
   is(utils.IMEStatus, utils.IME_STATUS_ENABLED,
      "IME isn't enabled -- " + kTest.description);
   synthesizeKey("A", { }, gIFrame.contentWindow);
   synthesizeKey("B", { }, gIFrame.contentWindow);
   synthesizeKey("C", { }, gIFrame.contentWindow);
   var content = frameDoc.body.firstChild;
   ok(content, "body doesn't have contents -- " + kTest.description);
   if (content) {
-    is(content.nodeType, nsIDOMNode.TEXT_NODE,
+    is(content.nodeType, Node.TEXT_NODE,
        "the content of body isn't text node -- " + kTest.description);
-    if (content.nodeType == nsIDOMNode.TEXT_NODE) {
+    if (content.nodeType == Node.TEXT_NODE) {
       is(content.data, "ABC",
          "the content of body text isn't 'ABC' -- " + kTest.description);
       is(frameDoc.body.innerHTML, "ABC",
          "the innerHTML of body isn't 'ABC' -- " + kTest.description);
     }
   }
 
   document.getElementById("display").removeChild(gIFrame);
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -16,16 +16,17 @@ interface nsITransactionManager;
 interface nsITransaction;
 interface nsIEditorObserver;
 interface nsIEditActionListener;
 interface nsIInlineSpellChecker;
 interface nsITransferable;
 
 webidl Document;
 webidl Element;
+webidl Node;
 webidl Selection;
 
 %{C++
 namespace mozilla {
 class EditorBase;
 class HTMLEditor;
 class TextEditor;
 } // namespace mozilla
@@ -350,94 +351,91 @@ interface nsIEditor  : nsISupports
   void removeAttribute(in Element aElement,
                        in AString aAttribute);
 
   /**
    * cloneAttribute() copies the attribute from the source node to
    * the destination node and delete those not in the source.
    *
    * The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
-   * @param aAttribute    the name of the attribute to copy
-   * @param aDestNode     the destination element to operate on
-   * @param aSourceNode   the source element to copy attributes from
-   * @exception NS_ERROR_NULL_POINTER at least one of the nodes is null
-   * @exception NS_ERROR_NO_INTERFACE at least one of the nodes is not an
-   *                                  element
+   * @param aAttribute     the name of the attribute to copy
+   * @param aDestElement   the destination element to operate on
+   * @param aSourceElement the source element to copy attributes from
+   * @exception NS_ERROR_NULL_POINTER at least one of the elements is null
    */
   void cloneAttribute(in AString aAttribute,
-                      in nsIDOMNode aDestNode, in nsIDOMNode aSourceNode);
+                      in Element aDestElement, in Element aSourceElement);
 
   /**
-   * cloneAttributes() is similar to nsIDOMNode::cloneNode(),
+   * cloneAttributes() is similar to Node::cloneNode(),
    *   it assures the attribute nodes of the destination are identical
    *   with the source node by copying all existing attributes from the
    *   source and deleting those not in the source.
-   *   This is used when the destination node (element) already exists
+   *   This is used when the destination element already exists
    *
-   * The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
    * @param aDestNode     the destination element to operate on
    * @param aSourceNode   the source element to copy attributes from
    */
-  void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
+  void cloneAttributes(in Element aDestElement, in Element aSourceElement);
 
   /**
    * insertNode inserts aNode into aParent at aPosition.
    * No checking is done to verify the legality of the insertion.
    * That is the responsibility of the caller.
    * @param aNode     The DOM Node to insert.
    * @param aParent   The node to insert the new object into
    * @param aPosition The place in aParent to insert the new node
    *                  0=first child, 1=second child, etc.
    *                  any number > number of current children = last child
    */
-  void insertNode(in nsIDOMNode node,
-                  in nsIDOMNode parent,
-                  in long       aPosition);
+  void insertNode(in Node node,
+                  in Node parent,
+                  in long aPosition);
 
 
   /**
    * splitNode() creates a new node identical to an existing node,
    * and split the contents between the two nodes
    * @param aExistingRightNode   the node to split.
    *                             It will become the new node's next sibling.
    * @param aOffset              the offset of aExistingRightNode's
    *                             content|children to do the split at
    * @param aNewLeftNode         [OUT] the new node resulting from the split,
    *                             becomes aExistingRightNode's previous sibling.
    */
-  void splitNode(in nsIDOMNode existingRightNode,
-                 in long      offset,
-                 out nsIDOMNode newLeftNode);
+  void splitNode(in Node existingRightNode,
+                 in long offset,
+                 out Node newLeftNode);
 
   /**
    * joinNodes() takes 2 nodes and merge their content|children.
    * @param aLeftNode     The left node.  It will be deleted.
    * @param aRightNode    The right node. It will remain after the join.
    * @param aParent       The parent of aExistingRightNode
    *
    *                      There is no requirement that the two nodes be
    *                      of the same type.  However, a text node can be
    *                      merged only with another text node.
    */
-  void joinNodes(in nsIDOMNode leftNode,
-                 in nsIDOMNode rightNode,
-                 in nsIDOMNode parent);
+  void joinNodes(in Node leftNode,
+                 in Node rightNode,
+                 in Node parent);
 
   /**
    * deleteNode removes aChild from aParent.
    * @param aChild    The node to delete
    */
-  void deleteNode(in nsIDOMNode child);
+  void deleteNode(in Node child);
 
   /**
    * markNodeDirty() sets a special dirty attribute on the node.
    * Usually this will be called immediately after creating a new node.
    * @param aNode      The node for which to insert formatting.
    */
-  void markNodeDirty(in nsIDOMNode node);
+  void markNodeDirty(in Node node);
 
 /* ---------- direction controller ---------- */
 
   /**
    * Switches the editor element direction; from "Left-to-Right" to
    * "Right-to-Left", and vice versa.
    */
   void switchTextDirection();
--- a/editor/spellchecker/TextServicesDocument.cpp
+++ b/editor/spellchecker/TextServicesDocument.cpp
@@ -15,17 +15,16 @@
 #include "nsDebug.h"                    // for NS_ENSURE_TRUE, etc
 #include "nsDependentSubstring.h"       // for Substring
 #include "nsError.h"                    // for NS_OK, NS_ERROR_FAILURE, etc
 #include "nsFilteredContentIterator.h"  // for nsFilteredContentIterator
 #include "nsGenericHTMLElement.h"       // for nsGenericHTMLElement
 #include "nsIContent.h"                 // for nsIContent, etc
 #include "nsIContentIterator.h"         // for nsIContentIterator
 #include "nsID.h"                       // for NS_GET_IID
-#include "nsIDOMNode.h"                 // for nsIDOMNode, etc
 #include "nsIEditor.h"                  // for nsIEditor, etc
 #include "nsINode.h"                    // for nsINode
 #include "nsIPlaintextEditor.h"         // for nsIPlaintextEditor
 #include "nsISelectionController.h"     // for nsISelectionController, etc
 #include "nsISupportsBase.h"            // for nsISupports
 #include "nsISupportsUtils.h"           // for NS_IF_ADDREF, NS_ADDREF, etc
 #include "nsITextServicesFilter.h"      // for nsITextServicesFilter
 #include "mozilla/intl/WordBreaker.h"   // for WordRange, WordBreaker
@@ -1909,26 +1908,16 @@ TextServicesDocument::HasSameBlockNodePa
 // static
 bool
 TextServicesDocument::IsTextNode(nsIContent* aContent)
 {
   NS_ENSURE_TRUE(aContent, false);
   return nsINode::TEXT_NODE == aContent->NodeType();
 }
 
-// static
-bool
-TextServicesDocument::IsTextNode(nsIDOMNode* aNode)
-{
-  NS_ENSURE_TRUE(aNode, false);
-
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
-  return IsTextNode(content);
-}
-
 nsresult
 TextServicesDocument::SetSelectionInternal(int32_t aOffset,
                                            int32_t aLength,
                                            bool aDoUpdate)
 {
   NS_ENSURE_TRUE(mSelCon && aOffset >= 0 && aLength >= 0, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsINode> startNode;
--- a/editor/spellchecker/TextServicesDocument.h
+++ b/editor/spellchecker/TextServicesDocument.h
@@ -11,17 +11,16 @@
 #include "nsIEditActionListener.h"
 #include "nsISupportsImpl.h"
 #include "nsStringFwd.h"
 #include "nsTArray.h"
 #include "nscore.h"
 
 class nsIContent;
 class nsIContentIterator;
-class nsIDOMNode;
 class nsIEditor;
 class nsINode;
 class nsISelectionController;
 class nsITextServicesFilter;
 class nsRange;
 
 namespace mozilla {
 
@@ -257,17 +256,16 @@ private:
   static nsresult FirstTextNodeInPrevBlock(nsIContentIterator* aIterator);
   static nsresult FirstTextNodeInNextBlock(nsIContentIterator* aIterator);
 
   nsresult GetFirstTextNodeInPrevBlock(nsIContent** aContent);
   nsresult GetFirstTextNodeInNextBlock(nsIContent** aContent);
 
   static bool IsBlockNode(nsIContent* aContent);
   static bool IsTextNode(nsIContent* aContent);
-  static bool IsTextNode(nsIDOMNode* aNode);
 
   static bool DidSkip(nsIContentIterator* aFilteredIter);
   static void ClearDidSkip(nsIContentIterator* aFilteredIter);
 
   static bool HasSameBlockNodeParent(nsIContent* aContent1,
                                      nsIContent* aContent2);
 
   nsresult SetSelectionInternal(int32_t aOffset, int32_t aLength,
--- a/editor/spellchecker/nsFilteredContentIterator.cpp
+++ b/editor/spellchecker/nsFilteredContentIterator.cpp
@@ -8,17 +8,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsFilteredContentIterator.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
-#include "nsIDOMNode.h"
 #include "nsINode.h"
 #include "nsISupportsBase.h"
 #include "nsISupportsUtils.h"
 #include "nsITextServicesFilter.h"
 #include "nsRange.h"
 
 using namespace mozilla;
 
--- a/editor/spellchecker/nsFilteredContentIterator.h
+++ b/editor/spellchecker/nsFilteredContentIterator.h
@@ -8,17 +8,16 @@
 
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIContentIterator.h"
 #include "nsISupportsImpl.h"
 #include "nscore.h"
 
 class nsAtom;
-class nsIDOMNode;
 class nsINode;
 class nsITextServicesFilter;
 class nsRange;
 
 class nsFilteredContentIterator final : public nsIContentIterator
 {
 public: