Bug 1463981 part 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 24 May 2018 13:18:34 -0400
changeset 476440 96a208d3cceee2f0f0b7aac7fac3278d5a897330
parent 476439 166058ce19a33d1e989cadca8ae1db13383e3f94
child 476441 7c12d4b98d22680629d0d1c71a14847d4b0d70e6
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [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 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki
editor/libeditor/EditorBase.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/HTMLURIRefObject.cpp
editor/libeditor/HTMLURIRefObject.h
editor/libeditor/TextEditor.cpp
editor/nsIEditActionListener.idl
editor/nsIEditorMailSupport.idl
editor/nsIHTMLEditor.idl
editor/nsITableEditor.idl
editor/nsIURIRefObject.idl
editor/spellchecker/TextServicesDocument.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -1391,17 +1391,17 @@ EditorBase::CreateNodeWithTransaction(
       NS_WARNING("Selection has gone");
     }
   }
 
   if (!mActionListeners.IsEmpty()) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
       listener->DidCreateNode(nsDependentAtomString(&aTagName),
-                              GetAsDOMNode(newElement), rv);
+                              newElement, rv);
     }
   }
 
   return newElement.forget();
 }
 
 NS_IMETHODIMP
 EditorBase::InsertNode(nsIDOMNode* aNodeToInsert,
@@ -1450,17 +1450,17 @@ EditorBase::InsertNodeWithTransaction(
     } else {
       NS_WARNING("Selection has gone");
     }
   }
 
   if (!mActionListeners.IsEmpty()) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
-      listener->DidInsertNode(aContentToInsert.AsDOMNode(), rv);
+      listener->DidInsertNode(&aContentToInsert, rv);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 EditorBase::SplitNode(nsIDOMNode* aNode,
@@ -1530,18 +1530,17 @@ EditorBase::SplitNodeWithTransaction(
   if (mInlineSpellChecker) {
     RefPtr<mozInlineSpellChecker> spellChecker = mInlineSpellChecker;
     spellChecker->DidSplitNode(aStartOfRightNode.GetContainer(), newNode);
   }
 
   if (!mActionListeners.IsEmpty()) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
-      listener->DidSplitNode(aStartOfRightNode.GetContainerAsDOMNode(),
-                             GetAsDOMNode(newNode));
+      listener->DidSplitNode(aStartOfRightNode.GetContainer(), newNode);
     }
   }
 
   if (NS_WARN_IF(aError.Failed())) {
     return nullptr;
   }
 
   return newNode.forget();
@@ -1609,18 +1608,17 @@ EditorBase::JoinNodesWithTransaction(nsI
   if (mTextServicesDocument && NS_SUCCEEDED(rv)) {
     RefPtr<TextServicesDocument> textServicesDocument = mTextServicesDocument;
     textServicesDocument->DidJoinNodes(aLeftNode, aRightNode);
   }
 
   if (!mActionListeners.IsEmpty()) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
-      listener->DidJoinNodes(aLeftNode.AsDOMNode(), aRightNode.AsDOMNode(),
-                             parent->AsDOMNode(), rv);
+      listener->DidJoinNodes(&aLeftNode, &aRightNode, parent, rv);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 EditorBase::DeleteNode(nsIDOMNode* aNode)
@@ -1658,17 +1656,17 @@ EditorBase::DeleteNodeWithTransaction(ns
   if (mTextServicesDocument && NS_SUCCEEDED(rv)) {
     RefPtr<TextServicesDocument> textServicesDocument = mTextServicesDocument;
     textServicesDocument->DidDeleteNode(&aNode);
   }
 
   if (!mActionListeners.IsEmpty()) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
-      listener->DidDeleteNode(aNode.AsDOMNode(), rv);
+      listener->DidDeleteNode(&aNode, rv);
     }
   }
 
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
 
 already_AddRefed<Element>
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -849,21 +849,20 @@ HTMLEditor::NodeIsBlockStatic(const nsIN
     return true;
   }
 
   return nsHTMLElement::IsBlock(
     nsHTMLTags::AtomTagToId(aElement->NodeInfo()->NameAtom()));
 }
 
 NS_IMETHODIMP
