Bug 1449147 - Clean up more nsIDOMNode usages in editor. r=masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 27 Mar 2018 20:19:35 +0900
changeset 773731 209a4b7601f7516ca90edac89abdfa5a6069d9a6
parent 773730 5bf126434fac78a31256c994b9dbf4b1031b0350
push id104285
push userbmo:m_kato@ga2.so-net.ne.jp
push dateWed, 28 Mar 2018 10:50:07 +0000
reviewersmasayuki
bugs1449147
milestone61.0a1
Bug 1449147 - Clean up more nsIDOMNode usages in editor. r=masayuki To reduce QI, I would like to replace nsIDOMNode with nsINode. And some parameters in *DataTransder.cpp's methods is unused (it uses as nullptr), so we should remove these parameters. Also nsIDOMNodeList is unused now, so we should remove this including. MozReview-Commit-ID: 1QTIkxDazjJ
editor/libeditor/CSSEditUtils.cpp
editor/libeditor/CSSEditUtils.h
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/libeditor/EditorEventListener.cpp
editor/libeditor/EditorUtils.h
editor/libeditor/HTMLAbsPositionEditor.cpp
editor/libeditor/HTMLAnonymousNodeEditor.cpp
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditRules.h
editor/libeditor/HTMLEditUtils.cpp
editor/libeditor/HTMLEditUtils.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/HTMLEditorEventListener.cpp
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/libeditor/HTMLInlineTableEditor.cpp
editor/libeditor/PlaceholderTransaction.h
editor/libeditor/SelectionState.cpp
editor/libeditor/SelectionState.h
editor/libeditor/TextEditRules.h
editor/libeditor/TextEditUtils.cpp
editor/libeditor/TextEditUtils.h
editor/libeditor/TextEditor.h
editor/libeditor/TextEditorDataTransfer.cpp
editor/libeditor/TextEditorTest.cpp
--- a/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -18,17 +18,16 @@
 #include "nsComputedDOMStyle.h"
 #include "nsDebug.h"
 #include "nsDependentSubstring.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsICSSDeclaration.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMWindow.h"
 #include "nsIDocument.h"
 #include "nsIEditor.h"
 #include "nsINode.h"
 #include "nsISupportsImpl.h"
 #include "nsISupportsUtils.h"
 #include "nsLiteralString.h"
 #include "nsPIDOMWindow.h"
--- a/editor/libeditor/CSSEditUtils.h
+++ b/editor/libeditor/CSSEditUtils.h
@@ -11,17 +11,16 @@
 #include "nsStringFwd.h"
 #include "nsTArray.h"               // for nsTArray
 #include "nscore.h"                 // for nsAString, nsresult, nullptr
 
 class nsComputedDOMStyle;
 class nsAtom;
 class nsIContent;
 class nsICSSDeclaration;
-class nsIDOMNode;
 class nsINode;
 
 namespace mozilla {
 
 class HTMLEditor;
 namespace dom {
 class Element;
 } // namespace dom
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -73,17 +73,16 @@
 #include "nsAtom.h"                    // for nsAtom
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIDOMDocument.h"             // for nsIDOMDocument
 #include "nsIDOMElement.h"              // for nsIDOMElement
 #include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventListener.h"        // for nsIDOMEventListener
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
 #include "nsIDOMNode.h"                 // for nsIDOMNode, etc.
-#include "nsIDOMNodeList.h"             // for nsIDOMNodeList
 #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.
@@ -3914,34 +3913,16 @@ EditorBase::GetTag(nsIDOMNode* aNode)
     NS_ASSERTION(aNode, "null node passed to EditorBase::GetTag()");
     return nullptr;
   }
 
   return content->NodeInfo()->NameAtom();
 }
 
 bool
-EditorBase::NodesSameType(nsIDOMNode* aNode1,
-                          nsIDOMNode* aNode2)
-{
-  if (!aNode1 || !aNode2) {
-    NS_NOTREACHED("null node passed to EditorBase::NodesSameType()");
-    return false;
-  }
-
-  nsCOMPtr<nsIContent> content1 = do_QueryInterface(aNode1);
-  NS_ENSURE_TRUE(content1, false);
-
-  nsCOMPtr<nsIContent> content2 = do_QueryInterface(aNode2);
-  NS_ENSURE_TRUE(content2, false);
-
-  return AreNodesSameType(content1, content2);
-}
-
-bool
 EditorBase::AreNodesSameType(nsIContent* aNode1,
                              nsIContent* aNode2)
 {
   MOZ_ASSERT(aNode1);
   MOZ_ASSERT(aNode2);
   return aNode1->NodeInfo()->NameAtom() == aNode2->NodeInfo()->NameAtom();
 }
 
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1181,17 +1181,16 @@ public:
     return mTransactionManager->RemoveTransactionListener(aListener);
   }
 
   /**
    * From html rules code - migration in progress.
    */
   static nsAtom* GetTag(nsIDOMNode* aNode);
 
-  bool NodesSameType(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
   virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2);
 
   static bool IsTextNode(nsIDOMNode* aNode);
   static bool IsTextNode(nsINode* aNode)
   {
     return aNode->NodeType() == nsINode::TEXT_NODE;
   }
 
@@ -1529,17 +1528,17 @@ public:
   /**
    * Used to insert content from a data transfer into the editable area.
    * This is called for each item in the data transfer, with the index of
    * each item passed as aIndex.
    */
   virtual nsresult InsertFromDataTransfer(dom::DataTransfer* aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument* aSourceDoc,
-                                          nsIDOMNode* aDestinationNode,
+                                          nsINode* aDestinationNode,
                                           int32_t aDestOffset,
                                           bool aDoDeleteSelection) = 0;
 
   virtual nsresult InsertFromDrop(dom::DragEvent* aDropEvent) = 0;
 
   /**
    * GetIMESelectionStartOffsetIn() returns the start offset of IME selection in
    * the aTextNode.  If there is no IME selection, returns -1.
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -29,17 +29,16 @@
 #include "nsIController.h"              // for nsIController
 #include "nsID.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/DragEvent.h"
 #include "nsIDOMDocument.h"             // for nsIDOMDocument
 #include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
-#include "nsIDOMNode.h"                 // for nsIDOMNode
 #include "nsIDocument.h"                // for nsIDocument
 #include "nsIFocusManager.h"            // for nsIFocusManager
 #include "nsIFormControl.h"             // for nsIFormControl, etc.
 #include "nsINode.h"                    // for nsINode, ::NODE_IS_EDITABLE, etc.
 #include "nsIPlaintextEditor.h"         // for nsIPlaintextEditor, etc.
 #include "nsIPresShell.h"               // for nsIPresShell
 #include "nsISelectionController.h"     // for nsISelectionController, etc.
 #include "nsITransferable.h"            // for kFileMime, kHTMLMime, etc.
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -9,17 +9,16 @@
 
 #include "mozilla/dom/Selection.h"
 #include "mozilla/EditAction.h"
 #include "mozilla/EditorBase.h"
 #include "mozilla/EditorDOMPoint.h"
 #include "mozilla/GuardObjects.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
-#include "nsIDOMNode.h"
 #include "nsIEditor.h"
 #include "nscore.h"
 
 class nsAtom;
 class nsIContentIterator;
 class nsIDOMDocument;
 class nsIDOMEvent;
 class nsISimpleEnumerator;
--- a/editor/libeditor/HTMLAbsPositionEditor.cpp
+++ b/editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -25,17 +25,16 @@
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
 #include "nsROCSSPrimitiveValue.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMNode.h"
 #include "nsDOMCSSRGBColor.h"
 #include "nsIDOMWindow.h"
 #include "nsIHTMLObjectResizer.h"
 #include "nsINode.h"
 #include "nsIPresShell.h"
 #include "nsISupportsImpl.h"
 #include "nsISupportsUtils.h"
 #include "nsLiteralString.h"
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
+++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
@@ -14,17 +14,16 @@
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsID.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMNode.h"
 #include "nsIDOMWindow.h"
 #include "nsIDocument.h"
 #include "nsIDocumentObserver.h"
 #include "nsIHTMLAbsPosEditor.h"
 #include "nsIHTMLInlineTableEditor.h"
 #include "nsIHTMLObjectResizer.h"
 #include "nsStubMutationObserver.h"
 #include "nsINode.h"
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -37,17 +37,16 @@
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsID.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMNode.h"
 #include "nsIFrame.h"
 #include "nsIHTMLAbsPosEditor.h"
 #include "nsIHTMLDocument.h"
 #include "nsINode.h"
 #include "nsLiteralString.h"
 #include "nsRange.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
@@ -2722,18 +2721,17 @@ HTMLEditRules::WillDeleteSelection(Selec
 
         // Are the blocks siblings?
         nsCOMPtr<nsINode> leftBlockParent = leftParent->GetParentNode();
         nsCOMPtr<nsINode> rightBlockParent = rightParent->GetParentNode();
 
         // MOOSE: this could conceivably screw up a table.. fix me.
         NS_ENSURE_STATE(mHTMLEditor);
         if (leftBlockParent == rightBlockParent &&
-            mHTMLEditor->NodesSameType(GetAsDOMNode(leftParent),
-                                       GetAsDOMNode(rightParent)) &&
+            mHTMLEditor->AreNodesSameType(leftParent, rightParent) &&
             // XXX What's special about these three types of block?
             (leftParent->IsHTMLElement(nsGkAtoms::p) ||
              HTMLEditUtils::IsListItem(leftParent) ||
              HTMLEditUtils::IsHeader(*leftParent))) {
           // First delete the selection
           NS_ENSURE_STATE(mHTMLEditor);
           rv = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
           NS_ENSURE_SUCCESS(rv, rv);
@@ -3425,17 +3423,17 @@ HTMLEditRules::MoveContents(Element& aEl
 
 
 nsresult
 HTMLEditRules::DeleteNonTableElements(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   if (!HTMLEditUtils::IsTableElementButNotTable(aNode)) {
     NS_ENSURE_STATE(mHTMLEditor);
-    return mHTMLEditor->DeleteNode(aNode->AsDOMNode());
+    return mHTMLEditor->DeleteNode(aNode);
   }
 
   AutoTArray<nsCOMPtr<nsIContent>, 10> childList;
   for (nsIContent* child = aNode->GetFirstChild();
        child; child = child->GetNextSibling()) {
     childList.AppendElement(child);
   }
 
@@ -5223,17 +5221,17 @@ HTMLEditRules::WillAlign(Selection& aSel
             curNode->AsElement(), nullptr,
             nsGkAtoms::align, &aAlignType, false);
         curDiv = nullptr;
         continue;
       }
       if (HTMLEditUtils::IsList(atCurNode.GetContainer())) {
         // If we don't use CSS, add a contraint to list element: they have to
         // be inside another list, i.e., >= second level of nesting
-        rv = AlignInnerBlocks(*curNode, &aAlignType);
+        rv = AlignInnerBlocks(*curNode, aAlignType);
         NS_ENSURE_SUCCESS(rv, rv);
         curDiv = nullptr;
         continue;
       }
       // Clear out curDiv so that we don't put nodes after this one into it
     }
 
     // Need to make a div to put things in if we haven't already, or if this
@@ -5269,88 +5267,85 @@ HTMLEditRules::WillAlign(Selection& aSel
 }
 
 
 /**
  * AlignInnerBlocks() aligns inside table cells or list items.
  */
 nsresult
 HTMLEditRules::AlignInnerBlocks(nsINode& aNode,
-                                const nsAString* alignType)
-{
-  NS_ENSURE_TRUE(alignType, NS_ERROR_NULL_POINTER);
-
+                                const nsAString& aAlignType)
+{
   // Gather list of table cells or list items
   nsTArray<OwningNonNull<nsINode>> nodeArray;
   TableCellAndListItemFunctor functor;
   DOMIterator iter(aNode);
   iter.AppendList(functor, nodeArray);
 
   // Now that we have the list, align their contents as requested
   for (auto& node : nodeArray) {
-    nsresult rv = AlignBlockContents(GetAsDOMNode(node), alignType);
-    NS_ENSURE_SUCCESS(rv, rv);
+    nsresult rv = AlignBlockContents(*node, aAlignType);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
   }
 
   return NS_OK;
 }
 
 
 /**
  * AlignBlockContents() aligns contents of a block element.
  */
 nsresult
