Bug 1432186 part 13. Remove nsIDOMNode's nextSibling attribute. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 29 Jan 2018 23:10:51 -0500
changeset 748722 47364ad7bf3fc394f89c2bebc23a15eb7ee9666c
parent 748721 9badfca43f1c215f4ac611bcb6cb4b87038c5f4e
child 748723 22cb7cdac946fe14fec79907ea6eef170c922d37
push id97228
push usersfraser@mozilla.com
push dateTue, 30 Jan 2018 10:21:04 +0000
reviewersmccr8
bugs1432186
milestone60.0a1
Bug 1432186 part 13. Remove nsIDOMNode's nextSibling attribute. r=mccr8 MozReview-Commit-ID: DTaivhMORXr
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/interfaces/core/nsIDOMNode.idl
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -528,26 +528,16 @@ nsresult
 nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes)
 {
   NS_ADDREF(*aChildNodes = ChildNodes());
 
   return NS_OK;
 }
 
 nsresult
-nsINode::GetNextSibling(nsIDOMNode** aNextSibling)
-{
-  *aNextSibling = nullptr;
-
-  nsIContent *sibling = GetNextSibling();
-
-  return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
-}
-
-nsresult
 nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
 {
   *aOwnerDocument = nullptr;
 
   nsIDocument *ownerDoc = GetOwnerDocument();
 
   return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK;
 }
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -2073,17 +2073,16 @@ protected:
   // module boundaries.
   virtual void CheckNotNativeAnonymous() const;
 #endif
 
   // These are just used to implement nsIDOMNode using
   // NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER and for quickstubs.
   nsresult GetParentNode(nsIDOMNode** aParentNode);
   nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
-  nsresult GetNextSibling(nsIDOMNode** aNextSibling);
   nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
 
   void EnsurePreInsertionValidity1(nsINode& aNewChild, nsINode* aRefChild,
                                    mozilla::ErrorResult& aError);
   void EnsurePreInsertionValidity2(bool aReplace, nsINode& aNewChild,
                                    nsINode* aRefChild,
                                    mozilla::ErrorResult& aError);
   nsINode* ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
@@ -2269,20 +2268,16 @@ ToCanonicalSupports(nsINode* aPointer)
   NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) __VA_ARGS__ override \
   { \
     return nsINode::GetParentNode(aParentNode); \
   } \
   NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) __VA_ARGS__ override \
   { \
     return nsINode::GetChildNodes(aChildNodes); \
   } \
-  NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) __VA_ARGS__ override \
-  { \
-    return nsINode::GetNextSibling(aNextSibling); \
-  } \
   NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) __VA_ARGS__ override \
   { \
     return nsINode::GetOwnerDocument(aOwnerDocument); \
   } \
   NS_IMETHOD HasChildNodes(bool* aResult) __VA_ARGS__ override \
   { \
     *aResult = nsINode::HasChildNodes(); \
     return NS_OK; \
--- a/dom/interfaces/core/nsIDOMNode.idl
+++ b/dom/interfaces/core/nsIDOMNode.idl
@@ -29,13 +29,12 @@ interface nsIDOMNode : nsISupports
   const unsigned short      COMMENT_NODE       = 8;
   const unsigned short      DOCUMENT_NODE      = 9;
   const unsigned short      DOCUMENT_TYPE_NODE = 10;
   const unsigned short      DOCUMENT_FRAGMENT_NODE = 11;
   const unsigned short      NOTATION_NODE      = 12;
 
   readonly attribute nsIDOMNode       parentNode;
   readonly attribute nsIDOMNodeList   childNodes;
-  readonly attribute nsIDOMNode       nextSibling;
   // Modified in DOM Level 2:
   readonly attribute nsIDOMDocument   ownerDocument;
   boolean                   hasChildNodes();
 };
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -5423,60 +5423,16 @@ EditorBase::SwitchTextDirectionTo(uint32
     rv = rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("rtl"), true);
   }
 
   if (NS_SUCCEEDED(rv)) {
     FireInputEvent();
   }
 }
 
-#if DEBUG_JOE
-void
-EditorBase::DumpNode(nsIDOMNode* aNode,
-                     int32_t indent)
-{
-  for (int32_t i = 0; i < indent; i++) {
-    printf("  ");
-  }
-
-  nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
-  nsCOMPtr<nsIDOMDocumentFragment> docfrag = do_QueryInterface(aNode);
-
-  if (element || docfrag) {
-    if (element) {
-      nsAutoString tag;
-      element->GetTagName(tag);
-      printf("<%s>\n", NS_LossyConvertUTF16toASCII(tag).get());
-    } else {
-      printf("<document fragment>\n");
-    }
-    nsCOMPtr<nsIDOMNodeList> childList;
-    aNode->GetChildNodes(getter_AddRefs(childList));
-    NS_ENSURE_TRUE(childList, NS_ERROR_NULL_POINTER);
-    uint32_t numChildren;
-    childList->GetLength(&numChildren);
-    nsCOMPtr<nsIDOMNode> child, tmp;
-    aNode->GetFirstChild(getter_AddRefs(child));
-    for (uint32_t i = 0; i < numChildren; i++) {
-      DumpNode(child, indent + 1);
-      child->GetNextSibling(getter_AddRefs(tmp));
-      child = tmp;
-    }
-  } else if (IsTextNode(aNode)) {
-    nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(aNode);
-    nsAutoString str;
-    textNode->GetData(str);
-    nsAutoCString cstr;
-    LossyCopyUTF16toASCII(str, cstr);
-    cstr.ReplaceChar('\n', ' ');
-    printf("<textnode> %s\n", cstr.get());
-  }
-}
-#endif
-
 bool
 EditorBase::IsModifiableNode(nsIDOMNode* aNode)
 {
   return true;
 }
 
 bool
 EditorBase::IsModifiableNode(nsINode* aNode)
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1037,19 +1037,16 @@ public:
   static nsresult GetEndNodeAndOffset(Selection* aSelection,
                                       nsINode** aEndContainer,
                                       int32_t* aEndOffset);
   static EditorRawDOMPoint GetEndPoint(Selection* aSelection);
 
   static nsresult GetEndChildNode(Selection* aSelection,
                                   nsIContent** aEndNode);
 
-#if DEBUG_JOE
-  static void DumpNode(nsIDOMNode* aNode, int32_t indent = 0);
-#endif
   Selection* GetSelection(SelectionType aSelectionType =
                                           SelectionType::eNormal)
   {
     nsISelectionController* sc = GetSelectionController();
     if (!sc) {
       return nullptr;
     }
     Selection* selection = sc->GetDOMSelection(ToRawSelectionType(aSelectionType));