-HTMLEditor::NodeIsBlock(nsIDOMNode* aNode,
+HTMLEditor::NodeIsBlock(nsINode* aNode,
                         bool* aIsBlock)
 {
-  nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
-  *aIsBlock = IsBlockNode(node);
+  *aIsBlock = IsBlockNode(aNode);
   return NS_OK;
 }
 
 bool
 HTMLEditor::IsBlockNode(nsINode* aNode)
 {
   return aNode && NodeIsBlockStatic(aNode);
 }
@@ -2865,17 +2864,17 @@ HTMLEditor::GetLinkedObjects(nsIArray** 
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIDocument> doc = GetDocument();
     NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
 
     iter->Init(doc->GetRootElement());
 
     // loop through the content iterator for each content node
     while (!iter->IsDone()) {
-      nsCOMPtr<nsIDOMNode> node (do_QueryInterface(iter->GetCurrentNode()));
+      nsCOMPtr<nsINode> node = iter->GetCurrentNode();
       if (node) {
         // Let nsURIRefObject make the hard decisions:
         nsCOMPtr<nsIURIRefObject> refObject;
         rv = NS_NewHTMLURIRefObject(getter_AddRefs(refObject), node);
         if (NS_SUCCEEDED(rv)) {
           nodes->AppendElement(refObject);
         }
       }
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -1029,17 +1029,17 @@ protected: // Shouldn't be used by frien
    * @param aAddCites       Whether to prepend extra ">" to each line
    *                        (usually true, unless those characters
    *                        have already been added.)
    * @return aNodeInserted  The node spanning the insertion, if applicable.
    *                        If aAddCites is false, this will be null.
    */
   nsresult InsertAsPlaintextQuotation(const nsAString& aQuotedText,
                                       bool aAddCites,
-                                      nsIDOMNode** aNodeInserted);
+                                      nsINode** aNodeInserted);
 
   nsresult InsertObject(const nsACString& aType, nsISupports* aObject,
                         bool aIsSafe,
                         nsIDocument* aSourceDoc,
                         nsINode* aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -172,23 +172,22 @@ HTMLEditor::InsertHTML(const nsAString& 
 }
 
 NS_IMETHODIMP
 HTMLEditor::InsertHTMLWithContext(const nsAString& aInputString,
                                   const nsAString& aContextStr,
                                   const nsAString& aInfoStr,
                                   const nsAString& aFlavor,
                                   nsIDocument* aSourceDoc,
-                                  nsIDOMNode* aDestNode,
+                                  nsINode* aDestNode,
                                   int32_t aDestOffset,
                                   bool aDeleteSelection)
 {
-  nsCOMPtr<nsINode> destNode = do_QueryInterface(aDestNode);
   return DoInsertHTMLWithContext(aInputString, aContextStr, aInfoStr,
-                                 aFlavor, aSourceDoc, destNode, aDestOffset,
+                                 aFlavor, aSourceDoc, aDestNode, aDestOffset,
                                  aDeleteSelection,
                                  /* trusted input */ true,
                                  /* clear style */ false);
 }
 
 nsresult
 HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
                                     const nsAString& aContextStr,
@@ -1736,17 +1735,17 @@ HTMLEditor::InsertTextWithQuotations(con
         // So the next line needs to start at the next character.
         lineStart++;
       }
     }
 
     // If no newline found, lineStart is now strEnd and we can finish up,
     // inserting from curHunk to lineStart then returning.
     const nsAString &curHunk = Substring(hunkStart, lineStart);
-    nsCOMPtr<nsIDOMNode> dummyNode;
+    nsCOMPtr<nsINode> dummyNode;
     if (curHunkIsQuoted) {
       rv = InsertAsPlaintextQuotation(curHunk, false,
                                       getter_AddRefs(dummyNode));
     } else {
       rv = InsertTextAsAction(curHunk);
       NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
         "Failed to insert a line of the quoted text");
     }
@@ -1759,17 +1758,17 @@ HTMLEditor::InsertTextWithQuotations(con
 
   EndTransaction();
 
   return rv;
 }
 
 NS_IMETHODIMP
 HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
-                              nsIDOMNode** aNodeInserted)
+                              nsINode** aNodeInserted)
 {
   if (IsPlaintextEditor()) {
     return InsertAsPlaintextQuotation(aQuotedText, true, aNodeInserted);
   }
 
   nsAutoString citation;
   return InsertAsCitedQuotation(aQuotedText, citation, false,
                                 aNodeInserted);
@@ -1777,17 +1776,17 @@ HTMLEditor::InsertAsQuotation(const nsAS
 
 // Insert plaintext as a quotation, with cite marks (e.g. "> ").
 // This differs from its corresponding method in TextEditor
 // in that here, quoted material is enclosed in a <pre> tag
 // in order to preserve the original line wrapping.
 nsresult
 HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
                                        bool aAddCites,
-                                       nsIDOMNode** aNodeInserted)
+                                       nsINode** aNodeInserted)
 {
   // get selection
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   AutoPlaceholderBatch beginBatching(this);
   AutoRules beginRulesSniffing(this, EditAction::insertQuotation,
                                nsIEditor::eNext);
@@ -1842,17 +1841,17 @@ HTMLEditor::InsertAsPlaintextQuotation(c
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
       "Failed to insert the quoted text as plain text");
   }
   // Note that if !aAddCites, aNodeInserted isn't set.
   // That's okay because the routines that use aAddCites
   // don't need to know the inserted node.
 
   if (aNodeInserted && NS_SUCCEEDED(rv)) {
-    *aNodeInserted = GetAsDOMNode(newNode);
+    *aNodeInserted = newNode;
     NS_IF_ADDREF(*aNodeInserted);
   }
 
   // Set the selection to just after the inserted node:
   if (NS_SUCCEEDED(rv) && newNode) {
     EditorRawDOMPoint afterNewNode(newNode);
     if (afterNewNode.AdvanceOffset()) {
       selection->Collapse(afterNewNode);
@@ -1872,17 +1871,17 @@ HTMLEditor::Rewrap(bool aRespectNewlines
 {
   return TextEditor::Rewrap(aRespectNewlines);
 }
 
 NS_IMETHODIMP
 HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
                                    const nsAString& aCitation,
                                    bool aInsertHTML,
-                                   nsIDOMNode** aNodeInserted)
+                                   nsINode** aNodeInserted)
 {
   // Don't let anyone insert html into a "plaintext" editor:
   if (IsPlaintextEditor()) {
     NS_ASSERTION(!aInsertHTML, "InsertAsCitedQuotation: trying to insert html into plaintext editor");
     return InsertAsPlaintextQuotation(aQuotedText, true, aNodeInserted);
   }
 
   // get selection
@@ -1922,17 +1921,17 @@ HTMLEditor::InsertAsCitedQuotation(const
   if (aInsertHTML) {
     rv = LoadHTML(aQuotedText);
   } else {
     rv = InsertTextAsAction(aQuotedText);  // XXX ignore charset
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to insert the quoted text");
   }
 
   if (aNodeInserted && NS_SUCCEEDED(rv)) {
-    *aNodeInserted = GetAsDOMNode(newNode);
+    *aNodeInserted = newNode;
     NS_IF_ADDREF(*aNodeInserted);
   }
 
   // Set the selection to just after the inserted node:
   if (NS_SUCCEEDED(rv) && newNode) {
     EditorRawDOMPoint afterNewNode(newNode);
     if (afterNewNode.AdvanceOffset()) {
       selection->Collapse(afterNewNode);
--- a/editor/libeditor/HTMLURIRefObject.cpp
+++ b/editor/libeditor/HTMLURIRefObject.cpp
@@ -44,17 +44,17 @@
 #include "mozilla/mozalloc.h"
 #include "mozilla/dom/Attr.h"
 #include "mozilla/dom/Element.h"
 #include "nsAString.h"
 #include "nsDebug.h"
 #include "nsDOMAttributeMap.h"
 #include "nsError.h"
 #include "nsID.h"
-#include "nsIDOMNode.h"
+#include "nsINode.h"
 #include "nsISupportsUtils.h"
 #include "nsString.h"
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 
 // String classes change too often and I can't keep up.
 // Set this macro to this week's approved case-insensitive compare routine.
@@ -81,18 +81,21 @@ HTMLURIRefObject::Reset()
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLURIRefObject::GetNextURI(nsAString& aURI)
 {
   NS_ENSURE_TRUE(mNode, NS_ERROR_NOT_INITIALIZED);
 
-  nsCOMPtr<dom::Element> element = do_QueryInterface(mNode);
-  NS_ENSURE_TRUE(element, NS_ERROR_INVALID_ARG);
+  if (NS_WARN_IF(!mNode->IsElement())) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  RefPtr<dom::Element> element = mNode->AsElement();
 
   // Loop over attribute list:
   if (!mAttrsInited) {
     mAttrsInited = true;
     mAttributeCnt = element->GetAttrCount();
     NS_ENSURE_TRUE(mAttributeCnt, NS_ERROR_FAILURE);
     mCurAttrIndex = 0;
   }
@@ -226,44 +229,43 @@ NS_IMETHODIMP
 HTMLURIRefObject::RewriteAllURIs(const nsAString& aOldPat,
                                  const nsAString& aNewPat,
                                  bool aMakeRel)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-HTMLURIRefObject::GetNode(nsIDOMNode** aNode)
+HTMLURIRefObject::GetNode(nsINode** aNode)
 {
   NS_ENSURE_TRUE(mNode, NS_ERROR_NOT_INITIALIZED);
   NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
-  *aNode = mNode.get();
-  NS_ADDREF(*aNode);
+  *aNode = do_AddRef(mNode).take();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLURIRefObject::SetNode(nsIDOMNode* aNode)
+HTMLURIRefObject::SetNode(nsINode* aNode)
 {
   mNode = aNode;
   nsAutoString dummyURI;
   if (NS_SUCCEEDED(GetNextURI(dummyURI))) {
     mCurAttrIndex = 0;    // Reset so we'll get the first node next time
     return NS_OK;
   }
 
   // If there weren't any URIs in the attributes,
   // then don't accept this node.
   mNode = nullptr;
   return NS_ERROR_INVALID_ARG;
 }
 
 } // namespace mozilla
 
-nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode)
+nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsINode* aNode)
 {
   RefPtr<mozilla::HTMLURIRefObject> refObject = new mozilla::HTMLURIRefObject();
   nsresult rv = refObject->SetNode(aNode);
   if (NS_FAILED(rv)) {
     *aResult = 0;
     return rv;
   }
   refObject.forget(aResult);
--- a/editor/libeditor/HTMLURIRefObject.h
+++ b/editor/libeditor/HTMLURIRefObject.h
@@ -14,36 +14,36 @@
 
 #define NS_URI_REF_OBJECT_CID                          \
 { /* {bdd79df6-1dd1-11b2-b29c-c3d63a58f1d2} */         \
     0xbdd79df6, 0x1dd1, 0x11b2,                        \
     { 0xb2, 0x9c, 0xc3, 0xd6, 0x3a, 0x58, 0xf1, 0xd2 } \
 }
 
 class nsDOMAttributeMap;
-class nsIDOMNode;
+class nsINode;
 
 namespace mozilla {
 
 class HTMLURIRefObject final : public nsIURIRefObject
 {
 public:
   HTMLURIRefObject();
 
   // Interfaces for addref and release and queryinterface
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIURIREFOBJECT
 
 protected:
   virtual ~HTMLURIRefObject();
 
-  nsCOMPtr<nsIDOMNode> mNode;
+  nsCOMPtr<nsINode> mNode;
   uint32_t mCurAttrIndex;
   uint32_t mAttributeCnt;
   bool mAttrsInited;
 };
 
 } // namespace mozilla
 
-nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode);
+nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsINode* aNode);
 
 #endif // #ifndef HTMLURIRefObject_h
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -795,17 +795,17 @@ TextEditor::DeleteSelectionWithTransacti
         listener->DidDeleteSelection(selection);
       }
     } else if (deleteCharData) {
       for (auto& listener : mActionListeners) {
         listener->DidDeleteText(deleteCharData, deleteCharOffset, 1, rv);
       }
     } else {
       for (auto& listener : mActionListeners) {
-        listener->DidDeleteNode(deleteNode->AsDOMNode(), rv);
+        listener->DidDeleteNode(deleteNode, rv);
       }
     }
   }
 
   return rv;
 }
 
 already_AddRefed<Element>