-HTMLEditRules::AlignBlockContents(nsIDOMNode* aNode,
-                                  const nsAString* alignType)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  NS_ENSURE_TRUE(node && alignType, NS_ERROR_NULL_POINTER);
-  nsCOMPtr<nsIContent> firstChild, lastChild;
-
-  NS_ENSURE_STATE(mHTMLEditor);
-  firstChild = mHTMLEditor->GetFirstEditableChild(*node);
-  NS_ENSURE_STATE(mHTMLEditor);
-  lastChild = mHTMLEditor->GetLastEditableChild(*node);
+HTMLEditRules::AlignBlockContents(nsINode& aNode,
+                                  const nsAString& aAlignType)
+{
+  if (NS_WARN_IF(!mHTMLEditor)) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
+
+  nsCOMPtr<nsIContent> firstChild = htmlEditor->GetFirstEditableChild(aNode);
   if (!firstChild) {
     // this cell has no content, nothing to align
-  } else if (firstChild == lastChild &&
-             firstChild->IsHTMLElement(nsGkAtoms::div)) {
+    return NS_OK;
+  }
+
+  nsCOMPtr<nsIContent> lastChild = htmlEditor->GetLastEditableChild(aNode);
+  if (firstChild == lastChild && firstChild->IsHTMLElement(nsGkAtoms::div)) {
     // the cell already has a div containing all of its content: just
     // act on this div.
-    RefPtr<Element> divElem = firstChild->AsElement();
-    NS_ENSURE_STATE(mHTMLEditor);
-    nsresult rv = mHTMLEditor->SetAttributeOrEquivalent(divElem,
-                                                        nsGkAtoms::align,
-                                                        *alignType, false);
+    return htmlEditor->SetAttributeOrEquivalent(firstChild->AsElement(),
+                                                nsGkAtoms::align,
+                                                aAlignType, false);
+  }
+
+  // else we need to put in a div, set the alignment, and toss in all the
+  // children
+  EditorRawDOMPoint atStartOfNode(&aNode, 0);
+  RefPtr<Element> divElem =
+    htmlEditor->CreateNode(nsGkAtoms::div, atStartOfNode);
+  if (NS_WARN_IF(!divElem)) {
+    return NS_ERROR_FAILURE;
+  }
+  // set up the alignment on the div
+  nsresult rv =
+    htmlEditor->SetAttributeOrEquivalent(divElem, nsGkAtoms::align,
+                                         aAlignType, false);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+  // tuck the children into the end of the active div
+  while (lastChild && (lastChild != divElem)) {
+    nsresult rv = htmlEditor->MoveNode(lastChild, divElem, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
-  } else {
-    // else we need to put in a div, set the alignment, and toss in all the children
-    NS_ENSURE_STATE(mHTMLEditor);
-    EditorRawDOMPoint atStartOfNode(node, 0);
-    RefPtr<Element> divElem =
-      mHTMLEditor->CreateNode(nsGkAtoms::div, atStartOfNode);
-    NS_ENSURE_STATE(divElem);
-    // set up the alignment on the div
-    NS_ENSURE_STATE(mHTMLEditor);
-    nsresult rv =
-      mHTMLEditor->SetAttributeOrEquivalent(divElem, nsGkAtoms::align,
-                                            *alignType, false);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-    // tuck the children into the end of the active div
-    while (lastChild && (lastChild != divElem)) {
-      NS_ENSURE_STATE(mHTMLEditor);
-      nsresult rv = mHTMLEditor->MoveNode(lastChild, divElem, 0);
-      NS_ENSURE_SUCCESS(rv, rv);
-      NS_ENSURE_STATE(mHTMLEditor);
-      lastChild = mHTMLEditor->GetLastEditableChild(*node);
-    }
+    lastChild = htmlEditor->GetLastEditableChild(aNode);
   }
   return NS_OK;
 }
 
 /**
  * CheckForEmptyBlock() is called by WillDeleteSelection() to detect and handle
  * case of deleting from inside an empty block.
  */
@@ -7021,28 +7016,28 @@ HTMLEditRules::ReturnInParagraph(Selecti
   } else if (atStartOfSelection.IsInTextNode()) {
     // at beginning of text node?
     if (atStartOfSelection.IsStartOfContainer()) {
       // is there a BR prior to it?
       brNode =
         htmlEditor->GetPriorHTMLSibling(atStartOfSelection.GetContainer());
       if (!brNode ||
           !htmlEditor->IsVisibleBRElement(brNode) ||
-          TextEditUtils::HasMozAttr(GetAsDOMNode(brNode))) {
+          TextEditUtils::HasMozAttr(brNode)) {
         pointToInsertBR.Set(atStartOfSelection.GetContainer());
         brNode = nullptr;
       }
     } else if (atStartOfSelection.IsEndOfContainer()) {
       // we're at the end of text node...
       // is there a BR after to it?
       brNode =
         htmlEditor->GetNextHTMLSibling(atStartOfSelection.GetContainer());
       if (!brNode ||
           !htmlEditor->IsVisibleBRElement(brNode) ||
-          TextEditUtils::HasMozAttr(GetAsDOMNode(brNode))) {
+          TextEditUtils::HasMozAttr(brNode)) {
         pointToInsertBR.Set(atStartOfSelection.GetContainer());
         DebugOnly<bool> advanced = pointToInsertBR.AdvanceOffset();
         NS_WARNING_ASSERTION(advanced,
           "Failed to advance offset to after the container of selection start");
         brNode = nullptr;
       }
     } else {
       if (doesCRCreateNewP) {
@@ -7064,22 +7059,22 @@ HTMLEditRules::ReturnInParagraph(Selecti
     }
   } else {
     // not in a text node.
     // is there a BR prior to it?
     nsCOMPtr<nsIContent> nearNode;
     nearNode =
       htmlEditor->GetPreviousEditableHTMLNode(atStartOfSelection);
     if (!nearNode || !htmlEditor->IsVisibleBRElement(nearNode) ||
-        TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
+        TextEditUtils::HasMozAttr(nearNode)) {
       // is there a BR after it?
       nearNode =
         htmlEditor->GetNextEditableHTMLNode(atStartOfSelection);
       if (!nearNode || !htmlEditor->IsVisibleBRElement(nearNode) ||
-          TextEditUtils::HasMozAttr(GetAsDOMNode(nearNode))) {
+          TextEditUtils::HasMozAttr(nearNode)) {
         pointToInsertBR = atStartOfSelection;
         splitAfterNewBR = true;
       }
     }
     if (!pointToInsertBR.IsSet() && TextEditUtils::IsBreak(nearNode)) {
       brNode = nearNode;
     }
   }
@@ -8376,25 +8371,16 @@ HTMLEditRules::FindNearEditableNode(cons
     return nullptr;
   }
 
   // otherwise, ok, we have found a good spot to put the selection
   return nearNode;
 }
 
 bool
-HTMLEditRules::InDifferentTableElements(nsIDOMNode* aNode1,
-                                        nsIDOMNode* aNode2)
-{
-  nsCOMPtr<nsINode> node1 = do_QueryInterface(aNode1);
-  nsCOMPtr<nsINode> node2 = do_QueryInterface(aNode2);
-  return InDifferentTableElements(node1, node2);
-}
-
-bool
 HTMLEditRules::InDifferentTableElements(nsINode* aNode1,
                                         nsINode* aNode2)
 {
   MOZ_ASSERT(aNode1 && aNode2);
 
   while (aNode1 && !HTMLEditUtils::IsTableElement(aNode1)) {
     aNode1 = aNode1->GetParentNode();
   }
@@ -8488,18 +8474,17 @@ HTMLEditRules::RemoveEmptyNodes()
             bIsCandidate = true;
           }
         }
       }
 
       if (bIsCandidate) {
         // We delete mailcites even if they have a solo br in them.  Other
         // nodes we require to be empty.
-        rv = htmlEditor->IsEmptyNode(node->AsDOMNode(), &bIsEmptyNode,
-                                     bIsMailCite, true);
+        rv = htmlEditor->IsEmptyNode(node, &bIsEmptyNode, bIsMailCite, true);
         NS_ENSURE_SUCCESS(rv, rv);
         if (bIsEmptyNode) {
           if (bIsMailCite) {
             // mailcites go on a separate list from other empty nodes
             arrayOfEmptyCites.AppendElement(*node);
           } else {
             arrayOfEmptyNodes.AppendElement(*node);
           }
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -13,18 +13,16 @@
 #include "nsCOMPtr.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsISupportsImpl.h"
 #include "nsTArray.h"
 #include "nscore.h"
 
 class nsAtom;
-class nsIDOMDocument;
-class nsIDOMNode;
 class nsIEditor;
 class nsINode;
 class nsRange;
 
 namespace mozilla {
 
 class EditActionResult;
 class HTMLEditor;
@@ -270,18 +268,18 @@ protected:
                                bool* aCancel, bool* aHandled);
   nsresult WillMakeBasicBlock(Selection& aSelection,
                               const nsAString& aBlockType,
                               bool* aCancel, bool* aHandled);
   nsresult MakeBasicBlock(Selection& aSelection, nsAtom& aBlockType);
   nsresult DidMakeBasicBlock(Selection* aSelection, RulesInfo* aInfo,
                              nsresult aResult);
   nsresult DidAbsolutePosition();
-  nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType);
-  nsresult AlignBlockContents(nsIDOMNode* aNode, const nsAString* alignType);
+  nsresult AlignInnerBlocks(nsINode& aNode, const nsAString& aAlignType);
+  nsresult AlignBlockContents(nsINode& aNode, const nsAString& aAlignType);
   nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
                                   nsINode* aNode);
   nsresult GetFormatString(nsINode* aNode, nsAString &outFormat);
   enum class Lists { no, yes };
   enum class Tables { no, yes };
   void GetInnerContent(nsINode& aNode,
                        nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
                        int32_t* aIndex, Lists aLists = Lists::yes,
@@ -364,18 +362,16 @@ protected:
 
   nsresult CheckForEmptyBlock(nsINode* aStartNode, Element* aBodyNode,
                               Selection* aSelection,
                               nsIEditor::EDirection aAction, bool* aHandled);
   enum class BRLocation { beforeBlock, blockEnd };
   Element* CheckForInvisibleBR(Element& aBlock, BRLocation aWhere,
                                int32_t aOffset = 0);
   nsresult ExpandSelectionForDeletion(Selection& aSelection);
-  bool IsFirstNode(nsIDOMNode* aNode);
-  bool IsLastNode(nsIDOMNode* aNode);
   nsresult NormalizeSelection(Selection* aSelection);
   EditorDOMPoint GetPromotedPoint(RulesEndpoint aWhere, nsINode& aNode,
                                   int32_t aOffset, EditAction actionID);
   void GetPromotedRanges(Selection& aSelection,
                          nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
                          EditAction inOperationType);
   void PromoteRange(nsRange& aRange, EditAction inOperationType);
   enum class TouchContent { no, yes };
@@ -458,17 +454,16 @@ protected:
    * @return                            When succeeded, SplitPoint() returns
    *                                    the point to insert the element.
    */
   template<typename PT, typename CT>
   SplitNodeResult MaybeSplitAncestorsForInsert(
                     nsAtom& aTag,
                     const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
 
-  nsresult AddTerminatingBR(nsIDOMNode *aBlock);
   EditorDOMPoint JoinNodesSmart(nsIContent& aNodeLeft,
                                 nsIContent& aNodeRight);
   Element* GetTopEnclosingMailCite(nsINode& aNode);
   nsresult PopListItem(nsIContent& aListItem, bool* aOutOfList = nullptr);
   nsresult RemoveListStructure(Element& aList);
   nsresult CacheInlineStyles(nsINode* aNode);
   nsresult ReapplyCachedStyles();
   void ClearCachedStyles();
@@ -497,17 +492,16 @@ protected:
                                    nsIEditor::EDirection aDirection);
   /**
    * Returns true if aNode1 or aNode2 or both is the descendant of some type of
    * table element, but their nearest table element ancestors differ.  "Table
    * element" here includes not just <table> but also <td>, <tbody>, <tr>, etc.
    * The nodes count as being their own descendants for this purpose, so a
    * table element is its own nearest table element ancestor.
    */
-  bool InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
   bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
   nsresult RemoveEmptyNodes();
   nsresult SelectionEndpointInNode(nsINode* aNode, bool* aResult);
   nsresult UpdateDocChangeRange(nsRange* aRange);
   nsresult ConfirmSelectionInBody();
 
   /**
    * Insert normal <br> element into aNode when aNode is a block and it has
--- a/editor/libeditor/HTMLEditUtils.cpp
+++ b/editor/libeditor/HTMLEditUtils.cpp
@@ -369,27 +369,21 @@ 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(nsIDOMNode* aNode)
-{
-  return IsDiv(aNode) && TextEditUtils::HasMozAttr(aNode);
-}
-
-bool
 HTMLEditUtils::IsMozDiv(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::div) &&
-         TextEditUtils::HasMozAttr(GetAsDOMNode(aNode));
+         TextEditUtils::HasMozAttr(aNode);
 }
 
 /**
  * IsMailCite() returns true if aNode is an html blockquote with |type=cite|.
  */
 bool
 HTMLEditUtils::IsMailCite(nsIDOMNode* aNode)
 {
--- a/editor/libeditor/HTMLEditUtils.h
+++ b/editor/libeditor/HTMLEditUtils.h
@@ -45,17 +45,16 @@ public:
   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 IsMozDiv(nsIDOMNode* 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);
 
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -819,34 +819,23 @@ HTMLEditor::NodeIsBlockStatic(const nsIN
                                     nsGkAtoms::dd)) {
     return true;
   }
 
   return nsHTMLElement::IsBlock(
     nsHTMLTags::AtomTagToId(aElement->NodeInfo()->NameAtom()));
 }
 