@@ -1819,17 +1819,17 @@ TextEditor::PasteAsQuotation(int32_t aSe
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 TextEditor::InsertAsQuotation(const nsAString& aQuotedText,
-                              nsIDOMNode** aNodeInserted)
+                              nsINode** aNodeInserted)
 {
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
 
   // Let the citer quote it for us:
   nsString quotedStuff;
   nsresult rv = InternetCiter::GetCiteString(aQuotedText, quotedStuff);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1873,17 +1873,17 @@ TextEditor::PasteAsCitedQuotation(const 
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 TextEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
                                    const nsAString& aCitation,
                                    bool aInsertHTML,
-                                   nsIDOMNode** aNodeInserted)
+                                   nsINode** aNodeInserted)
 {
   return InsertAsQuotation(aQuotedText, aNodeInserted);
 }
 
 nsresult
 TextEditor::SharedOutputString(uint32_t aFlags,
                                bool* aIsCollapsed,
                                nsAString& aResult)
--- a/editor/nsIEditActionListener.idl
+++ b/editor/nsIEditActionListener.idl
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 #include "domstubs.idl"
 
 webidl CharacterData;
+webidl Node;
 webidl Selection;
 
 /*
 Editor Action Listener interface to outside world
 */
 
 
 /**
@@ -30,57 +31,57 @@ interface nsIEditActionListener : nsISup
 {
   /**
    * Called after the editor creates a node.
    * @param aTag      The tag name of the DOM Node to create.
    * @param aNewNode  The DOM Node that was created.
    * @param aResult   The result of the create node operation.
    */
   void DidCreateNode(in DOMString aTag,
-                     in nsIDOMNode aNewNode,
+                     in Node aNewNode,
                      in nsresult aResult);
 
   /**
    * Called after the editor inserts a node.
    * @param aNode     The DOM Node to insert.
    * @param aResult   The result of the insert node operation.
    */
-  void DidInsertNode(in nsIDOMNode aNode,
+  void DidInsertNode(in Node aNode,
                      in nsresult aResult);
 
   /**
    * Called after the editor deletes a node.
    * @param aChild    The node to delete
    * @param aResult   The result of the delete node operation.
    */
-  void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult);
+  void DidDeleteNode(in Node aChild, in nsresult aResult);
 
   /**
    * Called after the editor splits a node.
    * @param aExistingRightNode   The node which was split.  It will become the
    *                             next sibling of the new left node.
    * @param aNewLeftNode         The new node resulting from the split, becomes
    *                             the previous sibling of aExistingRightNode.
    */
-  void DidSplitNode(in nsIDOMNode aExistingRightNode,
-                    in nsIDOMNode aNewLeftNode);
+  void DidSplitNode(in Node aExistingRightNode,
+                    in Node aNewLeftNode);
 
   /**
    * Called after the editor joins 2 nodes.
    * @param aLeftNode   This node will be merged into the right node
    * @param aRightNode  The node that will be merged into.
    *                    There is no requirement that the two nodes be of
    *                    the same type.
    * @param aParent     The parent of aRightNode
    * @param aResult     The result of the join operation.
    */
-  void DidJoinNodes(in nsIDOMNode aLeftNode,
-                          in nsIDOMNode aRightNode,
-                          in nsIDOMNode aParent,
-                          in nsresult    aResult);
+  void DidJoinNodes(in Node aLeftNode,
+                    in Node aRightNode,
+                    in Node aParent,
+                    in nsresult aResult);
 
   /**
    * Called after the editor inserts text.
    * @param aTextNode   This node getting inserted text.
    * @param aOffset     The offset in aTextNode to insert at.
    * @param aString     The string that gets inserted.
    * @param aResult     The result of the insert text operation.
    */