-nsresult
-HTMLEditor::NodeIsBlockStatic(nsIDOMNode* aNode,
-                              bool* aIsBlock)
-{
-  if (!aNode || !aIsBlock) {
-    return NS_ERROR_NULL_POINTER;
-  }
-
-  nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
-  *aIsBlock = element && NodeIsBlockStatic(element);
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 HTMLEditor::NodeIsBlock(nsIDOMNode* aNode,
                         bool* aIsBlock)
 {
-  return NodeIsBlockStatic(aNode, aIsBlock);
+  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
+  *aIsBlock = IsBlockNode(node);
+  return NS_OK;
 }
 
 bool
 HTMLEditor::IsBlockNode(nsINode* aNode)
 {
   return aNode && NodeIsBlockStatic(aNode);
 }
 
@@ -3657,20 +3646,17 @@ HTMLEditor::CollapseAdjacentTextNodes(ns
     // we assume a textNodes entry can't be nullptr
     nsINode* leftTextNode = textNodes[0];
     nsINode* rightTextNode = textNodes[1];
     NS_ASSERTION(leftTextNode && rightTextNode,"left or rightTextNode null in CollapseAdjacentTextNodes");
 
     // get the prev sibling of the right node, and see if its leftTextNode
     nsCOMPtr<nsINode> prevSibOfRightNode = rightTextNode->GetPreviousSibling();
     if (prevSibOfRightNode && prevSibOfRightNode == leftTextNode) {
-      nsCOMPtr<nsINode> parent = rightTextNode->GetParentNode();
-      NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
-      rv = JoinNodes(leftTextNode->AsDOMNode(), rightTextNode->AsDOMNode(),
-                     parent->AsDOMNode());
+      rv = JoinNodes(*leftTextNode, *rightTextNode);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     textNodes.RemoveElementAt(0); // remove the leftmost text node from the list
   }
 
   return NS_OK;
 }
@@ -4030,28 +4016,16 @@ HTMLEditor::IsVisibleTextNode(Text& aTex
 }
 
 /**
  * IsEmptyNode() figures out if aNode is an empty node.  A block can have
  * children and still be considered empty, if the children are empty or
  * non-editable.
  */
 nsresult
-HTMLEditor::IsEmptyNode(nsIDOMNode*aNode,
-                        bool* outIsEmptyNode,
-                        bool aSingleBRDoesntCount,
-                        bool aListOrCellNotEmpty,
-                        bool aSafeToAskFrames)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  return IsEmptyNode(node, outIsEmptyNode, aSingleBRDoesntCount,
-                     aListOrCellNotEmpty, aSafeToAskFrames);
-}
-
-nsresult
 HTMLEditor::IsEmptyNode(nsINode* aNode,
                         bool* outIsEmptyNode,
                         bool aSingleBRDoesntCount,
                         bool aListOrCellNotEmpty,
                         bool aSafeToAskFrames)
 {
   NS_ENSURE_TRUE(aNode && outIsEmptyNode, NS_ERROR_NULL_POINTER);
   *outIsEmptyNode = true;
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -224,17 +224,16 @@ public:
   NS_IMETHOD PreDestroy(bool aDestroyingFrames) override;
 
   virtual nsresult GetPreferredIMEState(widget::IMEState* aState) override;
 
   /**
    * @param aElement        Must not be null.
    */
   static bool NodeIsBlockStatic(const nsINode* aElement);
-  static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
 
   // non-virtual methods of interface methods
   bool AbsolutePositioningEnabled() const
   {
     return mIsAbsolutelyPositioningEnabled;
   }
 
   /**
@@ -451,20 +450,16 @@ public:
    * only whitespaces and they are collapsed, returns false.
    */
   bool IsVisibleTextNode(Text& aText);
 
   /**
    * aNode must be a non-null text node.
    * outIsEmptyNode must be non-null.
    */
-  nsresult IsEmptyNode(nsIDOMNode* aNode, bool* outIsEmptyBlock,
-                       bool aMozBRDoesntCount = false,
-                       bool aListOrCellNotEmpty = false,
-                       bool aSafeToAskFrames = false);
   nsresult IsEmptyNode(nsINode* aNode, bool* outIsEmptyBlock,
                        bool aMozBRDoesntCount = false,
                        bool aListOrCellNotEmpty = false,
                        bool aSafeToAskFrames = false);
   nsresult IsEmptyNodeImpl(nsINode* aNode,
                            bool* outIsEmptyBlock,
                            bool aMozBRDoesntCount,
                            bool aListOrCellNotEmpty,
@@ -572,32 +567,32 @@ public:
     bool aIgnoreIfSelectionInEditingHost);
 
 protected:
   class BlobReader final : public nsIEditorBlobListener
   {
   public:
     BlobReader(dom::BlobImpl* aBlob, HTMLEditor* aHTMLEditor,
                bool aIsSafe, nsIDOMDocument* aSourceDoc,
-               nsIDOMNode* aDestinationNode, int32_t aDestOffset,
+               nsINode* aDestinationNode, int32_t aDestOffset,
                bool aDoDeleteSelection);
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIEDITORBLOBLISTENER
 
   private:
     ~BlobReader()
     {
     }
 
     RefPtr<dom::BlobImpl> mBlob;
     RefPtr<HTMLEditor> mHTMLEditor;
     bool mIsSafe;
     nsCOMPtr<nsIDOMDocument> mSourceDoc;
-    nsCOMPtr<nsIDOMNode> mDestinationNode;
+    nsCOMPtr<nsINode> mDestinationNode;
     int32_t mDestOffset;
     bool mDoDeleteSelection;
   };
 
   NS_IMETHOD InitRules() override;
 
   virtual void CreateEventListeners() override;
   virtual nsresult InstallEventListeners() override;
@@ -770,36 +765,34 @@ protected:
    */
   nsresult InsertAsPlaintextQuotation(const nsAString& aQuotedText,
                                       bool aAddCites,
                                       nsIDOMNode** aNodeInserted);
 
   nsresult InsertObject(const nsACString& aType, nsISupports* aObject,
                         bool aIsSafe,
                         nsIDOMDocument* aSourceDoc,
-                        nsIDOMNode* aDestinationNode,
+                        nsINode* aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
   // factored methods for handling insertion of data from transferables
   // (drag&drop or clipboard)
   NS_IMETHOD PrepareTransferable(nsITransferable** transferable) override;
   nsresult PrepareHTMLTransferable(nsITransferable** transferable);
   nsresult InsertFromTransferable(nsITransferable* transferable,
                                     nsIDOMDocument* aSourceDoc,
                                     const nsAString& aContextStr,
                                     const nsAString& aInfoStr,
                                     bool havePrivateHTMLFlavor,
-                                    nsIDOMNode *aDestinationNode,
-                                    int32_t aDestinationOffset,
                                     bool aDoDeleteSelection);
   virtual nsresult InsertFromDataTransfer(dom::DataTransfer* aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument* aSourceDoc,
-                                          nsIDOMNode* aDestinationNode,
+                                          nsINode* aDestinationNode,
                                           int32_t aDestOffset,
                                           bool aDoDeleteSelection) override;
   bool HavePrivateHTMLFlavor(nsIClipboard* clipboard );
   nsresult ParseCFHTML(nsCString& aCfhtml, char16_t** aStuffToPaste,
                        char16_t** aCfcontext);
 
   bool IsInLink(nsINode* aNode, nsCOMPtr<nsINode>* outLink = nullptr);
   nsresult StripFormattingNodes(nsIContent& aNode, bool aOnlyList = false);
@@ -1114,17 +1107,17 @@ protected:
    * aClearStyle should be set to false if you want the paste to be affected by
    * local style (e.g., for the insertHTML command).
    */
   nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
                                    const nsAString& aContextStr,
                                    const nsAString& aInfoStr,
                                    const nsAString& aFlavor,
                                    nsIDOMDocument* aSourceDoc,
-                                   nsIDOMNode* aDestNode,
+                                   nsINode* aDestNode,
                                    int32_t aDestOffset,
                                    bool aDeleteSelection,
                                    bool aTrustedInput,
                                    bool aClearStyle = true);
 
   nsresult ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
                       nsAtom* aProperty, nsAtom* aAttribute);
 
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -163,42 +163,45 @@ HTMLEditor::LoadHTML(const nsAString& aI
   return rules->DidDoAction(selection, &ruleInfo, rv);
 }
 
 NS_IMETHODIMP
 HTMLEditor::InsertHTML(const nsAString& aInString)
 {
   const nsString& empty = EmptyString();
 
-  return InsertHTMLWithContext(aInString, empty, empty, empty,
-                               nullptr,  nullptr, 0, true);
+  return DoInsertHTMLWithContext(aInString, empty, empty, empty,
+                                 nullptr,  nullptr, 0, true, true, false);
 }
 