--- a/editor/nsIEditorMailSupport.idl
+++ b/editor/nsIEditorMailSupport.idl
@@ -1,17 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIArray;
-interface nsIDOMNode;
+
+webidl Node;
 
 [scriptable, builtinclass, uuid(fdf23301-4a94-11d3-9ce4-9960496c41bc)]
 
 interface nsIEditorMailSupport : nsISupports
 {
   /** Paste the text in the OS clipboard at the cursor position,
     * as a quotation (whose representation is dependant on the editor type),
     * replacing the selected text (if any).
@@ -20,17 +21,17 @@ interface nsIEditorMailSupport : nsISupp
   void pasteAsQuotation(in long aSelectionType);
 
   /** Insert a string as quoted text
     * (whose representation is dependant on the editor type),
     * replacing the selected text (if any).
     * @param aQuotedText  The actual text to be quoted
     * @return             The node which was inserted
     */
-  nsIDOMNode insertAsQuotation(in AString aQuotedText);
+  Node insertAsQuotation(in AString aQuotedText);
 
   /**
    * Inserts a plaintext string at the current location,
    * with special processing for lines beginning with ">",
    * which will be treated as mail quotes and inserted
    * as plaintext quoted blocks.
    * If the selection is not collapsed, the selection is deleted
    * and the insertion takes place at the resulting collapsed selection.
@@ -52,19 +53,19 @@ interface nsIEditorMailSupport : nsISupp
     * (whose representation is dependant on the editor type),
     * replacing the selected text (if any),
     * including, if possible, a "cite" attribute.
     * @param aQuotedText  The actual text to be quoted
     * @param aCitation    The "mid" URL of the source message
     * @param aInsertHTML  Insert as html?  (vs plaintext)
     * @return             The node which was inserted
     */
-  nsIDOMNode insertAsCitedQuotation(in AString aQuotedText,
-                                    in AString aCitation,
-                                    in boolean aInsertHTML);
+  Node insertAsCitedQuotation(in AString aQuotedText,
+                              in AString aCitation,
+                              in boolean aInsertHTML);
 
   /**
    * Rewrap the selected part of the document, re-quoting if necessary.
    * @param aRespectNewlines  Try to maintain newlines in the original?
    */
   void rewrap(in boolean aRespectNewlines);
 
   /**
--- a/editor/nsIHTMLEditor.idl
+++ b/editor/nsIHTMLEditor.idl
@@ -123,17 +123,17 @@ interface nsIHTMLEditor : nsISupports
   /* ------------ HTML content methods -------------- */
 
   /**
    * Tests if a node is a BLOCK element according the the HTML 4.0 DTD.
    *   This does NOT consider CSS effect on display type
    *
    * @param aNode      the node to test
    */
-  boolean nodeIsBlock(in nsIDOMNode node);
+  boolean nodeIsBlock(in Node node);
 
   /**
    * Insert some HTML source at the current location
    *
    * @param aInputString   the string to be inserted
    */
   void insertHTML(in AString aInputString);
 
@@ -166,17 +166,17 @@ interface nsIHTMLEditor : nsISupports
    * @param aDeleteSelection    used with aDestNode during drag&drop
    * @param aCollapseSelection  used with aDestNode during drag&drop
    */
   void insertHTMLWithContext(in AString aInputString,
                              in AString aContextStr,
                              in AString aInfoStr,
                              in AString aFlavor,
                              in Document aSourceDoc,
-                             in nsIDOMNode aDestinationNode,
+                             in Node aDestinationNode,
                              in long aDestinationOffset,
                              in boolean aDeleteSelection);
 
 
   /**
     * Insert an element, which may have child nodes, at the selection
     * Used primarily to insert a new element for various insert element dialogs,
     *   but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
--- a/editor/nsITableEditor.idl
+++ b/editor/nsITableEditor.idl
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "nsISupports.idl"
 
-interface nsIDOMNode;
-
 webidl Element;
 webidl Node;
 webidl Range;
 
 [scriptable, builtinclass, uuid(4805e684-49b9-11d3-9ce4-ed60bd6cb5bc)]
 interface nsITableEditor : nsISupports
 {
   const short eNoSearch = 0;
--- a/editor/nsIURIRefObject.idl
+++ b/editor/nsIURIRefObject.idl
@@ -1,30 +1,30 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 #include "domstubs.idl"
 
-interface nsIDOMNode;
+webidl Node;
 
 /** A class which can represent any node which points to an
   * external URI, e.g. <a>, <img>, <script> etc,
   * and has the capability to rewrite URLs to be
   * relative or absolute.
   * Used by the editor but not dependant on it.
   */
 
 [scriptable, uuid(2226927e-1dd2-11b2-b57f-faab47288563)]
 
 interface nsIURIRefObject  : nsISupports
 {
-  attribute nsIDOMNode node;
+  attribute Node node;
 
   /**
    * Go back to the beginning of the attribute list.
    */
   void Reset();
 
   /**
    * Return the next rewritable URI.
--- a/editor/spellchecker/TextServicesDocument.cpp
+++ b/editor/spellchecker/TextServicesDocument.cpp
@@ -3152,62 +3152,59 @@ TextServicesDocument::FindWordBounds(nsT
  * nsIEditActionListener implementation:
  *   Don't implement the behavior directly here.  The methods won't be called
  *   if the instance is created for inline spell checker created for editor.
  *   If you need to listen a new edit action, you need to add similar
  *   non-virtual method and you need to call it from EditorBase directly.
  */
 
 NS_IMETHODIMP
-TextServicesDocument::DidInsertNode(nsIDOMNode* aNode,
+TextServicesDocument::DidInsertNode(nsINode* aNode,
                                     nsresult aResult)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextServicesDocument::DidDeleteNode(nsIDOMNode* aChild,
+TextServicesDocument::DidDeleteNode(nsINode* aChild,
                                     nsresult aResult)
 {
   if (NS_WARN_IF(NS_FAILED(aResult))) {
     return NS_OK;
   }
-  nsCOMPtr<nsINode> child = do_QueryInterface(aChild);
-  DidDeleteNode(child);
+  DidDeleteNode(aChild);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextServicesDocument::DidSplitNode(nsIDOMNode* aExistingRightNode,
-                                   nsIDOMNode* aNewLeftNode)
+TextServicesDocument::DidSplitNode(nsINode* aExistingRightNode,
+                                   nsINode* aNewLeftNode)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextServicesDocument::DidJoinNodes(nsIDOMNode* aLeftNode,
-                                   nsIDOMNode* aRightNode,
-                                   nsIDOMNode* aParent,
+TextServicesDocument::DidJoinNodes(nsINode* aLeftNode,
+                                   nsINode* aRightNode,
+                                   nsINode* aParent,
                                    nsresult aResult)
 {
   if (NS_WARN_IF(NS_FAILED(aResult))) {
     return NS_OK;
   }
-  nsCOMPtr<nsINode> leftNode = do_QueryInterface(aLeftNode);
-  nsCOMPtr<nsINode> rightNode = do_QueryInterface(aRightNode);
-  if (NS_WARN_IF(!leftNode) || NS_WARN_IF(!rightNode)) {
+  if (NS_WARN_IF(!aLeftNode) || NS_WARN_IF(!aRightNode)) {
     return NS_OK;
   }
-  DidJoinNodes(*leftNode, *rightNode);
+  DidJoinNodes(*aLeftNode, *aRightNode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TextServicesDocument::DidCreateNode(const nsAString& aTag,
-                                    nsIDOMNode* aNewNode,
+                                    nsINode* aNewNode,
                                     nsresult aResult)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TextServicesDocument::DidInsertText(CharacterData* aTextNode,
                                     int32_t aOffset,