-nsresult
+NS_IMETHODIMP
 HTMLEditor::InsertHTMLWithContext(const nsAString& aInputString,
                                   const nsAString& aContextStr,
                                   const nsAString& aInfoStr,
                                   const nsAString& aFlavor,
                                   nsIDOMDocument* aSourceDoc,
                                   nsIDOMNode* aDestNode,
                                   int32_t aDestOffset,
                                   bool aDeleteSelection)
 {
+  nsCOMPtr<nsINode> destNode = do_QueryInterface(aDestNode);
   return DoInsertHTMLWithContext(aInputString, aContextStr, aInfoStr,
-      aFlavor, aSourceDoc, aDestNode, aDestOffset, aDeleteSelection,
-      /* trusted input */ true, /* clear style */ false);
+                                 aFlavor, aSourceDoc, destNode, aDestOffset,
+                                 aDeleteSelection,
+                                 /* trusted input */ true,
+                                 /* clear style */ false);
 }
 
 nsresult
 HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
                                     const nsAString& aContextStr,
                                     const nsAString& aInfoStr,
                                     const nsAString& aFlavor,
                                     nsIDOMDocument* aSourceDoc,
-                                    nsIDOMNode* aDestDOMNode,
+                                    nsINode* aDestNode,
                                     int32_t aDestOffset,
                                     bool aDeleteSelection,
                                     bool aTrustedInput,
                                     bool aClearStyle)
 {
   NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
 
   // Prevent the edit rules object from dying
@@ -222,36 +225,35 @@ HTMLEditor::DoInsertHTMLWithContext(cons
                                            address_of(streamStartParent),
                                            address_of(streamEndParent),
                                            &streamStartOffset,
                                            &streamEndOffset,
                                            aTrustedInput);
   NS_ENSURE_SUCCESS(rv, rv);
 
   EditorDOMPoint targetPoint;
-  if (!aDestDOMNode) {
+  if (!aDestNode) {
     // if caller didn't provide the destination/target node,
     // fetch the paste insertion point from our selection
     targetPoint = EditorBase::GetStartPoint(selection);
     if (NS_WARN_IF(!targetPoint.IsSet()) ||
         !IsEditable(targetPoint.GetContainer())) {
       return NS_ERROR_FAILURE;
     }
   } else {
-    nsCOMPtr<nsINode> destNode = do_QueryInterface(aDestDOMNode);
-    targetPoint.Set(destNode, aDestOffset);
+    targetPoint.Set(aDestNode, aDestOffset);
   }
 
   // if we have a destination / target node, we want to insert there
   // rather than in place of the selection
-  // ignore aDeleteSelection here if no aDestDOMNode since deletion will
+  // ignore aDeleteSelection here if no aDestNode since deletion will
   // also occur later; this block is intended to cover the various
   // scenarios where we are dropping in an editor (and may want to delete
   // the selection before collapsing the selection in the new destination)
-  if (aDestDOMNode) {
+  if (aDestNode) {
     if (aDeleteSelection) {
       // Use an auto tracker so that our drop point is correctly
       // positioned after the delete.
       AutoTrackDOMPoint tracker(mRangeUpdater, &targetPoint);
       rv = DeleteSelection(eNone, eStrip);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
@@ -954,17 +956,17 @@ ImgFromData(const nsACString& aType, con
 }
 
 NS_IMPL_ISUPPORTS(HTMLEditor::BlobReader, nsIEditorBlobListener)
 
 HTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob,
                                    HTMLEditor* aHTMLEditor,
                                    bool aIsSafe,
                                    nsIDOMDocument* aSourceDoc,
-                                   nsIDOMNode* aDestinationNode,
+                                   nsINode* aDestinationNode,
                                    int32_t aDestOffset,
                                    bool aDoDeleteSelection)
   : mBlob(aBlob)
   , mHTMLEditor(aHTMLEditor)
   , mIsSafe(aIsSafe)
   , mSourceDoc(aSourceDoc)
   , mDestinationNode(aDestinationNode)
   , mDestOffset(aDestOffset)
@@ -995,34 +997,33 @@ HTMLEditor::BlobReader::OnResult(const n
                                             mDoDeleteSelection,
                                             mIsSafe, false);
   return rv;
 }
 
 NS_IMETHODIMP
 HTMLEditor::BlobReader::OnError(const nsAString& aError)
 {
-  nsCOMPtr<nsINode> destNode = do_QueryInterface(mDestinationNode);
   const nsPromiseFlatString& flat = PromiseFlatString(aError);
   const char16_t* error = flat.get();
   nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                   NS_LITERAL_CSTRING("Editor"),
-                                  destNode->OwnerDoc(),
+                                  mDestinationNode->OwnerDoc(),
                                   nsContentUtils::eDOM_PROPERTIES,
                                   "EditorFileDropFailed",
                                   &error, 1);
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::InsertObject(const nsACString& aType,
                          nsISupports* aObject,
                          bool aIsSafe,
                          nsIDOMDocument* aSourceDoc,
-                         nsIDOMNode* aDestinationNode,
+                         nsINode* aDestinationNode,
                          int32_t aDestOffset,
                          bool aDoDeleteSelection)
 {
   nsresult rv;
 
   if (nsCOMPtr<BlobImpl> blob = do_QueryInterface(aObject)) {
     RefPtr<BlobReader> br = new BlobReader(blob, this, aIsSafe, aSourceDoc,
                                            aDestinationNode, aDestOffset,
@@ -1095,18 +1096,16 @@ HTMLEditor::InsertObject(const nsACStrin
 }
 
 nsresult
 HTMLEditor::InsertFromTransferable(nsITransferable* transferable,
                                    nsIDOMDocument* aSourceDoc,
                                    const nsAString& aContextStr,
                                    const nsAString& aInfoStr,
                                    bool havePrivateHTMLFlavor,
-                                   nsIDOMNode* aDestinationNode,
-                                   int32_t aDestOffset,
                                    bool aDoDeleteSelection)
 {
   nsresult rv = NS_OK;
   nsAutoCString bestFlavor;
   nsCOMPtr<nsISupports> genericDataObj;
   uint32_t len = 0;
   if (NS_SUCCEEDED(
         transferable->GetAnyTransferData(bestFlavor,
@@ -1119,17 +1118,17 @@ HTMLEditor::InsertFromTransferable(nsITr
     bool isSafe = IsSafeToInsertData(aSourceDoc);
 
     if (bestFlavor.EqualsLiteral(kFileMime) ||
         bestFlavor.EqualsLiteral(kJPEGImageMime) ||
         bestFlavor.EqualsLiteral(kJPGImageMime) ||
         bestFlavor.EqualsLiteral(kPNGImageMime) ||
         bestFlavor.EqualsLiteral(kGIFImageMime)) {
       rv = InsertObject(bestFlavor, genericDataObj, isSafe,
-                        aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection);
+                        aSourceDoc, nullptr, 0, aDoDeleteSelection);
     } else if (bestFlavor.EqualsLiteral(kNativeHTMLMime)) {
       // note cf_html uses utf8, hence use length = len, not len/2 as in flavors below
       nsCOMPtr<nsISupportsCString> textDataObj = do_QueryInterface(genericDataObj);
       if (textDataObj && len > 0) {
         nsAutoCString cfhtml;
         textDataObj->GetData(cfhtml);
         NS_ASSERTION(cfhtml.Length() <= (len), "Invalid length!");
         nsString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
@@ -1138,24 +1137,24 @@ HTMLEditor::InsertFromTransferable(nsITr
         if (NS_SUCCEEDED(rv) && !cffragment.IsEmpty()) {
           AutoPlaceholderBatch beginBatching(this);
           // If we have our private HTML flavor, we will only use the fragment
           // from the CF_HTML. The rest comes from the clipboard.
           if (havePrivateHTMLFlavor) {
             rv = DoInsertHTMLWithContext(cffragment,
                                          aContextStr, aInfoStr, flavor,
                                          aSourceDoc,
-                                         aDestinationNode, aDestOffset,
+                                         nullptr, 0,
                                          aDoDeleteSelection,
                                          isSafe);
           } else {
             rv = DoInsertHTMLWithContext(cffragment,
                                          cfcontext, cfselection, flavor,
                                          aSourceDoc,
-                                         aDestinationNode, aDestOffset,
+                                         nullptr, 0,
                                          aDoDeleteSelection,
                                          isSafe);
 
           }
         } else {
           // In some platforms (like Linux), the clipboard might return data
           // requested for unknown flavors (for example:
           // application/x-moz-nativehtml).  In this case, treat the data
@@ -1186,21 +1185,21 @@ HTMLEditor::InsertFromTransferable(nsITr
       }
 
       if (!stuffToPaste.IsEmpty()) {
         AutoPlaceholderBatch beginBatching(this);
         if (bestFlavor.EqualsLiteral(kHTMLMime)) {
           rv = DoInsertHTMLWithContext(stuffToPaste,
                                        aContextStr, aInfoStr, flavor,
                                        aSourceDoc,
-                                       aDestinationNode, aDestOffset,
+                                       nullptr, 0,
                                        aDoDeleteSelection,
                                        isSafe);
         } else {
-          rv = InsertTextAt(stuffToPaste, aDestinationNode, aDestOffset, aDoDeleteSelection);
+          rv = InsertTextAt(stuffToPaste, nullptr, 0, aDoDeleteSelection);
         }
       }
     }
   }
 
   // Try to scroll the selection into view if the paste succeeded
   if (NS_SUCCEEDED(rv)) {
     ScrollSelectionIntoView(false);
@@ -1220,17 +1219,17 @@ GetStringFromDataTransfer(DataTransfer* 
     variant->GetAsAString(aOutputString);
   }
 }
 
 nsresult
 HTMLEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
                                    int32_t aIndex,
                                    nsIDOMDocument* aSourceDoc,
-                                   nsIDOMNode* aDestinationNode,
+                                   nsINode* aDestinationNode,
                                    int32_t aDestOffset,
                                    bool aDoDeleteSelection)
 {
   ErrorResult rv;
   RefPtr<DOMStringList> types =
     aDataTransfer->MozTypesAt(aIndex, CallerType::System, rv);
   if (rv.Failed()) {
     return rv.StealNSResult();
@@ -1253,17 +1252,18 @@ HTMLEditor::InsertFromDataTransfer(DataT
           type.EqualsLiteral(kPNGImageMime) ||
           type.EqualsLiteral(kGIFImageMime)) {
         nsCOMPtr<nsIVariant> variant;
         aDataTransfer->GetDataAtNoSecurityCheck(type, aIndex, getter_AddRefs(variant));
         if (variant) {
           nsCOMPtr<nsISupports> object;
           variant->GetAsISupports(getter_AddRefs(object));
           return InsertObject(NS_ConvertUTF16toUTF8(type), object, isSafe,
-                              aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection);
+                              aSourceDoc, aDestinationNode, aDestOffset,
+                              aDoDeleteSelection);
         }
       } else if (type.EqualsLiteral(kNativeHTMLMime)) {
         // Windows only clipboard parsing.
         nsAutoString text;
         GetStringFromDataTransfer(aDataTransfer, type, aIndex, text);
         NS_ConvertUTF16toUTF8 cfhtml(text);
 
         nsString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
@@ -1417,18 +1417,18 @@ HTMLEditor::Paste(int32_t aSelectionType
 
   // handle transferable hooks
   nsCOMPtr<nsIDOMDocument> domdoc;
   GetDocument(getter_AddRefs(domdoc));
   if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, trans)) {
     return NS_OK;
   }
 
-  return InsertFromTransferable(trans, nullptr, contextStr, infoStr, bHavePrivateHTMLFlavor,
-                                nullptr, 0, true);
+  return InsertFromTransferable(trans, nullptr, contextStr, infoStr,
+                                bHavePrivateHTMLFlavor, true);
 }
 
 NS_IMETHODIMP
 HTMLEditor::PasteTransferable(nsITransferable* aTransferable)
 {
   // Use an invalid value for the clipboard type as data comes from aTransferable
   // and we don't currently implement a way to put that in the data transfer yet.
   if (!FireClipboardEvent(ePaste, nsIClipboard::kGlobalClipboard)) {
@@ -1437,18 +1437,18 @@ HTMLEditor::PasteTransferable(nsITransfe
 
   // handle transferable hooks
   nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
   if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, aTransferable)) {
     return NS_OK;
   }
 
   nsAutoString contextStr, infoStr;
-  return InsertFromTransferable(aTransferable, nullptr, contextStr, infoStr, false,
-                                nullptr, 0, true);
+  return InsertFromTransferable(aTransferable, nullptr, contextStr, infoStr,
+                                false, true);
 }
 
 /**
  * HTML PasteNoFormatting. Ignore any HTML styles and formating in paste source.
  */
 NS_IMETHODIMP
 HTMLEditor::PasteNoFormatting(int32_t aSelectionType)
 {
@@ -1467,18 +1467,17 @@ HTMLEditor::PasteNoFormatting(int32_t aS
   // use TextEditor::PrepareTransferable() to force unicode plaintext data.
   nsCOMPtr<nsITransferable> trans;
   rv = TextEditor::PrepareTransferable(getter_AddRefs(trans));
   if (NS_SUCCEEDED(rv) && trans) {
     // Get the Data from the clipboard
     if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) &&
         IsModifiable()) {
       const nsString& empty = EmptyString();
-      rv = InsertFromTransferable(trans, nullptr, empty, empty, false, nullptr, 0,
-                                  true);
+      rv = InsertFromTransferable(trans, nullptr, empty, empty, false, true);
     }
   }
 
   return rv;
 }
 
 // The following arrays contain the MIME types that we can paste. The arrays
 // are used by CanPaste() and CanPasteTransferable() below.
--- a/editor/libeditor/HTMLEditorEventListener.cpp
+++ b/editor/libeditor/HTMLEditorEventListener.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/Selection.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMNode.h"
 #include "nsISupportsImpl.h"
 #include "nsLiteralString.h"
 #include "nsQueryObject.h"
 #include "nsRange.h"
 
 namespace mozilla {
 
 using namespace dom;
@@ -132,31 +131,29 @@ HTMLEditorEventListener::MouseDown(Mouse
           range->IsPointInRange(*parent, offset, err) && !err.Failed();
 
         // Done when we find a range that we are in
         if (nodeIsInSelection) {
           break;
         }
       }
     }
-    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(target);
+    nsCOMPtr<nsINode> node = do_QueryInterface(target);
     if (node && !nodeIsInSelection) {
       if (!element) {
         if (isContextClick) {
           // Set the selection to the point under the mouse cursor:
           selection->Collapse(parent, offset);
         } else {
           // Get enclosing link if in text so we can select the link
-          nsCOMPtr<nsIDOMElement> linkElement;
-          nsresult rv = htmlEditor->GetElementOrParentByTagName(
-                             NS_LITERAL_STRING("href"), node,
-                             getter_AddRefs(linkElement));
-          NS_ENSURE_SUCCESS(rv, rv);
+          RefPtr<Element> linkElement =
+            htmlEditor->GetElementOrParentByTagName(NS_LITERAL_STRING("href"),
+                                                    node);
           if (linkElement) {
-            element = linkElement;
+            element = do_QueryInterface(linkElement);
           }
         }
       }
       // Select entire element clicked on if NOT within an existing selection
       //   and not the entire body, or table-related elements
       if (element) {
         if (isContextClick && !HTMLEditUtils::IsImage(node)) {
           selection->Collapse(parent, offset);
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -22,17 +22,16 @@
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsID.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsISupportsUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nscore.h"
--- a/editor/libeditor/HTMLInlineTableEditor.cpp
+++ b/editor/libeditor/HTMLInlineTableEditor.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIContent.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMNode.h"
 #include "nsIHTMLObjectResizer.h"
 #include "nsIPresShell.h"
 #include "nsLiteralString.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nscore.h"
 
 namespace mozilla {
--- a/editor/libeditor/PlaceholderTransaction.h
+++ b/editor/libeditor/PlaceholderTransaction.h
@@ -5,17 +5,16 @@
 
 #ifndef PlaceholderTransaction_h
 #define PlaceholderTransaction_h
 
 #include "EditAggregateTransaction.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/Maybe.h"
 #include "nsIAbsorbingTransaction.h"
-#include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 #include "nsWeakPtr.h"
 
 namespace mozilla {
 
 class CompositionTransaction;
 
 /**
--- a/editor/libeditor/SelectionState.cpp
+++ b/editor/libeditor/SelectionState.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/EditorUtils.h"        // for EditorUtils
 #include "mozilla/dom/RangeBinding.h"
 #include "mozilla/dom/Selection.h"      // for Selection
 #include "nsAString.h"                  // for nsAString::Length
 #include "nsCycleCollectionParticipant.h"
 #include "nsDebug.h"                    // for NS_ENSURE_TRUE, etc.
 #include "nsError.h"                    // for NS_OK, etc.
 #include "nsIContent.h"                 // for nsIContent
-#include "nsIDOMNode.h"                 // for nsIDOMNode
 #include "nsISupportsImpl.h"            // for nsRange::Release
 #include "nsRange.h"                    // for nsRange
 
 namespace mozilla {
 
 using namespace dom;
 
 /******************************************************************************
@@ -572,27 +571,16 @@ RangeUpdater::DidRemoveContainer(nsINode
     } else if (item->mEndContainer == aParent && item->mEndOffset > aOffset) {
       item->mEndOffset += (int32_t)aNodeOrigLen - 1;
     }
   }
   return NS_OK;
 }
 
 nsresult
-RangeUpdater::DidRemoveContainer(nsIDOMNode* aNode,
-                                 nsIDOMNode* aParent,
-                                 int32_t aOffset,
-                                 uint32_t aNodeOrigLen)
-{
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
-  return DidRemoveContainer(node, parent, aOffset, aNodeOrigLen);
-}
-
-nsresult
 RangeUpdater::WillInsertContainer()
 {
   if (mLock) {
     return NS_ERROR_UNEXPECTED;
   }
   mLock = true;
   return NS_OK;
 }
--- a/editor/libeditor/SelectionState.h
+++ b/editor/libeditor/SelectionState.h
@@ -3,17 +3,16 @@
  * 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_SelectionState_h
 #define mozilla_SelectionState_h
 
 #include "mozilla/EditorDOMPoint.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMNode.h"
 #include "nsINode.h"
 #include "nsTArray.h"
 #include "nscore.h"
 
 class nsCycleCollectionTraversalCallback;
 class nsRange;
 namespace mozilla {
 class RangeUpdater;
@@ -127,18 +126,16 @@ public:
   // gravity routines will be called inside of these sandwiches, but should be
   // ignored.
   nsresult WillReplaceContainer();
   nsresult DidReplaceContainer(dom::Element* aOriginalNode,
                                dom::Element* aNewNode);
   nsresult WillRemoveContainer();
   nsresult DidRemoveContainer(nsINode* aNode, nsINode* aParent,
                               int32_t aOffset, uint32_t aNodeOrigLen);
-  nsresult DidRemoveContainer(nsIDOMNode* aNode, nsIDOMNode* aParent,
-                              int32_t aOffset, uint32_t aNodeOrigLen);
   nsresult WillInsertContainer();
   nsresult DidInsertContainer();
   void WillMoveNode();
   void DidMoveNode(nsINode* aOldParent, int32_t aOldOffset,
                    nsINode* aNewParent, int32_t aNewOffset);
 
 private:
   friend void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback&,
@@ -170,61 +167,42 @@ ImplCycleCollectionUnlink(RangeUpdater& 
  * Helper class for using SelectionState.  Stack based class for doing
  * preservation of dom points across editor actions.
  */
 
 class MOZ_STACK_CLASS AutoTrackDOMPoint final
 {
 private:
   RangeUpdater& mRangeUpdater;
-  // Allow tracking either nsIDOMNode or nsINode until nsIDOMNode is gone
+  // Allow tracking nsINode until nsNode is gone
   nsCOMPtr<nsINode>* mNode;
-  nsCOMPtr<nsIDOMNode>* mDOMNode;
   int32_t* mOffset;
   EditorDOMPoint* mPoint;
   RefPtr<RangeItem> mRangeItem;
 
 public:
   AutoTrackDOMPoint(RangeUpdater& aRangeUpdater,
                     nsCOMPtr<nsINode>* aNode, int32_t* aOffset)
     : mRangeUpdater(aRangeUpdater)
     , mNode(aNode)
-    , mDOMNode(nullptr)
     , mOffset(aOffset)
     , mPoint(nullptr)
   {
     mRangeItem = new RangeItem();
     mRangeItem->mStartContainer = *mNode;
     mRangeItem->mEndContainer = *mNode;
     mRangeItem->mStartOffset = *mOffset;
     mRangeItem->mEndOffset = *mOffset;
     mRangeUpdater.RegisterRangeItem(mRangeItem);
   }
 
   AutoTrackDOMPoint(RangeUpdater& aRangeUpdater,
-                    nsCOMPtr<nsIDOMNode>* aNode, int32_t* aOffset)
-    : mRangeUpdater(aRangeUpdater)
-    , mNode(nullptr)
-    , mDOMNode(aNode)
-    , mOffset(aOffset)
-    , mPoint(nullptr)
-  {
-    mRangeItem = new RangeItem();
-    mRangeItem->mStartContainer = do_QueryInterface(*mDOMNode);
-    mRangeItem->mEndContainer = do_QueryInterface(*mDOMNode);
-    mRangeItem->mStartOffset = *mOffset;
-    mRangeItem->mEndOffset = *mOffset;
-    mRangeUpdater.RegisterRangeItem(mRangeItem);
-  }
-
-  AutoTrackDOMPoint(RangeUpdater& aRangeUpdater,
                     EditorDOMPoint* aPoint)
     : mRangeUpdater(aRangeUpdater)
     , mNode(nullptr)
-    , mDOMNode(nullptr)
     , mOffset(nullptr)
     , mPoint(aPoint)
   {
     mRangeItem = new RangeItem();
     mRangeItem->mStartContainer = mPoint->GetContainer();
     mRangeItem->mEndContainer = mPoint->GetContainer();
     mRangeItem->mStartOffset = mPoint->Offset();
     mRangeItem->mEndOffset = mPoint->Offset();
@@ -233,21 +211,17 @@ public:
 
   ~AutoTrackDOMPoint()
   {
     mRangeUpdater.DropRangeItem(mRangeItem);
     if (mPoint) {
       mPoint->Set(mRangeItem->mStartContainer, mRangeItem->mStartOffset);
       return;
     }
-    if (mNode) {
-      *mNode = mRangeItem->mStartContainer;
-    } else {
-      *mDOMNode = GetAsDOMNode(mRangeItem->mStartContainer);
-    }
+    *mNode = mRangeItem->mStartContainer;
     *mOffset = mRangeItem->mStartOffset;
   }
 };
 
 /**
  * Another helper class for SelectionState.  Stack based class for doing
  * Will/DidReplaceContainer()
  */
@@ -280,30 +254,30 @@ public:
  * Another helper class for SelectionState.  Stack based class for doing
  * Will/DidRemoveContainer()
  */
 
 class MOZ_STACK_CLASS AutoRemoveContainerSelNotify final
 {
 private:
   RangeUpdater& mRangeUpdater;
-  nsIDOMNode* mNode;
-  nsIDOMNode* mParent;
+  nsINode* mNode;
+  nsINode* mParent;
   int32_t mOffset;
   uint32_t mNodeOrigLen;
 
 public:
   AutoRemoveContainerSelNotify(RangeUpdater& aRangeUpdater,
                                nsINode* aNode,
                                nsINode* aParent,
                                int32_t aOffset,
                                uint32_t aNodeOrigLen)
     : mRangeUpdater(aRangeUpdater)
-    , mNode(aNode->AsDOMNode())
-    , mParent(aParent->AsDOMNode())
+    , mNode(aNode)
+    , mParent(aParent)
     , mOffset(aOffset)
     , mNodeOrigLen(aNodeOrigLen)
   {
     mRangeUpdater.WillRemoveContainer();
   }
 
   ~AutoRemoveContainerSelNotify()
   {
--- a/editor/libeditor/TextEditRules.h
+++ b/editor/libeditor/TextEditRules.h
@@ -12,18 +12,16 @@
 #include "nsCycleCollectionParticipant.h"
 #include "nsIEditor.h"
 #include "nsINamed.h"
 #include "nsISupportsImpl.h"
 #include "nsITimer.h"
 #include "nsString.h"
 #include "nscore.h"
 
-class nsIDOMNode;
-
 namespace mozilla {
 
 class AutoLockRulesSniffing;
 class HTMLEditRules;
 class RulesInfo;
 class TextEditor;
 namespace dom {
 class Selection;
--- a/editor/libeditor/TextEditUtils.cpp
+++ b/editor/libeditor/TextEditUtils.cpp
@@ -9,96 +9,73 @@
 #include "mozilla/TextEditor.h"
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
 #include "nsCaseTreatment.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMNode.h"
 #include "nsNameSpaceManager.h"
 #include "nsLiteralString.h"
 #include "nsString.h"
 
 namespace mozilla {
 
 /******************************************************************************
  * TextEditUtils
  ******************************************************************************/
 
 /**
  * IsBody() returns true if aNode is an html body node.
  */
 bool
-TextEditUtils::IsBody(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::body);
-}
-
-bool
 TextEditUtils::IsBody(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::body);
 }
 
 /**
  * IsBreak() returns true if aNode is an html break node.
  */
 bool
-TextEditUtils::IsBreak(nsIDOMNode* aNode)
-{
-  return EditorBase::NodeIsType(aNode, nsGkAtoms::br);
-}
-
-bool
 TextEditUtils::IsBreak(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::br);
 }
 
 
 /**
  * IsMozBR() returns true if aNode is an html br node with |type = _moz|.
  */
 bool
-TextEditUtils::IsMozBR(nsIDOMNode* aNode)
-{
-  MOZ_ASSERT(aNode);
-  return IsBreak(aNode) && HasMozAttr(aNode);
-}
-
-bool
 TextEditUtils::IsMozBR(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
   return aNode->IsHTMLElement(nsGkAtoms::br) &&
          aNode->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                          NS_LITERAL_STRING("_moz"),
                                          eIgnoreCase);
 }
 
 /**
  * HasMozAttr() returns true if aNode has type attribute and its value is
  * |_moz|. (Used to indicate div's and br's we use in mail compose rules)
  */
 bool
-TextEditUtils::HasMozAttr(nsIDOMNode* aNode)
+TextEditUtils::HasMozAttr(nsINode* aNode)
 {
   MOZ_ASSERT(aNode);
-  nsCOMPtr<Element> element = do_QueryInterface(aNode);
-  if (!element) {
-    return false;
-  }
-  return element->AttrValueIs(kNameSpaceID_None,
-                              nsGkAtoms::type,
-                              NS_LITERAL_STRING("_moz"),
-                              eIgnoreCase);
+  return aNode->IsElement() &&
+         aNode->AsElement()->AttrValueIs(kNameSpaceID_None,
+                                         nsGkAtoms::type,
+                                         NS_LITERAL_STRING("_moz"),
+                                         eIgnoreCase);
 }
 
 /******************************************************************************
  * AutoEditInitRulesTrigger
  ******************************************************************************/
 
 AutoEditInitRulesTrigger::AutoEditInitRulesTrigger(TextEditor* aTextEditor,
                                                    nsresult& aResult)
--- a/editor/libeditor/TextEditUtils.h
+++ b/editor/libeditor/TextEditUtils.h
@@ -3,34 +3,30 @@
  * 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 TextEditUtils_h
 #define TextEditUtils_h
 
 #include "nscore.h"
 
-class nsIDOMNode;
 class nsINode;
 
 namespace mozilla {
 
 class TextEditor;
 
 class TextEditUtils final
 {
 public:
   // from TextEditRules:
-  static bool IsBody(nsIDOMNode* aNode);
   static bool IsBody(nsINode* aNode);
-  static bool IsBreak(nsIDOMNode* aNode);
   static bool IsBreak(nsINode* aNode);
-  static bool IsMozBR(nsIDOMNode* aNode);
   static bool IsMozBR(nsINode* aNode);
-  static bool HasMozAttr(nsIDOMNode* aNode);
+  static bool HasMozAttr(nsINode* aNode);
 };
 
 /***************************************************************************
  * stack based helper class for detecting end of editor initialization, in
  * order to trigger "end of init" initialization of the edit rules.
  */
 class AutoEditInitRulesTrigger final
 {
--- a/editor/libeditor/TextEditor.h
+++ b/editor/libeditor/TextEditor.h
@@ -13,17 +13,16 @@
 #include "nsIEditorMailSupport.h"
 #include "nsIPlaintextEditor.h"
 #include "nsISupportsImpl.h"
 #include "nscore.h"
 
 class nsIContent;
 class nsIDOMDocument;
 class nsIDOMEvent;
-class nsIDOMNode;
 class nsIDocumentEncoder;
 class nsIOutputStream;
 class nsISelectionController;
 class nsITransferable;
 
 namespace mozilla {
 
 class AutoEditInitRulesTrigger;
@@ -139,24 +138,24 @@ public:
                      WidgetCompositionEvent* aCompositionChangeEvet) override;
 
   virtual already_AddRefed<nsIContent> GetInputEventTargetContent() override;
 
   // Utility Routines, not part of public API
   NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
 
   nsresult InsertTextAt(const nsAString& aStringToInsert,
-                        nsIDOMNode* aDestinationNode,
+                        nsINode* aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
   virtual nsresult InsertFromDataTransfer(dom::DataTransfer* aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument* aSourceDoc,
-                                          nsIDOMNode* aDestinationNode,
+                                          nsINode* aDestinationNode,
                                           int32_t aDestOffset,
                                           bool aDoDeleteSelection) override;
 
   virtual nsresult InsertFromDrop(dom::DragEvent* aDropEvent) override;
 
   /**
    * Extends the selection for given deletion operation
    * If done, also update aAction to what's actually left to do after the
@@ -243,20 +242,17 @@ protected:
                const EditorDOMPointBase<PT, CT>& aPointToInsert,
                EDirection aSelect);
 
   /**
    * Factored methods for handling insertion of data from transferables
    * (drag&drop or clipboard).
    */
   NS_IMETHOD PrepareTransferable(nsITransferable** transferable);
-  nsresult InsertTextFromTransferable(nsITransferable* transferable,
-                                      nsIDOMNode* aDestinationNode,
-                                      int32_t aDestOffset,
-                                      bool aDoDeleteSelection);
+  nsresult InsertTextFromTransferable(nsITransferable* transferable);
 
   /**
    * Shared outputstring; returns whether selection is collapsed and resulting
    * string.
    */
   nsresult SharedOutputString(uint32_t aFlags, bool* aIsCollapsed,
                               nsAString& aResult);
 
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -17,17 +17,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMEvent.h"
-#include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIDragService.h"
 #include "nsIDragSession.h"
 #include "nsIEditor.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIPrincipal.h"
 #include "nsIFormControl.h"
@@ -65,25 +64,25 @@ TextEditor::PrepareTransferable(nsITrans
     (*transferable)->AddDataFlavor(kUnicodeMime);
     (*transferable)->AddDataFlavor(kMozTextInternal);
   };
   return NS_OK;
 }
 
 nsresult
 TextEditor::InsertTextAt(const nsAString& aStringToInsert,
-                         nsIDOMNode* aDestinationNode,
+                         nsINode* aDestinationNode,
                          int32_t aDestOffset,
                          bool aDoDeleteSelection)
 {
   if (aDestinationNode) {
     RefPtr<Selection> selection = GetSelection();
     NS_ENSURE_STATE(selection);
 
-    nsCOMPtr<nsIDOMNode> targetNode = aDestinationNode;
+    nsCOMPtr<nsINode> targetNode = aDestinationNode;
     int32_t targetOffset = aDestOffset;
 
     if (aDoDeleteSelection) {
       // Use an auto tracker so that our drop point is correctly
       // positioned after the delete.
       AutoTrackDOMPoint tracker(mRangeUpdater, &targetNode, &targetOffset);
       nsresult rv = DeleteSelection(eNone, eStrip);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -92,20 +91,17 @@ TextEditor::InsertTextAt(const nsAString
     nsresult rv = selection->Collapse(targetNode, targetOffset);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return InsertText(aStringToInsert);
 }
 
 nsresult
-TextEditor::InsertTextFromTransferable(nsITransferable* aTransferable,
-                                       nsIDOMNode* aDestinationNode,
-                                       int32_t aDestOffset,
-                                       bool aDoDeleteSelection)
+TextEditor::InsertTextFromTransferable(nsITransferable* aTransferable)
 {
   nsresult rv = NS_OK;
   nsAutoCString bestFlavor;
   nsCOMPtr<nsISupports> genericDataObj;
   uint32_t len = 0;
   if (NS_SUCCEEDED(
         aTransferable->GetAnyTransferData(bestFlavor,
                                           getter_AddRefs(genericDataObj),
@@ -118,34 +114,34 @@ TextEditor::InsertTextFromTransferable(n
       nsAutoString stuffToPaste;
       textDataObj->GetData(stuffToPaste);
       NS_ASSERTION(stuffToPaste.Length() <= (len/2), "Invalid length!");
 
       // Sanitize possible carriage returns in the string to be inserted
       nsContentUtils::PlatformToDOMLineBreaks(stuffToPaste);
 
       AutoPlaceholderBatch beginBatching(this);
-      rv = InsertTextAt(stuffToPaste, aDestinationNode, aDestOffset, aDoDeleteSelection);
+      rv = InsertTextAt(stuffToPaste, nullptr, 0, true);
     }
   }
 
   // Try to scroll the selection into view if the paste/drop succeeded
 
   if (NS_SUCCEEDED(rv)) {
     ScrollSelectionIntoView(false);
   }
 
   return rv;
 }
 
 nsresult
 TextEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
                                    int32_t aIndex,
                                    nsIDOMDocument* aSourceDoc,
-                                   nsIDOMNode* aDestinationNode,
+                                   nsINode* aDestinationNode,
                                    int32_t aDestOffset,
                                    bool aDoDeleteSelection)
 {
   nsCOMPtr<nsIVariant> data;
   aDataTransfer->GetDataAtNoSecurityCheck(NS_LITERAL_STRING("text/plain"), aIndex,
                                           getter_AddRefs(data));
   if (data) {
     nsAutoString insertText;
@@ -275,17 +271,17 @@ TextEditor::InsertFromDrop(DragEvent* aD
         return NS_OK;
       }
       content = content->GetParent();
     }
   }
 
   for (uint32_t i = 0; i < numItems; ++i) {
     InsertFromDataTransfer(dataTransfer, i, srcdomdoc,
-                           newSelectionParent->AsDOMNode(),
+                           newSelectionParent,
                            newSelectionOffset, deleteSelection);
   }
 
   ScrollSelectionIntoView(false);
 
   return NS_OK;
 }
 
@@ -311,17 +307,17 @@ TextEditor::Paste(int32_t aSelectionType
     if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) &&
         IsModifiable()) {
       // handle transferable hooks
       nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
       if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, trans)) {
         return NS_OK;
       }
 
-      rv = InsertTextFromTransferable(trans, nullptr, 0, true);
+      rv = InsertTextFromTransferable(trans);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 TextEditor::PasteTransferable(nsITransferable* aTransferable)
@@ -337,17 +333,17 @@ TextEditor::PasteTransferable(nsITransfe
   }
 
   // handle transferable hooks
   nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
   if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, aTransferable)) {
     return NS_OK;
   }
 
-  return InsertTextFromTransferable(aTransferable, nullptr, 0, true);
+  return InsertTextFromTransferable(aTransferable);
 }
 
 NS_IMETHODIMP
 TextEditor::CanPaste(int32_t aSelectionType,
                      bool* aCanPaste)
 {
   NS_ENSURE_ARG_POINTER(aCanPaste);
   *aCanPaste = false;
--- a/editor/libeditor/TextEditorTest.cpp
+++ b/editor/libeditor/TextEditorTest.cpp
@@ -9,18 +9,16 @@
 
 #include <stdio.h>
 
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMNode.h"
-#include "nsIDOMNodeList.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsINodeList.h"
 #include "nsIPlaintextEditor.h"
 #include "nsISelection.h"
 #include "nsLiteralString.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"