diff --git a/accessible/src/base/Logging.cpp b/accessible/src/base/Logging.cpp index f0b73922b0c..b7da3754d55 100644 --- a/accessible/src/base/Logging.cpp +++ b/accessible/src/base/Logging.cpp @@ -684,7 +684,7 @@ logging::Node(const char* aDescr, nsINode* aNode) return; } - nsINode* parentNode = aNode->GetNodeParent(); + nsINode* parentNode = aNode->GetParentNode(); int32_t idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1; if (aNode->IsNodeOfType(nsINode::eTEXT)) { diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index 7127ae44eda..97cf3677f3b 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -424,8 +424,8 @@ NotificationController::CoalesceEvents() // Coalesce events by sibling targets (this is a case for reorder // events). - if (thisEvent->mNode->GetNodeParent() == - tailEvent->mNode->GetNodeParent()) { + if (thisEvent->mNode->GetParentNode() == + tailEvent->mNode->GetParentNode()) { tailEvent->mEventRule = thisEvent->mEventRule; return; } @@ -521,7 +521,7 @@ NotificationController::ApplyToSiblings(uint32_t aStart, uint32_t aEnd, AccEvent* accEvent = mEvents[index]; if (accEvent->mEventType == aEventType && accEvent->mEventRule != AccEvent::eDoNotEmit && accEvent->mNode && - accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) { + accEvent->mNode->GetParentNode() == aNode->GetParentNode()) { accEvent->mEventRule = aEventRule; } } @@ -705,7 +705,7 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey* aEntry, // If the text node is not in tree or doesn't have frame then this case should // have been handled already by content removal notifications. - nsINode* containerNode = textNode->GetNodeParent(); + nsINode* containerNode = textNode->GetParentNode(); if (!containerNode) { NS_ASSERTION(!textAcc, "Text node was removed but accessible is kept alive!"); diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 7102f995187..c1e9b04d307 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -248,7 +248,7 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode, NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, false); nsINode *parentNode = aPossibleDescendantNode; - while ((parentNode = parentNode->GetNodeParent()) && + while ((parentNode = parentNode->GetParentNode()) && parentNode != aRootNode) { if (parentNode == aPossibleAncestorNode) return true; diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index dabf561b375..a7c904bb948 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -1394,7 +1394,7 @@ DocAccessible::GetAccessibleOrContainer(nsINode* aNode) nsINode* currNode = aNode; Accessible* accessible = nullptr; while (!(accessible = GetAccessible(currNode)) && - (currNode = currNode->GetNodeParent())); + (currNode = currNode->GetParentNode())); return accessible; } diff --git a/accessible/src/generic/DocAccessible.h b/accessible/src/generic/DocAccessible.h index 155b8c6166f..33dff997e03 100644 --- a/accessible/src/generic/DocAccessible.h +++ b/accessible/src/generic/DocAccessible.h @@ -269,7 +269,7 @@ public: */ Accessible* GetContainerAccessible(nsINode* aNode) { - return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nullptr; + return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr; } /** diff --git a/accessible/src/mac/mozHTMLAccessible.mm b/accessible/src/mac/mozHTMLAccessible.mm index c642329600d..f9b88fbcf36 100644 --- a/accessible/src/mac/mozHTMLAccessible.mm +++ b/accessible/src/mac/mozHTMLAccessible.mm @@ -18,8 +18,7 @@ nsAutoString title; // XXX use the flattening API when there are available // see bug 768298 - nsresult rv = mGeckoAccessible->GetContent()->GetTextContent(title); - NS_ENSURE_SUCCESS(rv, nil); + mGeckoAccessible->GetContent()->GetTextContent(title); return nsCocoaUtils::ToNSString(title); } diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 09cee3663da..b8f07e9cf2c 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -409,7 +409,7 @@ __try { if (!node) return E_FAIL; - *aNode = MakeAccessNode(node->GetNodeParent()); + *aNode = MakeAccessNode(node->GetParentNode()); } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } diff --git a/accessible/src/xforms/nsXFormsAccessible.cpp b/accessible/src/xforms/nsXFormsAccessible.cpp index 7981dc22c22..e1b3c739d60 100644 --- a/accessible/src/xforms/nsXFormsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsAccessible.cpp @@ -60,8 +60,7 @@ nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName, if (IsDefunct()) return NS_ERROR_FAILURE; - nsINodeList* nodes = mContent->GetChildNodesList(); - NS_ENSURE_STATE(nodes); + nsINodeList* nodes = mContent->ChildNodes(); uint32_t length; nsresult rv = nodes->GetLength(&length); @@ -545,7 +544,7 @@ nsXFormsSelectableItemAccessible::IsSelected() nsresult rv; nsINode* parent = mContent; - while ((parent = parent->GetNodeParent())) { + while ((parent = parent->GetParentNode())) { nsCOMPtr content(do_QueryInterface(parent)); if (!content) return false; diff --git a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp index b6e724a9197..143df7a4ba1 100644 --- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp @@ -156,7 +156,7 @@ nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue) void nsXFormsComboboxPopupWidgetAccessible::CacheChildren() { - nsCOMPtr parent = do_QueryInterface(mContent->GetNodeParent()); + nsCOMPtr parent = do_QueryInterface(mContent->GetParentNode()); // Parent node must be an xforms:select1 element. CacheSelectChildren(parent); } diff --git a/content/base/public/Element.h b/content/base/public/Element.h index d31076f883e..dcaafa17825 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -348,4 +348,9 @@ inline const mozilla::dom::Element* nsINode::AsElement() const return static_cast(this); } +inline bool nsINode::HasAttributes() const +{ + return IsElement() && AsElement()->GetAttrCount() > 0; +} + #endif // mozilla_dom_Element_h__ diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 13264c9aa3c..f29391c7c26 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -191,8 +191,9 @@ public: virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify); virtual void RemoveChildAt(uint32_t aIndex, bool aNotify); - NS_IMETHOD GetTextContent(nsAString &aTextContent); - NS_IMETHOD SetTextContent(const nsAString& aTextContent); + virtual void GetTextContentInternal(nsAString& aTextContent); + virtual void SetTextContentInternal(const nsAString& aTextContent, + mozilla::ErrorResult& aError); // nsIContent interface methods virtual already_AddRefed GetChildren(uint32_t aFilter); @@ -219,49 +220,6 @@ public: NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); public: - // nsIDOMNode method implementation - NS_IMETHOD GetNodeName(nsAString& aNodeName); - NS_IMETHOD GetLocalName(nsAString& aLocalName); - NS_IMETHOD GetNodeValue(nsAString& aNodeValue); - NS_IMETHOD SetNodeValue(const nsAString& aNodeValue); - NS_IMETHOD GetNodeType(uint16_t* aNodeType); - NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes); - NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI); - NS_IMETHOD GetPrefix(nsAString& aPrefix); - NS_IMETHOD IsSupported(const nsAString& aFeature, - const nsAString& aVersion, bool* aReturn); - NS_IMETHOD HasAttributes(bool* aHasAttributes); - NS_IMETHOD HasChildNodes(bool* aHasChildNodes); - nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, - nsIDOMNode** aReturn) - { - return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn); - } - nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, - nsIDOMNode** aReturn) - { - return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn); - } - nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) - { - return nsINode::RemoveChild(aOldChild, aReturn); - } - nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) - { - return InsertBefore(aNewChild, nullptr, aReturn); - } - - nsresult CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode **aResult) - { - if (!aOptionalArgc) { - aDeep = true; - } - - return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult); - } - - //---------------------------------------- - /** * If there are listeners for DOMNodeInserted event, fires the event on all * aNodes diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index f4365dd90bf..5a83d422169 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -282,10 +282,9 @@ public: * Returns true if aNode1 is before aNode2 in the same connected * tree. */ - static bool PositionIsBefore(nsINode* aNode1, - nsINode* aNode2) + static bool PositionIsBefore(nsINode* aNode1, nsINode* aNode2) { - return (aNode2->CompareDocPosition(aNode1) & + return (aNode2->CompareDocumentPosition(*aNode1) & (nsIDOMNode::DOCUMENT_POSITION_PRECEDING | nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED)) == nsIDOMNode::DOCUMENT_POSITION_PRECEDING; diff --git a/content/base/public/nsDeprecatedOperationList.h b/content/base/public/nsDeprecatedOperationList.h index 0e9e564f0ac..af6a98d5984 100644 --- a/content/base/public/nsDeprecatedOperationList.h +++ b/content/base/public/nsDeprecatedOperationList.h @@ -16,27 +16,7 @@ DEPRECATED_OPERATION(CreateAttribute) DEPRECATED_OPERATION(CreateAttributeNS) DEPRECATED_OPERATION(Specified) DEPRECATED_OPERATION(OwnerElement) -DEPRECATED_OPERATION(NodeName) DEPRECATED_OPERATION(NodeValue) -DEPRECATED_OPERATION(NodeType) -DEPRECATED_OPERATION(ParentNode) -DEPRECATED_OPERATION(ChildNodes) -DEPRECATED_OPERATION(HasChildNodes) -DEPRECATED_OPERATION(HasAttributes) -DEPRECATED_OPERATION(FirstChild) -DEPRECATED_OPERATION(LastChild) -DEPRECATED_OPERATION(PreviousSibling) -DEPRECATED_OPERATION(NextSibling) -DEPRECATED_OPERATION(Attributes) -DEPRECATED_OPERATION(InsertBefore) -DEPRECATED_OPERATION(ReplaceChild) -DEPRECATED_OPERATION(RemoveChild) -DEPRECATED_OPERATION(AppendChild) -DEPRECATED_OPERATION(CloneNode) -DEPRECATED_OPERATION(OwnerDocument) -DEPRECATED_OPERATION(Normalize) -DEPRECATED_OPERATION(IsSupported) -DEPRECATED_OPERATION(IsEqualNode) DEPRECATED_OPERATION(TextContent) DEPRECATED_OPERATION(EnablePrivilege) DEPRECATED_OPERATION(Position) diff --git a/content/base/public/nsIAttribute.h b/content/base/public/nsIAttribute.h index d508d47249d..b599fb0e91d 100644 --- a/content/base/public/nsIAttribute.h +++ b/content/base/public/nsIAttribute.h @@ -27,7 +27,7 @@ public: return mAttrMap; } - nsINodeInfo *NodeInfo() + nsINodeInfo *NodeInfo() const { return mNodeInfo; } diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index cac86556e7c..475936397ed 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -1721,6 +1721,11 @@ public: } } + bool CreatingStaticClone() const + { + return mCreatingStaticClone; + } + private: uint64_t mWarnedAbout; diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 5e8f41f3b54..57c7b48e0db 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -6,9 +6,11 @@ #ifndef nsINode_h___ #define nsINode_h___ +#include "mozilla/ErrorResult.h" #include "nsCOMPtr.h" // for member, local #include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty #include "nsIDOMEventTarget.h" // for base class +#include "nsIDOMNode.h" #include "nsIDOMNodeSelector.h" // base class #include "nsINodeInfo.h" // member (in nsCOMPtr) #include "nsIVariant.h" // for use in GetUserData() @@ -27,10 +29,10 @@ class nsAttrAndChildArray; class nsChildContentList; +class nsDOMAttributeMap; class nsIContent; class nsIDocument; class nsIDOMElement; -class nsIDOMNode; class nsIDOMNodeList; class nsIDOMUserDataHandler; class nsIEditor; @@ -43,10 +45,12 @@ class nsIURI; class nsNodeSupportsWeakRefTearoff; class nsNodeWeakReference; class nsXPCClassInfo; +class nsGenericElement; namespace mozilla { namespace dom { class Element; +template class Optional; } // namespace dom } // namespace mozilla @@ -243,8 +247,8 @@ private: // IID for the nsINode interface #define NS_INODE_IID \ -{ 0x9aede57e, 0xe39e, 0x42e8, \ - { 0x8d, 0x33, 0x7a, 0xc3, 0xd0, 0xbb, 0x5b, 0xf9 } } +{ 0xb3ee8053, 0x43b0, 0x44bc, \ + { 0xa0, 0x97, 0x18, 0x24, 0xd2, 0xac, 0x65, 0xb6 } } /** * An internal interface that abstracts some DOMNode-related parts that both @@ -361,6 +365,34 @@ public: */ virtual bool IsNodeOfType(uint32_t aFlags) const = 0; + virtual JSObject* WrapObject(JSContext *aCx, JSObject *aScope, + bool *aTriedToWrap); + +protected: + /** + * WrapNode is called from WrapObject to actually wrap this node, WrapObject + * does some additional checks and fix-up that's common to all nodes. WrapNode + * should just call the DOM binding's Wrap function. + */ + virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, + bool *aTriedToWrap) + { + *aTriedToWrap = false; + return nullptr; + } + +public: + nsIDocument* GetParentObject() const + { + // Make sure that we get the owner document of the content node, in case + // we're in document teardown. If we are, it's important to *not* use + // globalObj as the node's parent since that would give the node the + // principal of globalObj (i.e. the principal of the document that's being + // loaded) and not the principal of the document that's being unloaded. + // See http://bugzilla.mozilla.org/show_bug.cgi?id=227417 + return OwnerDoc(); + } + /** * Return whether the node is an Element node */ @@ -488,23 +520,6 @@ public: return mNodeInfo->NameAtom(); } - nsINode* - InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn) - { - return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn); - } - nsINode* - ReplaceChild(nsINode *aNewChild, nsINode *aOldChild, nsresult *aReturn) - { - return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn); - } - nsINode* - AppendChild(nsINode *aNewChild, nsresult *aReturn) - { - return InsertBefore(aNewChild, nullptr, aReturn); - } - nsresult RemoveChild(nsINode *aOldChild); - /** * Insert a content node at a particular index. This method handles calling * BindToTree on the child appropriately. @@ -732,7 +747,7 @@ public: * an nsIDocument or an nsIAttribute. * @return the parent node */ - nsINode* GetNodeParent() const + nsINode* GetParentNode() const { return mParent; } @@ -765,7 +780,7 @@ public: { const nsINode* slowNode = this; const nsINode* iter = slowNode; - while ((iter = iter->GetNodeParent())) { + while ((iter = iter->GetParentNode())) { slowNode = iter; } @@ -1003,7 +1018,7 @@ public: */ nsIContent* GetSelectionRootContent(nsIPresShell* aPresShell); - virtual nsINodeList* GetChildNodesList(); + virtual nsINodeList* ChildNodes(); nsIContent* GetFirstChild() const { return mFirstChild; } nsIContent* GetLastChild() const { @@ -1019,7 +1034,7 @@ public: */ nsIDocument* GetOwnerDocument() const; - nsresult Normalize(); + void Normalize(); /** * Get the base URI for any relative URIs within this piece of @@ -1030,6 +1045,10 @@ public: * @return the base URI */ virtual already_AddRefed GetBaseURI() const = 0; + already_AddRefed GetBaseURIObject() const + { + return GetBaseURI(); + } /** * Facility for explicitly setting a base URI on a node. @@ -1047,18 +1066,14 @@ protected: } public: - nsresult GetDOMBaseURI(nsAString &aURI) const; - - // Note! This function must never fail. It only return an nsresult so that - // we can use it to implement nsIDOMNode - NS_IMETHOD GetTextContent(nsAString &aTextContent) + void GetTextContent(nsAString& aTextContent) { - SetDOMStringToNull(aTextContent); - return NS_OK; + GetTextContentInternal(aTextContent); } - NS_IMETHOD SetTextContent(const nsAString& aTextContent) + void SetTextContent(const nsAString& aTextContent, + mozilla::ErrorResult& aError) { - return NS_OK; + SetTextContentInternal(aTextContent, aError); } /** @@ -1111,41 +1126,17 @@ public: return NS_OK; } - - /** - * Compares the document position of a node to this node. - * - * @param aOtherNode The node whose position is being compared to this node - * - * @return The document position flags of the nodes. aOtherNode is compared - * to this node, i.e. if aOtherNode is before this node then - * DOCUMENT_POSITION_PRECEDING will be set. - * - * @see nsIDOMNode - */ - uint16_t CompareDocPosition(nsINode* aOtherNode); - nsresult CompareDocPosition(nsINode* aOtherNode, uint16_t* aReturn) - { - NS_ENSURE_ARG(aOtherNode); - *aReturn = CompareDocPosition(aOtherNode); - return NS_OK; - } - nsresult CompareDocumentPosition(nsIDOMNode* aOther, - uint16_t* aReturn); - - nsresult LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix); - nsresult IsDefaultNamespace(const nsAString& aNamespaceURI, bool* aResult) + void LookupPrefix(const nsAString& aNamespace, nsAString& aResult); + bool IsDefaultNamespace(const nsAString& aNamespaceURI) { nsAutoString defaultNamespace; LookupNamespaceURI(EmptyString(), defaultNamespace); - *aResult = aNamespaceURI.Equals(defaultNamespace); - return NS_OK; + return aNamespaceURI.Equals(defaultNamespace); } - nsresult LookupNamespaceURI(const nsAString& aNamespacePrefix, - nsAString& aNamespaceURI); + void LookupNamespaceURI(const nsAString& aNamespacePrefix, + nsAString& aNamespaceURI); nsresult IsEqualNode(nsIDOMNode* aOther, bool* aReturn); - bool IsEqualTo(nsINode* aOther); nsIContent* GetNextSibling() const { return mNextSibling; } nsIContent* GetPreviousSibling() const { return mPreviousSibling; } @@ -1194,7 +1185,7 @@ private: #ifdef DEBUG if (aRoot) { const nsINode* cur = this; - for (; cur; cur = cur->GetNodeParent()) + for (; cur; cur = cur->GetParentNode()) if (cur == aRoot) break; NS_ASSERTION(cur, "aRoot not an ancestor of |this|?"); } @@ -1214,7 +1205,7 @@ private: if (next) { return next; } - nsINode* parent = cur->GetNodeParent(); + nsINode* parent = cur->GetParentNode(); if (parent == aRoot) { return nullptr; } @@ -1239,7 +1230,7 @@ public: #ifdef DEBUG if (aRoot) { const nsINode* cur = this; - for (; cur; cur = cur->GetNodeParent()) + for (; cur; cur = cur->GetParentNode()) if (cur == aRoot) break; NS_ASSERTION(cur, "aRoot not an ancestor of |this|?"); } @@ -1425,6 +1416,88 @@ public: */ uint32_t Length() const; + void GetNodeName(nsAString& aNodeName) const + { + aNodeName = NodeName(); + } + void GetBaseURI(nsAString& aBaseURI) const; + nsGenericElement* GetParentElement() const; + bool HasChildNodes() const + { + return HasChildren(); + } + uint16_t CompareDocumentPosition(nsINode& aOther) const; + void GetNodeValue(nsAString& aNodeValue) + { + GetNodeValueInternal(aNodeValue); + } + void SetNodeValue(const nsAString& aNodeValue, + mozilla::ErrorResult& aError) + { + SetNodeValueInternal(aNodeValue, aError); + } + virtual void GetNodeValueInternal(nsAString& aNodeValue) + { + SetDOMStringToNull(aNodeValue); + } + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError) + { + // The DOM spec says that when nodeValue is defined to be null "setting it + // has no effect", so we don't throw an exception. + } + nsINode* InsertBefore(nsINode& aNode, nsINode* aChild, + mozilla::ErrorResult& aError) + { + return ReplaceOrInsertBefore(false, &aNode, aChild, aError); + } + nsINode* AppendChild(nsINode& aNode, mozilla::ErrorResult& aError) + { + return InsertBefore(aNode, nullptr, aError); + } + nsINode* ReplaceChild(nsINode& aNode, nsINode& aChild, + mozilla::ErrorResult& aError) + { + return ReplaceOrInsertBefore(true, &aNode, &aChild, aError); + } + nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError); + already_AddRefed CloneNode(bool aDeep, mozilla::ErrorResult& aError); + bool IsEqualNode(nsINode* aNode); + bool IsSupported(const nsAString& aFeature, const nsAString& aVersion); + void GetNamespaceURI(nsAString& aNamespaceURI, mozilla::ErrorResult& aError) const + { + aError = mNodeInfo->GetNamespaceURI(aNamespaceURI); + } +#ifdef MOZILLA_INTERNAL_API + void GetPrefix(nsAString& aPrefix) + { + mNodeInfo->GetPrefix(aPrefix); + } +#endif + void GetLocalName(nsAString& aLocalName) + { + aLocalName = mNodeInfo->LocalName(); + } + // HasAttributes is defined inline in Element.h. + bool HasAttributes() const; + nsDOMAttributeMap* GetAttributes(); + JS::Value SetUserData(JSContext* aCx, const nsAString& aKey, JS::Value aData, + nsIDOMUserDataHandler* aHandler, + mozilla::ErrorResult& aError); + JS::Value GetUserData(JSContext* aCx, const nsAString& aKey, + mozilla::ErrorResult& aError); + + // Helper method to remove this node from its parent. This is not exposed + // through WebIDL. + // Only call this if the node has a parent node. + nsresult RemoveFromParent() + { + nsINode* parent = GetParentNode(); + mozilla::ErrorResult rv; + parent->RemoveChild(*this, rv); + return rv.ErrorCode(); + } + protected: // Override this function to create a custom slots class. @@ -1461,12 +1534,23 @@ protected: return IsEditableInternal(); } + virtual void GetTextContentInternal(nsAString& aTextContent) + { + SetDOMStringToNull(aTextContent); + } + virtual void SetTextContentInternal(const nsAString& aTextContent, + mozilla::ErrorResult& aError) + { + } + #ifdef DEBUG // Note: virtual so that IsInNativeAnonymousSubtree can be called accross // 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 GetParentElement(nsIDOMElement** aParentElement); nsresult GetChildNodes(nsIDOMNodeList** aChildNodes); @@ -1475,21 +1559,15 @@ protected: nsresult GetPreviousSibling(nsIDOMNode** aPrevSibling); nsresult GetNextSibling(nsIDOMNode** aNextSibling); nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument); + nsresult CompareDocumentPosition(nsIDOMNode* aOther, + uint16_t* aReturn); + nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes); nsresult ReplaceOrInsertBefore(bool aReplace, nsIDOMNode *aNewChild, nsIDOMNode *aRefChild, nsIDOMNode **aReturn); - nsINode* ReplaceOrInsertBefore(bool aReplace, nsINode *aNewChild, - nsINode *aRefChild, nsresult *aReturn) - { - *aReturn = ReplaceOrInsertBefore(aReplace, aNewChild, aRefChild); - if (NS_FAILED(*aReturn)) { - return nullptr; - } - - return aReplace ? aRefChild : aNewChild; - } - virtual nsresult ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, - nsINode* aRefChild); + nsINode* ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, + nsINode* aRefChild, + mozilla::ErrorResult& aError); nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); /** @@ -1732,5 +1810,186 @@ extern const nsIID kThisPtrOffsetsSID; NS_DEFINE_STATIC_IID_ACCESSOR(nsINode, NS_INODE_IID) +#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(_final) \ + NS_IMETHOD GetNodeName(nsAString& aNodeName) _final \ + { \ + nsINode::GetNodeName(aNodeName); \ + return NS_OK; \ + } \ + NS_IMETHOD GetNodeValue(nsAString& aNodeValue) _final \ + { \ + nsINode::GetNodeValue(aNodeValue); \ + return NS_OK; \ + } \ + NS_IMETHOD SetNodeValue(const nsAString& aNodeValue) _final \ + { \ + mozilla::ErrorResult rv; \ + nsINode::SetNodeValue(aNodeValue, rv); \ + return rv.ErrorCode(); \ + } \ + NS_IMETHOD GetNodeType(uint16_t* aNodeType) _final \ + { \ + *aNodeType = nsINode::NodeType(); \ + return NS_OK; \ + } \ + NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) _final \ + { \ + return nsINode::GetParentNode(aParentNode); \ + } \ + NS_IMETHOD GetParentElement(nsIDOMElement** aParentElement) _final \ + { \ + return nsINode::GetParentElement(aParentElement); \ + } \ + NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) _final \ + { \ + return nsINode::GetChildNodes(aChildNodes); \ + } \ + NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) _final \ + { \ + return nsINode::GetFirstChild(aFirstChild); \ + } \ + NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) _final \ + { \ + return nsINode::GetLastChild(aLastChild); \ + } \ + NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) _final \ + { \ + return nsINode::GetPreviousSibling(aPreviousSibling); \ + } \ + NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) _final \ + { \ + return nsINode::GetNextSibling(aNextSibling); \ + } \ + NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) _final \ + { \ + return nsINode::GetAttributes(aAttributes); \ + } \ + NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) _final \ + { \ + return nsINode::GetOwnerDocument(aOwnerDocument); \ + } \ + NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aResult) _final \ + { \ + return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aResult); \ + } \ + NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aResult) _final \ + { \ + return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aResult); \ + } \ + NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aResult) _final \ + { \ + return nsINode::RemoveChild(aOldChild, aResult); \ + } \ + NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aResult) _final \ + { \ + return InsertBefore(aNewChild, nullptr, aResult); \ + } \ + NS_IMETHOD HasChildNodes(bool* aResult) _final \ + { \ + *aResult = nsINode::HasChildNodes(); \ + return NS_OK; \ + } \ + NS_IMETHOD CloneNode(bool aDeep, uint8_t aArgc, nsIDOMNode** aResult) _final \ + { \ + if (aArgc == 0) { \ + aDeep = true; \ + } \ + mozilla::ErrorResult rv; \ + nsCOMPtr clone = nsINode::CloneNode(aDeep, rv); \ + if (rv.Failed()) { \ + return rv.ErrorCode(); \ + } \ + *aResult = clone.forget().get()->AsDOMNode(); \ + return NS_OK; \ + } \ + NS_IMETHOD Normalize() _final \ + { \ + nsINode::Normalize(); \ + return NS_OK; \ + } \ + NS_IMETHOD IsSupported(const nsAString& aFeature, const nsAString& aVersion, bool* aResult) _final \ + { \ + *aResult = nsINode::IsSupported(aFeature, aVersion); \ + return NS_OK; \ + } \ + NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) _final \ + { \ + mozilla::ErrorResult rv; \ + nsINode::GetNamespaceURI(aNamespaceURI, rv); \ + return rv.ErrorCode(); \ + } \ + NS_IMETHOD GetPrefix(nsAString& aPrefix) _final \ + { \ + nsINode::GetPrefix(aPrefix); \ + return NS_OK; \ + } \ + NS_IMETHOD GetLocalName(nsAString& aLocalName) _final \ + { \ + nsINode::GetLocalName(aLocalName); \ + return NS_OK; \ + } \ + using nsINode::HasAttributes; \ + NS_IMETHOD HasAttributes(bool* aResult) _final \ + { \ + *aResult = nsINode::HasAttributes(); \ + return NS_OK; \ + } \ + NS_IMETHOD GetDOMBaseURI(nsAString& aBaseURI) _final \ + { \ + nsINode::GetBaseURI(aBaseURI); \ + return NS_OK; \ + } \ + NS_IMETHOD CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aResult) _final \ + { \ + return nsINode::CompareDocumentPosition(aOther, aResult); \ + } \ + NS_IMETHOD GetTextContent(nsAString& aTextContent) _final \ + { \ + nsINode::GetTextContent(aTextContent); \ + return NS_OK; \ + } \ + NS_IMETHOD SetTextContent(const nsAString& aTextContent) _final \ + { \ + mozilla::ErrorResult rv; \ + nsINode::SetTextContent(aTextContent, rv); \ + return rv.ErrorCode(); \ + } \ + NS_IMETHOD LookupPrefix(const nsAString& aNamespaceURI, nsAString& aResult) _final \ + { \ + nsINode::LookupPrefix(aNamespaceURI, aResult); \ + return NS_OK; \ + } \ + NS_IMETHOD IsDefaultNamespace(const nsAString& aNamespaceURI, bool* aResult) _final \ + { \ + *aResult = nsINode::IsDefaultNamespace(aNamespaceURI); \ + return NS_OK; \ + } \ + NS_IMETHOD LookupNamespaceURI(const nsAString& aPrefix, nsAString& aResult) _final \ + { \ + nsINode::LookupNamespaceURI(aPrefix, aResult); \ + return NS_OK; \ + } \ + NS_IMETHOD IsEqualNode(nsIDOMNode* aArg, bool* aResult) _final \ + { \ + return nsINode::IsEqualNode(aArg, aResult); \ + } \ + NS_IMETHOD SetUserData(const nsAString& aKey, nsIVariant* aData, nsIDOMUserDataHandler* aHandler, nsIVariant** aResult) _final \ + { \ + return nsINode::SetUserData(aKey, aData, aHandler, aResult); \ + } \ + NS_IMETHOD GetUserData(const nsAString& aKey, nsIVariant** aResult) _final \ + { \ + return nsINode::GetUserData(aKey, aResult); \ + } \ + NS_IMETHOD Contains(nsIDOMNode* aOther, bool* aResult) _final \ + { \ + return nsINode::Contains(aOther, aResult); \ + } + +#define NS_FORWARD_NSIDOMNODE_TO_NSINODE \ + NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER(MOZ_FINAL) + +#define NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE \ + NS_FORWARD_NSIDOMNODE_TO_NSINODE_HELPER() #endif /* nsINode_h___ */ diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index 1eef6afb1ba..c15e8545a4f 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -454,7 +454,8 @@ NS_IMETHODIMP nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI) { - return mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI); + mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI); + return NS_OK; } nsContentList* @@ -639,90 +640,6 @@ FragmentOrElement::~FragmentOrElement() } } -NS_IMETHODIMP -FragmentOrElement::GetNodeName(nsAString& aNodeName) -{ - aNodeName = NodeName(); - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::GetLocalName(nsAString& aLocalName) -{ - aLocalName = LocalName(); - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::GetNodeValue(nsAString& aNodeValue) -{ - SetDOMStringToNull(aNodeValue); - - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::SetNodeValue(const nsAString& aNodeValue) -{ - // The DOM spec says that when nodeValue is defined to be null "setting it - // has no effect", so we don't throw an exception. - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::GetNodeType(uint16_t* aNodeType) -{ - *aNodeType = NodeType(); - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::GetNamespaceURI(nsAString& aNamespaceURI) -{ - return mNodeInfo->GetNamespaceURI(aNamespaceURI); -} - -NS_IMETHODIMP -FragmentOrElement::GetPrefix(nsAString& aPrefix) -{ - mNodeInfo->GetPrefix(aPrefix); - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::IsSupported(const nsAString& aFeature, - const nsAString& aVersion, - bool* aReturn) -{ - *aReturn = nsContentUtils::InternalIsSupported(this, aFeature, aVersion); - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::HasAttributes(bool* aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - - *aReturn = GetAttrCount() > 0; - - return NS_OK; -} - -NS_IMETHODIMP -FragmentOrElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes) -{ - *aAttributes = nullptr; - return NS_OK; -} - -nsresult -FragmentOrElement::HasChildNodes(bool* aReturn) -{ - *aReturn = mAttrsAndChildren.ChildCount() > 0; - - return NS_OK; -} - already_AddRefed FragmentOrElement::GetChildren(uint32_t aFilter) { @@ -751,7 +668,7 @@ FragmentOrElement::GetChildren(uint32_t aFilter) if (!(aFilter & eAllButXBL)) { childList = document->BindingManager()->GetXBLChildNodesFor(this); if (!childList) { - childList = GetChildNodesList(); + childList = ChildNodes(); } } else { @@ -978,17 +895,17 @@ FragmentOrElement::RemoveChildAt(uint32_t aIndex, bool aNotify) } } -NS_IMETHODIMP -FragmentOrElement::GetTextContent(nsAString &aTextContent) +void +FragmentOrElement::GetTextContentInternal(nsAString& aTextContent) { nsContentUtils::GetNodeTextContent(this, true, aTextContent); - return NS_OK; } -NS_IMETHODIMP -FragmentOrElement::SetTextContent(const nsAString& aTextContent) +void +FragmentOrElement::SetTextContentInternal(const nsAString& aTextContent, + ErrorResult& aError) { - return nsContentUtils::SetNodeTextContent(this, aTextContent, false); + aError = nsContentUtils::SetNodeTextContent(this, aTextContent, false); } void @@ -1208,7 +1125,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement) { nsIDocument *doc; - if (!tmp->GetNodeParent() && (doc = tmp->OwnerDoc())) { + if (!tmp->GetParentNode() && (doc = tmp->OwnerDoc())) { doc->BindingManager()->RemovedFromDocument(tmp, doc); } } @@ -1259,7 +1176,7 @@ nsINode* FindOptimizableSubtreeRoot(nsINode* aNode) { nsINode* p; - while ((p = aNode->GetNodeParent())) { + while ((p = aNode->GetParentNode())) { if (aNode->UnoptimizableCCNode()) { return nullptr; } @@ -1888,7 +1805,7 @@ FragmentOrElement::FireNodeRemovedForChildren() nsCOMPtr child; for (child = GetFirstChild(); - child && child->GetNodeParent() == this; + child && child->GetParentNode() == this; child = child->GetNextSibling()) { nsContentUtils::MaybeFireNodeRemoved(child, this, doc); } diff --git a/content/base/src/nsCommentNode.cpp b/content/base/src/nsCommentNode.cpp index 34392d66c4d..5c28265ccdb 100644 --- a/content/base/src/nsCommentNode.cpp +++ b/content/base/src/nsCommentNode.cpp @@ -24,7 +24,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) diff --git a/content/base/src/nsContentIterator.cpp b/content/base/src/nsContentIterator.cpp index df2d461e224..cb8207b3968 100644 --- a/content/base/src/nsContentIterator.cpp +++ b/content/base/src/nsContentIterator.cpp @@ -25,7 +25,7 @@ NodeToParentOffset(nsINode* aNode, int32_t* aOffset) { *aOffset = 0; - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (parent) { *aOffset = parent->IndexOf(aNode); @@ -54,7 +54,7 @@ NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode, return true; } - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (!parent) { return false; } @@ -461,7 +461,7 @@ nsContentIterator::RebuildIndexStack() } while (current != mCommonParent) { - parent = current->GetNodeParent(); + parent = current->GetParentNode(); if (!parent) { return NS_ERROR_FAILURE; @@ -575,7 +575,7 @@ nsContentIterator::GetNextSibling(nsINode* aNode, return nullptr; } - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (!parent) { return nullptr; } @@ -636,7 +636,7 @@ nsContentIterator::GetPrevSibling(nsINode* aNode, return nullptr; } - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (!parent) { return nullptr; } @@ -706,7 +706,7 @@ nsContentIterator::NextNode(nsINode* aNode, nsTArray* aIndexes) } // post-order - nsINode* parent = node->GetNodeParent(); + nsINode* parent = node->GetParentNode(); nsIContent* sibling = nullptr; int32_t indx = 0; @@ -769,7 +769,7 @@ nsContentIterator::PrevNode(nsINode* aNode, nsTArray* aIndexes) // if we are a Pre-order iterator, use pre-order if (mPre) { - nsINode* parent = node->GetNodeParent(); + nsINode* parent = node->GetParentNode(); nsIContent* sibling = nullptr; int32_t indx = 0; @@ -1004,7 +1004,7 @@ nsContentIterator::PositionAt(nsINode* aCurNode) // Insert at head since we're walking up oldParentStack.InsertElementAt(0, tempNode); - nsINode* parent = tempNode->GetNodeParent(); + nsINode* parent = tempNode->GetParentNode(); if (!parent) { // this node has no parent, and thus no index @@ -1024,7 +1024,7 @@ nsContentIterator::PositionAt(nsINode* aCurNode) // Ok. We have the array of old parents. Look for a match. while (newCurNode) { - nsINode* parent = newCurNode->GetNodeParent(); + nsINode* parent = newCurNode->GetParentNode(); if (!parent) { // this node has no parent, and thus no index @@ -1422,7 +1422,7 @@ nsContentSubtreeIterator::PositionAt(nsINode* aCurNode) nsIContent* nsContentSubtreeIterator::GetTopAncestorInRange(nsINode* aNode) { - if (!aNode || !aNode->GetNodeParent()) { + if (!aNode || !aNode->GetParentNode()) { return nullptr; } @@ -1447,7 +1447,7 @@ nsContentSubtreeIterator::GetTopAncestorInRange(nsINode* aNode) // // We have to special-case this because CompareNodeToRange treats the root // node differently -- see bug 765205. - if (!parent || !parent->GetNodeParent()) { + if (!parent || !parent->GetParentNode()) { return content; } MOZ_ALWAYS_TRUE(NS_SUCCEEDED( diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index dfd17664653..e5de7e06179 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -733,7 +733,7 @@ nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement, NS_PRECONDITION(aElement, "Must have a content node to work with"); if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY || - !MayContainRelevantNodes(aElement->GetNodeParent()) || + !MayContainRelevantNodes(aElement->GetParentNode()) || !nsContentUtils::IsInSameAnonymousTree(mRootNode, aElement)) { // Either we're already dirty or this notification doesn't affect // whether we might match aElement. @@ -932,7 +932,7 @@ bool nsContentList::MatchSelf(nsIContent *aContent) { NS_PRECONDITION(aContent, "Can't match null stuff, you know"); - NS_PRECONDITION(mDeep || aContent->GetNodeParent() == mRootNode, + NS_PRECONDITION(mDeep || aContent->GetParentNode() == mRootNode, "MatchSelf called on a node that we can't possibly match"); if (!aContent->IsElement()) { diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index f14a3bfef76..2a5d98be14d 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1675,7 +1675,7 @@ nsContentUtils::InProlog(nsINode *aNode) { NS_PRECONDITION(aNode, "missing node to nsContentUtils::InProlog"); - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (!parent || !parent->IsNodeOfType(nsINode::eDOCUMENT)) { return false; } @@ -1811,7 +1811,7 @@ nsContentUtils::GetCrossDocParentNode(nsINode* aChild) { NS_PRECONDITION(aChild, "The child is null!"); - nsINode* parent = aChild->GetNodeParent(); + nsINode* parent = aChild->GetParentNode(); if (parent || !aChild->IsNodeOfType(nsINode::eDOCUMENT)) return parent; @@ -1831,7 +1831,7 @@ nsContentUtils::ContentIsDescendantOf(const nsINode* aPossibleDescendant, do { if (aPossibleDescendant == aPossibleAncestor) return true; - aPossibleDescendant = aPossibleDescendant->GetNodeParent(); + aPossibleDescendant = aPossibleDescendant->GetParentNode(); } while (aPossibleDescendant); return false; @@ -1862,7 +1862,7 @@ nsContentUtils::GetAncestors(nsINode* aNode, { while (aNode) { aArray.AppendElement(aNode); - aNode = aNode->GetNodeParent(); + aNode = aNode->GetParentNode(); } return NS_OK; } @@ -1941,11 +1941,11 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1, nsAutoTArray parents1, parents2; do { parents1.AppendElement(aNode1); - aNode1 = aNode1->GetNodeParent(); + aNode1 = aNode1->GetParentNode(); } while (aNode1); do { parents2.AppendElement(aNode2); - aNode2 = aNode2->GetNodeParent(); + aNode2 = aNode2->GetParentNode(); } while (aNode2); // Find where the parent chain differs @@ -1982,11 +1982,11 @@ nsContentUtils::ComparePoints(nsINode* aParent1, int32_t aOffset1, nsINode* node2 = aParent2; do { parents1.AppendElement(node1); - node1 = node1->GetNodeParent(); + node1 = node1->GetParentNode(); } while (node1); do { parents2.AppendElement(node2); - node2 = node2->GetNodeParent(); + node2 = node2->GetParentNode(); } while (node2); uint32_t pos1 = parents1.Length() - 1; @@ -2340,12 +2340,12 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent, // Now start at aContent and append the indices of it and all its ancestors // in their containers. That should at least pin down its position in the // DOM... - nsINode* parent = aContent->GetNodeParent(); + nsINode* parent = aContent->GetParentNode(); nsINode* content = aContent; while (parent) { KeyAppendInt(parent->IndexOf(content), aKey); content = parent; - parent = content->GetNodeParent(); + parent = content->GetParentNode(); } } @@ -3858,7 +3858,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode, continue; } } - aNode = aNode->GetNodeParent(); + aNode = aNode->GetParentNode(); } return false; @@ -3882,7 +3882,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent, nsIDocument* aOwnerDoc) { NS_PRECONDITION(aChild, "Missing child"); - NS_PRECONDITION(aChild->GetNodeParent() == aParent, "Wrong parent"); + NS_PRECONDITION(aChild->GetParentNode() == aParent, "Wrong parent"); NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc"); // This checks that IsSafeToRunScript is true since we don't want to fire @@ -4382,7 +4382,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent, nsCOMPtr child; bool skipFirst = aTryReuse; for (child = aContent->GetFirstChild(); - child && child->GetNodeParent() == aContent; + child && child->GetParentNode() == aContent; child = child->GetNextSibling()) { if (skipFirst && child->IsNodeOfType(nsINode::eTEXT)) { skipFirst = false; diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index d6b36e69ead..62efa5d039f 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -29,6 +29,7 @@ #include "nsAsyncDOMEvent.h" #include "nsWrapperCacheInlines.h" +using namespace mozilla; using namespace mozilla::dom; //---------------------------------------------------------------------- @@ -210,167 +211,20 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement) return NS_OK; } -NS_IMETHODIMP -nsDOMAttribute::GetNodeName(nsAString& aNodeName) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeName); - - return GetName(aNodeName); -} - -NS_IMETHODIMP -nsDOMAttribute::GetNodeValue(nsAString& aNodeValue) +void +nsDOMAttribute::GetNodeValueInternal(nsAString& aNodeValue) { OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue); - return GetValue(aNodeValue); + GetValue(aNodeValue); } -NS_IMETHODIMP -nsDOMAttribute::SetNodeValue(const nsAString& aNodeValue) +void +nsDOMAttribute::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError) { OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue); - return SetValue(aNodeValue); -} - -NS_IMETHODIMP -nsDOMAttribute::GetNodeType(uint16_t* aNodeType) -{ - NS_ENSURE_ARG_POINTER(aNodeType); - OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeType); - - *aNodeType = (uint16_t)nsIDOMNode::ATTRIBUTE_NODE; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode) -{ - NS_ENSURE_ARG_POINTER(aParentNode); - OwnerDoc()->WarnOnceAbout(nsIDocument::eParentNode); - - *aParentNode = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetParentElement(nsIDOMElement** aParentElement) -{ - *aParentElement = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eChildNodes); - - return nsINode::GetChildNodes(aChildNodes); -} - -NS_IMETHODIMP -nsDOMAttribute::HasChildNodes(bool* aHasChildNodes) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eHasChildNodes); - - *aHasChildNodes = false; - - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::HasAttributes(bool* aHasAttributes) -{ - NS_ENSURE_ARG_POINTER(aHasAttributes); - OwnerDoc()->WarnOnceAbout(nsIDocument::eHasAttributes); - - *aHasAttributes = false; - - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild) -{ - *aFirstChild = nullptr; - - OwnerDoc()->WarnOnceAbout(nsIDocument::eFirstChild); - - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eLastChild); - - return GetFirstChild(aLastChild); -} - -NS_IMETHODIMP -nsDOMAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling) -{ - NS_ENSURE_ARG_POINTER(aPreviousSibling); - - OwnerDoc()->WarnOnceAbout(nsIDocument::ePreviousSibling); - - *aPreviousSibling = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetNextSibling(nsIDOMNode** aNextSibling) -{ - NS_ENSURE_ARG_POINTER(aNextSibling); - - OwnerDoc()->WarnOnceAbout(nsIDocument::eNextSibling); - - *aNextSibling = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes) -{ - NS_ENSURE_ARG_POINTER(aAttributes); - - OwnerDoc()->WarnOnceAbout(nsIDocument::eAttributes); - - *aAttributes = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eInsertBefore); - - return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn); -} - -NS_IMETHODIMP -nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceChild); - - return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn); -} - -NS_IMETHODIMP -nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveChild); - - return nsINode::RemoveChild(aOldChild, aReturn); -} - -NS_IMETHODIMP -nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eAppendChild); - - return InsertBefore(aNewChild, nullptr, aReturn); + aError = SetValue(aNodeValue); } nsresult @@ -390,67 +244,6 @@ nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const return NS_OK; } -NS_IMETHODIMP -nsDOMAttribute::CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aResult) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eCloneNode); - - if (!aOptionalArgc) { - aDeep = true; - } - - return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aResult); -} - -NS_IMETHODIMP -nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerDocument); - - return nsINode::GetOwnerDocument(aOwnerDocument); -} - -NS_IMETHODIMP -nsDOMAttribute::GetNamespaceURI(nsAString& aNamespaceURI) -{ - return mNodeInfo->GetNamespaceURI(aNamespaceURI); -} - -NS_IMETHODIMP -nsDOMAttribute::GetPrefix(nsAString& aPrefix) -{ - mNodeInfo->GetPrefix(aPrefix); - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::GetLocalName(nsAString& aLocalName) -{ - mNodeInfo->GetName(aLocalName); - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::Normalize() -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eNormalize); - - // Nothing to do here - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::IsSupported(const nsAString& aFeature, - const nsAString& aVersion, - bool* aReturn) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSupported); - - *aReturn = nsContentUtils::InternalIsSupported(static_cast(this), - aFeature, aVersion); - return NS_OK; -} - already_AddRefed nsDOMAttribute::GetBaseURI() const { @@ -459,85 +252,21 @@ nsDOMAttribute::GetBaseURI() const return parent ? parent->GetBaseURI() : nullptr; } -NS_IMETHODIMP -nsDOMAttribute::GetDOMBaseURI(nsAString &aURI) -{ - return nsINode::GetDOMBaseURI(aURI); -} - -NS_IMETHODIMP -nsDOMAttribute::CompareDocumentPosition(nsIDOMNode *other, - uint16_t *aResult) -{ - return nsINode::CompareDocumentPosition(other, aResult); -} - -NS_IMETHODIMP -nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther, bool* aResult) -{ - OwnerDoc()->WarnOnceAbout(nsIDocument::eIsEqualNode); - - return nsINode::IsEqualNode(aOther, aResult); -} - -NS_IMETHODIMP -nsDOMAttribute::GetTextContent(nsAString &aTextContent) +void +nsDOMAttribute::GetTextContentInternal(nsAString& aTextContent) { OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent); - return GetNodeValue(aTextContent); + GetValue(aTextContent); } -NS_IMETHODIMP -nsDOMAttribute::SetTextContent(const nsAString& aTextContent) +void +nsDOMAttribute::SetTextContentInternal(const nsAString& aTextContent, + ErrorResult& aError) { OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent); - return SetNodeValue(aTextContent); -} - -NS_IMETHODIMP -nsDOMAttribute::Contains(nsIDOMNode* aOther, bool* aReturn) -{ - return nsINode::Contains(aOther, aReturn); -} - -NS_IMETHODIMP -nsDOMAttribute::LookupPrefix(const nsAString & namespaceURI, - nsAString & aResult) -{ - SetDOMStringToNull(aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::IsDefaultNamespace(const nsAString & namespaceURI, - bool *aResult) -{ - *aResult = namespaceURI.IsEmpty(); - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::LookupNamespaceURI(const nsAString & prefix, - nsAString & aResult) -{ - SetDOMStringToNull(aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsDOMAttribute::SetUserData(const nsAString & key, - nsIVariant *data, nsIDOMUserDataHandler *handler, - nsIVariant **aResult) -{ - return nsINode::SetUserData(key, data, handler, aResult); -} - -NS_IMETHODIMP -nsDOMAttribute::GetUserData(const nsAString & key, nsIVariant **aResult) -{ - return nsINode::GetUserData(key, aResult); + SetNodeValueInternal(aTextContent, aError); } NS_IMETHODIMP diff --git a/content/base/src/nsDOMAttribute.h b/content/base/src/nsDOMAttribute.h index 262f084e87f..3d0f9e49525 100644 --- a/content/base/src/nsDOMAttribute.h +++ b/content/base/src/nsDOMAttribute.h @@ -36,7 +36,13 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS // nsIDOMNode interface - NS_DECL_NSIDOMNODE + NS_FORWARD_NSIDOMNODE_TO_NSINODE + virtual void GetTextContentInternal(nsAString& aTextContent); + virtual void SetTextContentInternal(const nsAString& aTextContent, + mozilla::ErrorResult& aError); + virtual void GetNodeValueInternal(nsAString& aNodeValue); + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError); // nsIDOMAttr interface NS_DECL_NSIDOMATTR diff --git a/content/base/src/nsDOMDocumentType.h b/content/base/src/nsDOMDocumentType.h index 5109ff88571..a0ea6a563cf 100644 --- a/content/base/src/nsDOMDocumentType.h +++ b/content/base/src/nsDOMDocumentType.h @@ -31,7 +31,7 @@ public: } // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE }; class nsDOMDocumentType : public nsDOMDocumentTypeForward @@ -53,19 +53,16 @@ public: // nsIDOMDocumentType NS_DECL_NSIDOMDOCUMENTTYPE - NS_IMETHODIMP GetNodeValue(nsAString& aNodeValue) - { - SetDOMStringToNull(aNodeValue); - - return NS_OK; - } - NS_IMETHODIMP SetNodeValue(const nsAString& aNodeValue) - { - return NS_OK; - } - // nsINode virtual bool IsNodeOfType(uint32_t aFlags) const; + virtual void GetNodeValueInternal(nsAString& aNodeValue) + { + SetDOMStringToNull(aNodeValue); + } + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError) + { + } // nsIContent overrides virtual const nsTextFragment* GetText(); diff --git a/content/base/src/nsDOMMutationObserver.cpp b/content/base/src/nsDOMMutationObserver.cpp index 964644160e6..fdccae3de08 100644 --- a/content/base/src/nsDOMMutationObserver.cpp +++ b/content/base/src/nsDOMMutationObserver.cpp @@ -485,7 +485,7 @@ nsDOMMutationObserver::GetAllSubtreeObserversFor(nsINode* aNode, } } } - n = n->GetNodeParent(); + n = n->GetParentNode(); } } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 9ff0302d5f7..671d1af2820 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3496,7 +3496,7 @@ nsDocument::IsNodeOfType(uint32_t aFlags) const Element* nsIDocument::GetRootElement() const { - return (mCachedRootElement && mCachedRootElement->GetNodeParent() == this) ? + return (mCachedRootElement && mCachedRootElement->GetParentNode() == this) ? mCachedRootElement : GetRootElementInternal(); } @@ -4981,7 +4981,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, case nsIDOMNode::COMMENT_NODE: case nsIDOMNode::DOCUMENT_TYPE_NODE: { - nsCOMPtr newNode; + nsCOMPtr newNode; nsCOMArray nodesWithProperties; rv = nsNodeUtils::Clone(imported, aDeep, mNodeInfoManager, nodesWithProperties, getter_AddRefs(newNode)); @@ -4993,8 +4993,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, true); NS_ENSURE_SUCCESS(rv, rv); - newNode.swap(*aResult); - + *aResult = newNode.forget().get()->AsDOMNode(); return NS_OK; } default: @@ -5796,267 +5795,6 @@ nsDocument::SetDir(const nsAString& aDirection) return NS_OK; } - -// -// nsIDOMNode methods -// -NS_IMETHODIMP -nsDocument::GetNodeName(nsAString& aNodeName) -{ - aNodeName.AssignLiteral("#document"); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetNodeValue(nsAString& aNodeValue) -{ - SetDOMStringToNull(aNodeValue); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::SetNodeValue(const nsAString& aNodeValue) -{ - // The DOM spec says that when nodeValue is defined to be null "setting it - // has no effect", so we don't throw an exception. - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetNodeType(uint16_t* aNodeType) -{ - *aNodeType = nsIDOMNode::DOCUMENT_NODE; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetParentNode(nsIDOMNode** aParentNode) -{ - *aParentNode = nullptr; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetParentElement(nsIDOMElement** aParentElement) -{ - *aParentElement = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes) -{ - return nsINode::GetChildNodes(aChildNodes); -} - -NS_IMETHODIMP -nsDocument::HasChildNodes(bool* aHasChildNodes) -{ - NS_ENSURE_ARG(aHasChildNodes); - - *aHasChildNodes = (mChildren.ChildCount() != 0); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::HasAttributes(bool* aHasAttributes) -{ - NS_ENSURE_ARG(aHasAttributes); - - *aHasAttributes = false; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetFirstChild(nsIDOMNode** aFirstChild) -{ - return nsINode::GetFirstChild(aFirstChild); -} - -NS_IMETHODIMP -nsDocument::GetLastChild(nsIDOMNode** aLastChild) -{ - return nsINode::GetLastChild(aLastChild); -} - -NS_IMETHODIMP -nsDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling) -{ - *aPreviousSibling = nullptr; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetNextSibling(nsIDOMNode** aNextSibling) -{ - *aNextSibling = nullptr; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) -{ - *aAttributes = nullptr; - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetNamespaceURI(nsAString& aNamespaceURI) -{ - SetDOMStringToNull(aNamespaceURI); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetPrefix(nsAString& aPrefix) -{ - SetDOMStringToNull(aPrefix); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetLocalName(nsAString& aLocalName) -{ - SetDOMStringToNull(aLocalName); - - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, - nsIDOMNode** aReturn) -{ - return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn); -} - -NS_IMETHODIMP -nsDocument::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, - nsIDOMNode** aReturn) -{ - return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn); -} - -NS_IMETHODIMP -nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) -{ - return nsINode::RemoveChild(aOldChild, aReturn); -} - -NS_IMETHODIMP -nsDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) -{ - return nsDocument::InsertBefore(aNewChild, nullptr, aReturn); -} - -NS_IMETHODIMP -nsDocument::CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aReturn) -{ - if (!aOptionalArgc) { - aDeep = true; - } - - return nsNodeUtils::CloneNodeImpl(this, aDeep, !mCreatingStaticClone, aReturn); -} - -NS_IMETHODIMP -nsDocument::Normalize() -{ - return nsIDocument::Normalize(); -} - -NS_IMETHODIMP -nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion, - bool* aReturn) -{ - *aReturn = nsContentUtils::InternalIsSupported(static_cast(this), - aFeature, aVersion); - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::GetDOMBaseURI(nsAString &aURI) -{ - return nsIDocument::GetDOMBaseURI(aURI); -} - -NS_IMETHODIMP -nsDocument::GetTextContent(nsAString &aTextContent) -{ - SetDOMStringToNull(aTextContent); - return NS_OK; -} - -NS_IMETHODIMP -nsDocument::IsEqualNode(nsIDOMNode* aOther, bool* aResult) -{ - return nsINode::IsEqualNode(aOther, aResult); -} - -NS_IMETHODIMP -nsDocument::CompareDocumentPosition(nsIDOMNode *other, - uint16_t *aResult) -{ - return nsINode::CompareDocumentPosition(other, aResult); -} - -NS_IMETHODIMP -nsDocument::SetTextContent(const nsAString & aTextContent) -{ - return nsINode::SetTextContent(aTextContent); -} - -NS_IMETHODIMP -nsDocument::LookupPrefix(const nsAString & namespaceURI, nsAString & aResult) -{ - return nsINode::LookupPrefix(namespaceURI, aResult); -} - -NS_IMETHODIMP -nsDocument::IsDefaultNamespace(const nsAString & namespaceURI, - bool *aResult) -{ - return nsINode::IsDefaultNamespace(namespaceURI, aResult); -} - -NS_IMETHODIMP -nsDocument::LookupNamespaceURI(const nsAString & prefix, - nsAString & aResult) -{ - return nsINode::LookupNamespaceURI(prefix, aResult); -} - -NS_IMETHODIMP -nsDocument::SetUserData(const nsAString & key, - nsIVariant *data, nsIDOMUserDataHandler *handler, - nsIVariant **aResult) -{ - return nsINode::SetUserData(key, data, handler, aResult); -} - -NS_IMETHODIMP -nsDocument::GetUserData(const nsAString & key, - nsIVariant **aResult) -{ - return nsINode::GetUserData(key, aResult); -} - -NS_IMETHODIMP -nsDocument::Contains(nsIDOMNode* aOther, bool* aReturn) -{ - return nsINode::Contains(aOther, aReturn); -} - NS_IMETHODIMP nsDocument::GetInputEncoding(nsAString& aInputEncoding) { @@ -6274,7 +6012,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult) // Scope firing mutation events so that we don't carry any state that // might be stale { - nsINode* parent = adoptedNode->GetNodeParent(); + nsINode* parent = adoptedNode->GetParentNode(); if (parent) { nsContentUtils::MaybeFireNodeRemoved(adoptedNode, parent, adoptedNode->OwnerDoc()); @@ -6331,7 +6069,7 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult) } while ((doc = doc->GetParentDocument())); // Remove from parent. - nsCOMPtr parent = adoptedNode->GetNodeParent(); + nsCOMPtr parent = adoptedNode->GetParentNode(); if (parent) { parent->RemoveChildAt(parent->IndexOf(adoptedNode), true); } @@ -6417,12 +6155,6 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult) return NS_OK; } -NS_IMETHODIMP -nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) -{ - return nsINode::GetOwnerDocument(aOwnerDocument); -} - nsEventListenerManager* nsDocument::GetListenerManager(bool aCreateIfNotFound) { diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index defc39e6804..130602f866a 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -735,7 +735,7 @@ private: public: // nsIDOMNode - NS_DECL_NSIDOMNODE + NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE // nsIDOMDocument NS_DECL_NSIDOMDOCUMENT diff --git a/content/base/src/nsDocumentEncoder.cpp b/content/base/src/nsDocumentEncoder.cpp index 2f1dfc52db0..7e643eb7446 100644 --- a/content/base/src/nsDocumentEncoder.cpp +++ b/content/base/src/nsDocumentEncoder.cpp @@ -535,7 +535,7 @@ nsDocumentEncoder::SerializeToStringIterative(nsINode* aNode, node = current->GetNextSibling(); if (!node) { // Perhaps parent node has siblings. - current = current->GetNodeParent(); + current = current->GetParentNode(); } } } @@ -1091,7 +1091,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString) if (!prevNode) { // Went from a non- to a mCommonAncestors.Clear(); - nsContentUtils::GetAncestors(n->GetNodeParent(), mCommonAncestors); + nsContentUtils::GetAncestors(n->GetParentNode(), mCommonAncestors); rv = SerializeRangeContextStart(mCommonAncestors, output); NS_ENSURE_SUCCESS(rv, rv); // Don't let SerializeRangeToString serialize the context again @@ -1104,7 +1104,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString) } else if (prevNode) { // Went from a to a non- mCommonAncestors.Clear(); - nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors); + nsContentUtils::GetAncestors(p->GetParentNode(), mCommonAncestors); mDisableContextSerialize = false; rv = SerializeRangeContextEnd(mCommonAncestors, output); NS_ENSURE_SUCCESS(rv, rv); @@ -1122,7 +1122,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString) rv = SerializeNodeEnd(p, output); NS_ENSURE_SUCCESS(rv, rv); mCommonAncestors.Clear(); - nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors); + nsContentUtils::GetAncestors(p->GetParentNode(), mCommonAncestors); mDisableContextSerialize = false; rv = SerializeRangeContextEnd(mCommonAncestors, output); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/base/src/nsDocumentFragment.cpp b/content/base/src/nsDocumentFragment.cpp index 4a9b29290ac..0280cfaddc8 100644 --- a/content/base/src/nsDocumentFragment.cpp +++ b/content/base/src/nsDocumentFragment.cpp @@ -31,7 +31,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // interface nsIDOMNode - NS_FORWARD_NSIDOMNODE(FragmentOrElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // interface nsIDOMDocumentFragment // NS_DECL_NSIDOCUMENTFRAGMENT Empty diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 9789cc5c6c2..292e645078a 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -114,43 +114,19 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsGenericDOMDataNode, nsNodeUtils::LastRelease(this)) -nsresult -nsGenericDOMDataNode::GetNodeValue(nsAString& aNodeValue) +void +nsGenericDOMDataNode::GetNodeValueInternal(nsAString& aNodeValue) { - return GetData(aNodeValue); + DebugOnly rv = GetData(aNodeValue); + NS_ASSERTION(NS_SUCCEEDED(rv), "GetData() failed!"); } -nsresult -nsGenericDOMDataNode::SetNodeValue(const nsAString& aNodeValue) +void +nsGenericDOMDataNode::SetNodeValueInternal(const nsAString& aNodeValue, + ErrorResult& aError) { - return SetTextInternal(0, mText.GetLength(), aNodeValue.BeginReading(), - aNodeValue.Length(), true); -} - -nsresult -nsGenericDOMDataNode::GetNamespaceURI(nsAString& aNamespaceURI) -{ - SetDOMStringToNull(aNamespaceURI); - - return NS_OK; -} - -nsresult -nsGenericDOMDataNode::GetPrefix(nsAString& aPrefix) -{ - SetDOMStringToNull(aPrefix); - - return NS_OK; -} - -nsresult -nsGenericDOMDataNode::IsSupported(const nsAString& aFeature, - const nsAString& aVersion, - bool* aReturn) -{ - *aReturn = nsContentUtils::InternalIsSupported(static_cast(this), - aFeature, aVersion); - return NS_OK; + aError = SetTextInternal(0, mText.GetLength(), aNodeValue.BeginReading(), + aNodeValue.Length(), true); } //---------------------------------------------------------------------- @@ -746,7 +722,7 @@ nsGenericDOMDataNode::SplitData(uint32_t aOffset, nsIContent** aReturn, return rv; } - nsCOMPtr parent = GetNodeParent(); + nsCOMPtr parent = GetParentNode(); if (parent) { int32_t insertionIndex = parent->IndexOf(this); if (aCloneAfterOriginal) { diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 8a3383d47d8..a97a925671a 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -58,73 +58,9 @@ public: nsGenericDOMDataNode(already_AddRefed aNodeInfo); virtual ~nsGenericDOMDataNode(); - // Implementation for nsIDOMNode - nsresult GetNodeName(nsAString& aNodeName) - { - aNodeName = NodeName(); - return NS_OK; - } - nsresult GetNodeType(uint16_t* aNodeType) - { - *aNodeType = NodeType(); - return NS_OK; - } - nsresult GetNodeValue(nsAString& aNodeValue); - nsresult SetNodeValue(const nsAString& aNodeValue); - nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes) - { - NS_ENSURE_ARG_POINTER(aAttributes); - *aAttributes = nullptr; - return NS_OK; - } - nsresult HasChildNodes(bool* aHasChildNodes) - { - NS_ENSURE_ARG_POINTER(aHasChildNodes); - *aHasChildNodes = false; - return NS_OK; - } - nsresult HasAttributes(bool* aHasAttributes) - { - NS_ENSURE_ARG_POINTER(aHasAttributes); - *aHasAttributes = false; - return NS_OK; - } - nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, - nsIDOMNode** aReturn) - { - return ReplaceOrInsertBefore(false, aNewChild, aRefChild, aReturn); - } - nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, - nsIDOMNode** aReturn) - { - return ReplaceOrInsertBefore(true, aNewChild, aOldChild, aReturn); - } - nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) - { - return nsINode::RemoveChild(aOldChild, aReturn); - } - nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) - { - return InsertBefore(aNewChild, nullptr, aReturn); - } - nsresult GetNamespaceURI(nsAString& aNamespaceURI); - nsresult GetLocalName(nsAString& aLocalName) - { - aLocalName = LocalName(); - return NS_OK; - } - nsresult GetPrefix(nsAString& aPrefix); - nsresult IsSupported(const nsAString& aFeature, - const nsAString& aVersion, - bool* aReturn); - nsresult CloneNode(bool aDeep, uint8_t aOptionalArgc, nsIDOMNode** aReturn) - { - if (!aOptionalArgc) { - aDeep = true; - } - - return nsNodeUtils::CloneNodeImpl(this, aDeep, true, aReturn); - } + virtual void GetNodeValueInternal(nsAString& aNodeValue); + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError); // Implementation for nsIDOMCharacterData nsresult GetData(nsAString& aData) const; @@ -142,21 +78,20 @@ public: virtual uint32_t GetChildCount() const; virtual nsIContent *GetChildAt(uint32_t aIndex) const; virtual nsIContent * const * GetChildArray(uint32_t* aChildCount) const; - virtual int32_t IndexOf(const nsINode* aPossibleChild) const MOZ_OVERRIDE; + virtual int32_t IndexOf(const nsINode* aPossibleChild) const; virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify); virtual void RemoveChildAt(uint32_t aIndex, bool aNotify); - NS_IMETHOD GetTextContent(nsAString &aTextContent) + virtual void GetTextContentInternal(nsAString& aTextContent) { - nsresult rv = GetNodeValue(aTextContent); - NS_ASSERTION(NS_SUCCEEDED(rv), "GetNodeValue() failed?"); - return rv; + GetNodeValue(aTextContent); } - NS_IMETHOD SetTextContent(const nsAString& aTextContent) + virtual void SetTextContentInternal(const nsAString& aTextContent, + mozilla::ErrorResult& aError) { // Batch possible DOMSubtreeModified events. mozAutoSubtreeModified subtree(OwnerDoc(), nullptr); - return SetNodeValue(aTextContent); + return SetNodeValue(aTextContent, aError); } // Implementation for nsIContent @@ -244,7 +179,7 @@ public: protected: virtual mozilla::dom::Element* GetNameSpaceElement() { - nsINode *parent = GetNodeParent(); + nsINode *parent = GetParentNode(); return parent && parent->IsElement() ? parent->AsElement() : nullptr; } diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 7872b1838ac..6a9134c3c91 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -934,12 +934,11 @@ nsGenericElement::GetAttributeNode(const nsAString& aName, document->WarnOnceAbout(nsIDocument::eGetAttributeNode); } - nsCOMPtr map; - nsresult rv = GetAttributes(getter_AddRefs(map)); - NS_ENSURE_SUCCESS(rv, rv); + nsDOMAttributeMap* map = GetAttributes(); + NS_ENSURE_TRUE(map, NS_ERROR_FAILURE); nsCOMPtr node; - rv = map->GetNamedItem(aName, getter_AddRefs(node)); + nsresult rv = map->GetNamedItem(aName, getter_AddRefs(node)); if (NS_SUCCEEDED(rv) && node) { rv = CallQueryInterface(node, aReturn); @@ -959,12 +958,11 @@ nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute, OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode); - nsCOMPtr map; - nsresult rv = GetAttributes(getter_AddRefs(map)); - NS_ENSURE_SUCCESS(rv, rv); + nsDOMAttributeMap* map = GetAttributes(); + NS_ENSURE_TRUE(map, NS_ERROR_FAILURE); nsCOMPtr returnNode; - rv = map->SetNamedItem(aAttribute, getter_AddRefs(returnNode)); + nsresult rv = map->SetNamedItem(aAttribute, getter_AddRefs(returnNode)); NS_ENSURE_SUCCESS(rv, rv); if (returnNode) { @@ -985,13 +983,12 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute, OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode); - nsCOMPtr map; - nsresult rv = GetAttributes(getter_AddRefs(map)); - NS_ENSURE_SUCCESS(rv, rv); + nsDOMAttributeMap* map = GetAttributes(); + NS_ENSURE_TRUE(map, NS_ERROR_FAILURE); nsAutoString name; - rv = aAttribute->GetName(name); + nsresult rv = aAttribute->GetName(name); if (NS_SUCCEEDED(rv)) { nsCOMPtr node; rv = map->RemoveNamedItem(name, getter_AddRefs(node)); @@ -1094,12 +1091,12 @@ nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI, const nsAString& aLocalName, nsIDOMAttr** aReturn) { - nsCOMPtr map; - nsresult rv = GetAttributes(getter_AddRefs(map)); - NS_ENSURE_SUCCESS(rv, rv); + nsDOMAttributeMap* map = GetAttributes(); + NS_ENSURE_TRUE(map, NS_ERROR_FAILURE); nsCOMPtr node; - rv = map->GetNamedItemNS(aNamespaceURI, aLocalName, getter_AddRefs(node)); + nsresult rv = map->GetNamedItemNS(aNamespaceURI, aLocalName, + getter_AddRefs(node)); if (NS_SUCCEEDED(rv) && node) { rv = CallQueryInterface(node, aReturn); @@ -1118,12 +1115,11 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr, OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS); - nsCOMPtr map; - nsresult rv = GetAttributes(getter_AddRefs(map)); - NS_ENSURE_SUCCESS(rv, rv); + nsDOMAttributeMap* map = GetAttributes(); + NS_ENSURE_TRUE(map, NS_ERROR_FAILURE); nsCOMPtr returnNode; - rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode)); + nsresult rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode)); NS_ENSURE_SUCCESS(rv, rv); if (returnNode) { diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 38356a2b6be..aaa1d915e6c 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -201,6 +201,15 @@ private: public: // nsIDOMElement method implementation NS_DECL_NSIDOMELEMENT + nsDOMAttributeMap* GetAttributes() + { + nsDOMSlots *slots = DOMSlots(); + if (!slots->mAttributeMap) { + slots->mAttributeMap = new nsDOMAttributeMap(this); + } + + return slots->mAttributeMap; + } //---------------------------------------- diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index ac121f4d58a..a9d3c485fe4 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -99,6 +99,7 @@ #include "xpcpublic.h" #include "nsCSSRuleProcessor.h" #include "nsCSSParser.h" +#include "nsHTMLLegendElement.h" #include "nsWrapperCacheInlines.h" using namespace mozilla; @@ -214,7 +215,7 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor) { if (aEditor) *aEditor = nullptr; - for (nsINode* node = this; node; node = node->GetNodeParent()) { + for (nsINode* node = this; node; node = node->GetParentNode()) { if (!node->IsElement() || !node->AsElement()->IsHTML()) continue; @@ -309,7 +310,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell) } nsINodeList* -nsINode::GetChildNodesList() +nsINode::ChildNodes() { nsSlots* slots = Slots(); if (!slots->mChildNodes) { @@ -344,7 +345,7 @@ nsINode::GetParentNode(nsIDOMNode** aParentNode) { *aParentNode = nullptr; - nsINode *parent = GetNodeParent(); + nsINode *parent = GetParentNode(); return parent ? CallQueryInterface(parent, aParentNode) : NS_OK; } @@ -360,12 +361,7 @@ nsINode::GetParentElement(nsIDOMElement** aParentElement) nsresult nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes) { - *aChildNodes = GetChildNodesList(); - if (!*aChildNodes) { - return NS_ERROR_OUT_OF_MEMORY; - } - - NS_ADDREF(*aChildNodes); + NS_ADDREF(*aChildNodes = ChildNodes()); return NS_OK; } @@ -426,65 +422,47 @@ nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK; } -nsresult -nsINode::RemoveChild(nsINode *aOldChild) +nsINode* +nsINode::RemoveChild(nsINode& aOldChild, ErrorResult& aError) { - if (!aOldChild) { - return NS_ERROR_NULL_POINTER; - } - if (IsNodeOfType(eDATA_NODE)) { // aOldChild can't be one of our children. - return NS_ERROR_DOM_NOT_FOUND_ERR; + aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR); + return nullptr; } - if (aOldChild->GetNodeParent() == this) { - nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc()); + if (aOldChild.GetParentNode() == this) { + nsContentUtils::MaybeFireNodeRemoved(&aOldChild, this, OwnerDoc()); } - int32_t index = IndexOf(aOldChild); + int32_t index = IndexOf(&aOldChild); if (index == -1) { // aOldChild isn't one of our children. - return NS_ERROR_DOM_NOT_FOUND_ERR; + aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR); + return nullptr; } RemoveChildAt(index, true); - return NS_OK; -} - -nsresult -nsINode::ReplaceOrInsertBefore(bool aReplace, nsIDOMNode* aNewChild, - nsIDOMNode* aRefChild, nsIDOMNode** aReturn) -{ - nsCOMPtr newChild = do_QueryInterface(aNewChild); - - nsresult rv; - nsCOMPtr refChild; - if (aRefChild) { - refChild = do_QueryInterface(aRefChild, &rv); - NS_ENSURE_SUCCESS(rv, rv); - } - - rv = ReplaceOrInsertBefore(aReplace, newChild, refChild); - if (NS_SUCCEEDED(rv)) { - NS_ADDREF(*aReturn = aReplace ? aRefChild : aNewChild); - } - - return rv; + return &aOldChild; } nsresult nsINode::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { - nsCOMPtr oldChild = do_QueryInterface(aOldChild); - nsresult rv = RemoveChild(oldChild); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr oldChild = do_QueryInterface(aOldChild); + if (!oldChild) { + return NS_ERROR_NULL_POINTER; + } + + ErrorResult rv; + RemoveChild(*oldChild, rv); + if (!rv.Failed()) { NS_ADDREF(*aReturn = aOldChild); } - return rv; + return rv.ErrorCode(); } -nsresult +void nsINode::Normalize() { // First collect list of nodes to be removed @@ -514,7 +492,7 @@ nsINode::Normalize() } if (nodes.IsEmpty()) { - return NS_OK; + return; } // We're relying on mozAutoSubtreeModified to keep the doc alive here. @@ -529,7 +507,7 @@ nsINode::Normalize() HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED); if (hasRemoveListeners) { for (uint32_t i = 0; i < nodes.Length(); ++i) { - nsContentUtils::MaybeFireNodeRemoved(nodes[i], nodes[i]->GetNodeParent(), + nsContentUtils::MaybeFireNodeRemoved(nodes[i], nodes[i]->GetParentNode(), doc); } } @@ -563,7 +541,7 @@ nsINode::Normalize() } // Remove node - nsCOMPtr parent = node->GetNodeParent(); + nsCOMPtr parent = node->GetParentNode(); NS_ASSERTION(parent || hasRemoveListeners, "Should always have a parent unless " "mutation events messed us up"); @@ -571,12 +549,10 @@ nsINode::Normalize() parent->RemoveChildAt(parent->IndexOf(node), true); } } - - return NS_OK; } -nsresult -nsINode::GetDOMBaseURI(nsAString &aURI) const +void +nsINode::GetBaseURI(nsAString &aURI) const { nsCOMPtr baseURI = GetBaseURI(); @@ -586,11 +562,9 @@ nsINode::GetDOMBaseURI(nsAString &aURI) const } CopyUTF8toUTF16(spec, aURI); - - return NS_OK; } -nsresult +void nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix) { Element *element = GetNameSpaceElement(); @@ -620,15 +594,13 @@ nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix) else { SetDOMStringToNull(aPrefix); } - return NS_OK; + return; } } } } SetDOMStringToNull(aPrefix); - - return NS_OK; } static nsresult @@ -690,34 +662,73 @@ nsINode::SetUserData(const nsAString &aKey, nsIVariant *aData, return NS_OK; } -uint16_t -nsINode::CompareDocPosition(nsINode* aOtherNode) +JS::Value +nsINode::SetUserData(JSContext* aCx, const nsAString& aKey, JS::Value aData, + nsIDOMUserDataHandler* aHandler, ErrorResult& aError) { - NS_PRECONDITION(aOtherNode, "don't pass null"); + nsCOMPtr data; + aError = nsContentUtils::XPConnect()->JSValToVariant(aCx, &aData, + getter_AddRefs(data)); + if (aError.Failed()) { + return JS::UndefinedValue(); + } - if (this == aOtherNode) { + nsCOMPtr oldData; + aError = SetUserData(aKey, data, aHandler, getter_AddRefs(oldData)); + if (aError.Failed()) { + return JS::UndefinedValue(); + } + + if (!oldData) { + return JS::NullValue(); + } + + JS::Value result; + aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), oldData, + &result); + return result; +} + +JS::Value +nsINode::GetUserData(JSContext* aCx, const nsAString& aKey, ErrorResult& aError) +{ + nsIVariant* data = GetUserData(aKey); + if (!data) { + return JS::NullValue(); + } + + JS::Value result; + aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), data, + &result); + return result; +} + +uint16_t +nsINode::CompareDocumentPosition(nsINode& aOtherNode) const +{ + if (this == &aOtherNode) { return 0; } - nsAutoTArray parents1, parents2; + nsAutoTArray parents1, parents2; - nsINode *node1 = aOtherNode, *node2 = this; + const nsINode *node1 = &aOtherNode, *node2 = this; // Check if either node is an attribute - nsIAttribute* attr1 = nullptr; + const nsIAttribute* attr1 = nullptr; if (node1->IsNodeOfType(nsINode::eATTRIBUTE)) { - attr1 = static_cast(node1); - nsIContent* elem = attr1->GetContent(); + attr1 = static_cast(node1); + const nsIContent* elem = attr1->GetContent(); // If there is an owner element add the attribute // to the chain and walk up to the element if (elem) { node1 = elem; - parents1.AppendElement(static_cast(attr1)); + parents1.AppendElement(attr1); } } if (node2->IsNodeOfType(nsINode::eATTRIBUTE)) { - nsIAttribute* attr2 = static_cast(node2); - nsIContent* elem = attr2->GetContent(); + const nsIAttribute* attr2 = static_cast(node2); + const nsIContent* elem = attr2->GetContent(); if (elem == node1 && attr1) { // Both nodes are attributes on the same element. // Compare position between the attributes. @@ -742,7 +753,7 @@ nsINode::CompareDocPosition(nsINode* aOtherNode) if (elem) { node2 = elem; - parents2.AppendElement(static_cast(attr2)); + parents2.AppendElement(attr2); } } @@ -754,18 +765,18 @@ nsINode::CompareDocPosition(nsINode* aOtherNode) // Build the chain of parents do { parents1.AppendElement(node1); - node1 = node1->GetNodeParent(); + node1 = node1->GetParentNode(); } while (node1); do { parents2.AppendElement(node2); - node2 = node2->GetNodeParent(); + node2 = node2->GetParentNode(); } while (node2); // Check if the nodes are disconnected. uint32_t pos1 = parents1.Length(); uint32_t pos2 = parents2.Length(); - nsINode* top1 = parents1.ElementAt(--pos1); - nsINode* top2 = parents2.ElementAt(--pos2); + const nsINode* top1 = parents1.ElementAt(--pos1); + const nsINode* top2 = parents2.ElementAt(--pos2); if (top1 != top2) { return top1 < top2 ? (nsIDOMNode::DOCUMENT_POSITION_PRECEDING | @@ -777,11 +788,11 @@ nsINode::CompareDocPosition(nsINode* aOtherNode) } // Find where the parent chain differs and check indices in the parent. - nsINode* parent = top1; + const nsINode* parent = top1; uint32_t len; for (len = NS_MIN(pos1, pos2); len > 0; --len) { - nsINode* child1 = parents1.ElementAt(--pos1); - nsINode* child2 = parents2.ElementAt(--pos2); + const nsINode* child1 = parents1.ElementAt(--pos1); + const nsINode* child2 = parents2.ElementAt(--pos2); if (child1 != child2) { // child1 or child2 can be an attribute here. This will work fine since // IndexOf will return -1 for the attribute making the attribute be @@ -804,7 +815,7 @@ nsINode::CompareDocPosition(nsINode* aOtherNode) } bool -nsINode::IsEqualTo(nsINode* aOther) +nsINode::IsEqualNode(nsINode* aOther) { if (!aOther) { return false; @@ -882,10 +893,8 @@ nsINode::IsEqualTo(nsINode* aOther) NS_ASSERTION(node1 == this && node2 == aOther, "Did we come upon an attribute node while walking a " "subtree?"); - nsCOMPtr domNode1 = do_QueryInterface(node1); - nsCOMPtr domNode2 = do_QueryInterface(node2); - domNode1->GetNodeValue(string1); - domNode2->GetNodeValue(string2); + node1->GetNodeValue(string1); + node2->GetNodeValue(string2); // Returning here as to not bother walking subtree. And there is no // risk that we're half way through walking some other subtree since @@ -957,8 +966,8 @@ nsINode::IsEqualTo(nsINode* aOther) return false; } - node1 = node1->GetNodeParent(); - node2 = node2->GetNodeParent(); + node1 = node1->GetParentNode(); + node2 = node2->GetParentNode(); NS_ASSERTION(node1 && node2, "no parent while walking subtree"); } } @@ -967,7 +976,7 @@ nsINode::IsEqualTo(nsINode* aOther) return false; } -nsresult +void nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI) { @@ -977,8 +986,6 @@ nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix, aNamespaceURI))) { SetDOMStringToNull(aNamespaceURI); } - - return NS_OK; } NS_IMPL_DOMTARGET_DEFAULTS(nsINode) @@ -1238,7 +1245,7 @@ nsINode::SetExplicitBaseURI(nsIURI* aURI) static nsresult AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode) { - NS_ASSERTION(!aNode->GetNodeParent(), + NS_ASSERTION(!aNode->GetParentNode(), "Should have removed from parent already"); nsIDocument *doc = aParent->OwnerDoc(); @@ -1267,7 +1274,7 @@ nsresult nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify, nsAttrAndChildArray& aChildArray) { - NS_PRECONDITION(!aKid->GetNodeParent(), + NS_PRECONDITION(!aKid->GetParentNode(), "Inserting node that already has parent"); nsresult rv; @@ -1309,7 +1316,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex, return rv; } - NS_ASSERTION(aKid->GetNodeParent() == this, + NS_ASSERTION(aKid->GetParentNode() == this, "Did we run script inappropriately?"); if (aNotify) { @@ -1338,7 +1345,7 @@ void nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify, nsIContent* aKid, nsAttrAndChildArray& aChildArray) { - NS_PRECONDITION(aKid && aKid->GetNodeParent() == this && + NS_PRECONDITION(aKid && aKid->GetParentNode() == this && aKid == GetChildAt(aIndex) && IndexOf(aKid) == (int32_t)aIndex, "Bogus aKid"); @@ -1515,24 +1522,23 @@ bool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent, return false; } -nsresult +nsINode* nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, - nsINode* aRefChild) + nsINode* aRefChild, ErrorResult& aError) { // XXXbz I wish I could assert that nsContentUtils::IsSafeToRunScript() so we // could rely on scriptblockers going out of scope to actually run XBL // teardown, but various crud adds nodes under scriptblockers (e.g. native // anonymous content). The only good news is those insertions can't trigger // the bad XBL cases. - if (!aNewChild || (aReplace && !aRefChild)) { - return NS_ERROR_NULL_POINTER; - } + MOZ_ASSERT_IF(aReplace, aRefChild); if ((!IsNodeOfType(eDOCUMENT) && !IsNodeOfType(eDOCUMENT_FRAGMENT) && !IsElement()) || - !aNewChild->IsNodeOfType(eCONTENT)){ - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + !aNewChild->IsNodeOfType(eCONTENT)) { + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } uint16_t nodeType = aNewChild->NodeType(); @@ -1548,8 +1554,9 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // none should be fired. // It's ok that we do the check twice in the case when firing mutation // events as we need to recheck after running script anyway. - if (aRefChild && aRefChild->GetNodeParent() != this) { - return NS_ERROR_DOM_NOT_FOUND_ERR; + if (aRefChild && aRefChild->GetParentNode() != this) { + aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR); + return nullptr; } // If we're replacing, fire for node-to-be-replaced. @@ -1560,7 +1567,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // If the new node already has a parent, fire for removing from old // parent - nsINode* oldParent = aNewChild->GetNodeParent(); + nsINode* oldParent = aNewChild->GetParentNode(); if (oldParent) { nsContentUtils::MaybeFireNodeRemoved(aNewChild, oldParent, aNewChild->OwnerDoc()); @@ -1572,8 +1579,9 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, static_cast(aNewChild)->FireNodeRemovedForChildren(); } // Verify that our aRefChild is still sensible - if (aRefChild && aRefChild->GetNodeParent() != this) { - return NS_ERROR_DOM_NOT_FOUND_ERR; + if (aRefChild && aRefChild->GetParentNode() != this) { + aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR); + return nullptr; } } @@ -1583,12 +1591,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // This is anonymous content. Don't allow its insertion // anywhere, since it might have UnbindFromTree calls coming // its way. - return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); + return nullptr; } // Make sure that the inserted node is allowed as a child of its new parent. if (!IsAllowedAsChild(newContent, this, aReplace, aRefChild)) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // Record the node to insert before, if any @@ -1607,13 +1617,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, Maybe, 50> > fragChildren; // Remove the new child from the old parent if one exists - nsCOMPtr oldParent = newContent->GetNodeParent(); + nsCOMPtr oldParent = newContent->GetParentNode(); if (oldParent) { int32_t removeIndex = oldParent->IndexOf(newContent); if (removeIndex < 0) { // newContent is anonymous. We can't deal with this, so just bail NS_ERROR("How come our flags didn't catch this?"); - return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); + return nullptr; } // Hold a strong ref to nodeToInsertBefore across the removal of newContent @@ -1643,12 +1654,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // Verify that nodeToInsertBefore, if non-null, is still our child. If // it's not, there's no way we can do this insert sanely; just bail out. if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // Verify that newContent has no parent. if (newContent->GetParent()) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // And verify that newContent is still allowed as our child. @@ -1656,12 +1669,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // We've already removed aRefChild. So even if we were doing a replace, // now we're doing a simple insert before nodeToInsertBefore. if (!IsAllowedAsChild(newContent, this, false, nodeToInsertBefore)) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } } else { if ((aRefChild && aRefChild->GetParent() != this) || !IsAllowedAsChild(newContent, this, aReplace, aRefChild)) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // And recompute nodeToInsertBefore, just in case. if (aReplace) { @@ -1715,13 +1730,15 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // Verify that nodeToInsertBefore, if non-null, is still our child. If // it's not, there's no way we can do this insert sanely; just bail out. if (nodeToInsertBefore && nodeToInsertBefore->GetParent() != this) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // Verify that all the things in fragChildren have no parent. for (uint32_t i = 0; i < count; ++i) { if (fragChildren.ref().ElementAt(i)->GetParent()) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } } @@ -1732,7 +1749,8 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, // Verify that our aRefChild is still sensible if (aRefChild && aRefChild->GetParent() != this) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } // Recompute nodeToInsertBefore, just in case. @@ -1753,12 +1771,14 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, if (child->IsElement()) { if (sawElement) { // No good - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } sawElement = true; } if (!IsAllowedAsChild(child, this, aReplace, aRefChild)) { - return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; + aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); + return nullptr; } } } @@ -1777,7 +1797,8 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, insPos = IndexOf(nodeToInsertBefore); if (insPos < 0) { // XXXbz How the heck would _that_ happen, exactly? - return NS_ERROR_DOM_NOT_FOUND_ERR; + aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR); + return nullptr; } } else { @@ -1800,15 +1821,16 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, --insPos; } - nsresult res = NS_OK; // Move new child over to our document if needed. Do this after removing // it from its parent so that AdoptNode doesn't fire DOMNodeRemoved // DocumentType nodes are the only nodes that can have a null // ownerDocument according to the DOM spec, and we need to allow // inserting them w/o calling AdoptNode(). if (!HasSameOwnerDoc(newContent)) { - res = AdoptNodeIntoOwnerDoc(this, aNewChild); - NS_ENSURE_SUCCESS(res, res); + aError = AdoptNodeIntoOwnerDoc(this, aNewChild); + if (aError.Failed()) { + return nullptr; + } } /* @@ -1816,6 +1838,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, * to actually add its children individually (i.e. we don't add the * actual document fragment). */ + nsINode* result = aReplace ? aRefChild : aNewChild; if (nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) { if (!aReplace) { mb.Init(this, true, true); @@ -1829,7 +1852,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, uint32_t count = fragChildren.ref().Length(); if (!count) { - return NS_OK; + return result; } bool appending = @@ -1842,15 +1865,16 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, for (uint32_t i = 0; i < count; ++i, ++insPos) { // XXXbz how come no reparenting here? That seems odd... // Insert the child. - res = InsertChildAt(fragChildren.ref().ElementAt(i), insPos, !appending); - if (NS_FAILED(res)) { + aError = InsertChildAt(fragChildren.ref().ElementAt(i), insPos, + !appending); + if (aError.Failed()) { // Make sure to notify on any children that we did succeed to insert if (appending && i != 0) { nsNodeUtils::ContentAppended(static_cast(this), firstInsertedContent, firstInsPos); } - return res; + return nullptr; } } @@ -1885,21 +1909,47 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, mb.SetPrevSibling(GetChildAt(insPos - 1)); mb.SetNextSibling(GetChildAt(insPos)); } - res = InsertChildAt(newContent, insPos, true); - NS_ENSURE_SUCCESS(res, res); + aError = InsertChildAt(newContent, insPos, true); + if (aError.Failed()) { + return nullptr; + } } - return NS_OK; + return result; +} + +nsresult +nsINode::ReplaceOrInsertBefore(bool aReplace, nsIDOMNode *aNewChild, + nsIDOMNode *aRefChild, nsIDOMNode **aReturn) +{ + nsCOMPtr newChild = do_QueryInterface(aNewChild); + if (!newChild) { + return NS_ERROR_NULL_POINTER; + } + + if (aReplace && !aRefChild) { + return NS_ERROR_NULL_POINTER; + } + + nsCOMPtr refChild = do_QueryInterface(aRefChild); + if (aRefChild && !refChild) { + return NS_NOINTERFACE; + } + + ErrorResult rv; + nsINode* result = ReplaceOrInsertBefore(aReplace, newChild, refChild, rv); + if (result) { + NS_ADDREF(*aReturn = result->AsDOMNode()); + } + return rv.ErrorCode(); } nsresult nsINode::CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aReturn) { nsCOMPtr other = do_QueryInterface(aOther); - if (!other) { - return NS_ERROR_NULL_POINTER; - } - *aReturn = CompareDocPosition(other); + NS_ENSURE_ARG(other); + *aReturn = CompareDocumentPosition(*other); return NS_OK; } @@ -1907,7 +1957,7 @@ nsresult nsINode::IsEqualNode(nsIDOMNode* aOther, bool* aReturn) { nsCOMPtr other = do_QueryInterface(aOther); - *aReturn = IsEqualTo(other); + *aReturn = IsEqualNode(other); return NS_OK; } @@ -2241,3 +2291,80 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, return FindMatchingElements(this, aSelector, *contentList); } +JSObject* +nsINode::WrapObject(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) +{ + // Not all nodes have been converted + if (!IsDOMBinding()) { + *aTriedToWrap = false; + return nullptr; + } + + // Make sure one of these is true + // (1) our owner document has a script handling object, + // (2) Our owner document has had a script handling object, or has been marked + // to have had one, + // (3) we are running a privileged script. + // Event handling is possible only if (1). If (2) event handling is + // prevented. + // If the document has never had a script handling object, untrusted + // scripts (3) shouldn't touch it! + bool hasHadScriptHandlingObject = false; + bool enabled; + nsIScriptSecurityManager* securityManager; + if (!OwnerDoc()->GetScriptHandlingObject(hasHadScriptHandlingObject) && + !hasHadScriptHandlingObject && + !((securityManager = nsContentUtils::GetSecurityManager()) && + NS_SUCCEEDED(securityManager->IsCapabilityEnabled("UniversalXPConnect", + &enabled)) && + enabled)) { + Throw(aCx, NS_ERROR_UNEXPECTED); + *aTriedToWrap = true; + return nullptr; + } + + return WrapNode(aCx, aScope, aTriedToWrap); +} + +bool +nsINode::IsSupported(const nsAString& aFeature, const nsAString& aVersion) +{ + return nsContentUtils::InternalIsSupported(this, aFeature, aVersion); +} + +nsGenericElement* +nsINode::GetParentElement() const +{ + return static_cast(GetElementParent()); +} + +already_AddRefed +nsINode::CloneNode(bool aDeep, ErrorResult& aError) +{ + bool callUserDataHandlers = NodeType() != nsIDOMNode::DOCUMENT_NODE || + !static_cast(this)->CreatingStaticClone(); + + nsCOMPtr result; + aError = nsNodeUtils::CloneNodeImpl(this, aDeep, callUserDataHandlers, + getter_AddRefs(result)); + return result.forget(); +} + +nsDOMAttributeMap* +nsINode::GetAttributes() +{ + if (!IsElement()) { + return nullptr; + } + return static_cast(nsINode::AsElement())->GetAttributes(); +} + +nsresult +nsINode::GetAttributes(nsIDOMNamedNodeMap** aAttributes) +{ + if (!IsElement()) { + *aAttributes = nullptr; + return NS_OK; + } + return CallQueryInterface(GetAttributes(), aAttributes); +} diff --git a/content/base/src/nsNodeInfo.cpp b/content/base/src/nsNodeInfo.cpp index 8b1c64a1a9f..4c16ff88109 100644 --- a/content/base/src/nsNodeInfo.cpp +++ b/content/base/src/nsNodeInfo.cpp @@ -107,6 +107,11 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID, mInner.mName->ToString(mQualifiedName); } + MOZ_ASSERT_IF(aNodeType != nsIDOMNode::ELEMENT_NODE && + aNodeType != nsIDOMNode::ATTRIBUTE_NODE && + aNodeType != UINT16_MAX, + aNamespaceID == kNameSpaceID_None && !aPrefix); + switch (aNodeType) { case nsIDOMNode::ELEMENT_NODE: case nsIDOMNode::ATTRIBUTE_NODE: diff --git a/content/base/src/nsNodeIterator.cpp b/content/base/src/nsNodeIterator.cpp index 25c7117f0fa..f8ecd57d187 100644 --- a/content/base/src/nsNodeIterator.cpp +++ b/content/base/src/nsNodeIterator.cpp @@ -62,7 +62,7 @@ bool nsNodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot) if (mNode == aRoot) return false; - MoveBackward(mNode->GetNodeParent(), mNode->GetPreviousSibling()); + MoveBackward(mNode->GetParentNode(), mNode->GetPreviousSibling()); return true; } @@ -113,7 +113,7 @@ bool nsNodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode) mNode = sibling; return true; } - aNode = aNode->GetNodeParent(); + aNode = aNode->GetParentNode(); } return false; diff --git a/content/base/src/nsNodeUtils.cpp b/content/base/src/nsNodeUtils.cpp index 4aa772a3c88..ef258aff1cf 100644 --- a/content/base/src/nsNodeUtils.cpp +++ b/content/base/src/nsNodeUtils.cpp @@ -58,7 +58,7 @@ using namespace mozilla::dom; slots->mMutationObservers, nsIMutationObserver, \ func_, params_); \ } \ - node = node->GetNodeParent(); \ + node = node->GetParentNode(); \ } while (node); \ if (needsEnterLeave) { \ nsDOMMutationObserver::LeaveMutationHandling(); \ @@ -359,11 +359,11 @@ nsNodeUtils::TraverseUserData(nsINode* aNode, nsresult nsNodeUtils::CloneNodeImpl(nsINode *aNode, bool aDeep, bool aCallUserDataHandlers, - nsIDOMNode **aResult) + nsINode **aResult) { *aResult = nullptr; - nsCOMPtr newNode; + nsCOMPtr newNode; nsCOMArray nodesWithProperties; nsresult rv = Clone(aNode, aDeep, nullptr, nodesWithProperties, getter_AddRefs(newNode)); diff --git a/content/base/src/nsNodeUtils.h b/content/base/src/nsNodeUtils.h index c7488156d88..15abe70bcfe 100644 --- a/content/base/src/nsNodeUtils.h +++ b/content/base/src/nsNodeUtils.h @@ -150,10 +150,10 @@ public: static nsresult Clone(nsINode *aNode, bool aDeep, nsNodeInfoManager *aNewNodeInfoManager, nsCOMArray &aNodesWithProperties, - nsIDOMNode **aResult) + nsINode **aResult) { return CloneAndAdopt(aNode, true, aDeep, aNewNodeInfoManager, nullptr, - nullptr, aNodesWithProperties, aResult); + nullptr, aNodesWithProperties, nullptr, aResult); } /** @@ -179,9 +179,10 @@ public: JSContext *aCx, JSObject *aNewScope, nsCOMArray &aNodesWithProperties) { + nsCOMPtr node; nsresult rv = CloneAndAdopt(aNode, false, true, aNewNodeInfoManager, aCx, aNewScope, aNodesWithProperties, - nullptr); + nullptr, getter_AddRefs(node)); nsMutationGuard::DidMutate(); @@ -228,7 +229,7 @@ public: */ static nsresult CloneNodeImpl(nsINode *aNode, bool aDeep, bool aCallUserDataHandlers, - nsIDOMNode **aResult); + nsINode **aResult); /** * Release the UserData and UserDataHandlers for aNode. @@ -263,31 +264,6 @@ private: * descendants) with properties. If aClone is * true every node will be followed by its * clone. - * @param aResult If aClone is false then aResult must be null, else - * *aResult will contain the cloned node. - */ - static nsresult CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep, - nsNodeInfoManager *aNewNodeInfoManager, - JSContext *aCx, JSObject *aNewScope, - nsCOMArray &aNodesWithProperties, - nsIDOMNode **aResult) - { - NS_ASSERTION(!aClone == !aResult, - "aResult must be null when adopting and non-null when " - "cloning"); - - nsCOMPtr clone; - nsresult rv = CloneAndAdopt(aNode, aClone, aDeep, aNewNodeInfoManager, - aCx, aNewScope, aNodesWithProperties, - nullptr, getter_AddRefs(clone)); - NS_ENSURE_SUCCESS(rv, rv); - - return clone ? CallQueryInterface(clone, aResult) : NS_OK; - } - - /** - * See above for arguments that aren't described here. - * * @param aParent If aClone is true the cloned node will be appended to * aParent's children. May be null. If not null then aNode * must be an nsIContent. diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index a4752ac2bd0..6804368c947 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -100,7 +100,7 @@ nsRange::CompareNodeToRange(nsINode* aNode, nsRange* aRange, // gather up the dom point info int32_t nodeStart, nodeEnd; - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (!parent) { // can't make a parent/offset pair to represent start or // end of the root node, because it has no parent. @@ -173,7 +173,7 @@ GetNextRangeCommonAncestor(nsINode* aNode) if (!aNode->IsDescendantOfCommonAncestorForRangeInSelection()) { return nullptr; } - aNode = aNode->GetNodeParent(); + aNode = aNode->GetParentNode(); } return aNode; } @@ -188,7 +188,7 @@ nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset, nsINode* n = GetNextRangeCommonAncestor(aNode); NS_ASSERTION(n || !aNode->IsSelectionDescendant(), "orphan selection descendant"); - for (; n; n = GetNextRangeCommonAncestor(n->GetNodeParent())) { + for (; n; n = GetNextRangeCommonAncestor(n->GetParentNode())) { RangeHashTable* ranges = static_cast(n->GetProperty(nsGkAtoms::range)); ranges->EnumerateEntries(FindSelectedRange, &data); @@ -422,7 +422,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument, // did so too (otherwise the range would end up with disconnected nodes). if (aContent == mEndParent && aInfo->mChangeStart < static_cast(mEndOffset)) { - if (aInfo->mDetails && (aContent->GetNodeParent() || newStartNode)) { + if (aInfo->mDetails && (aContent->GetParentNode() || newStartNode)) { // splitText(), aInfo->mDetails->mNextSibling is the new text node NS_ASSERTION(aInfo->mDetails->mType == CharacterDataChangeInfo::Details::eSplit, @@ -436,7 +436,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument, if (isCommonAncestor && !newStartNode) { // The split occurs inside the range. UnregisterCommonAncestor(mStartParent); - RegisterCommonAncestor(mStartParent->GetNodeParent()); + RegisterCommonAncestor(mStartParent->GetParentNode()); newEndNode->SetDescendantOfCommonAncestorForRangeInSelection(); } else if (mEndParent->IsDescendantOfCommonAncestorForRangeInSelection()) { newEndNode->SetDescendantOfCommonAncestorForRangeInSelection(); @@ -480,7 +480,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument, } DoSetRange(newStartNode, newStartOffset, newEndNode, newEndOffset, newRoot ? newRoot : mRoot.get(), - !newEndNode->GetNodeParent() || !newStartNode->GetNodeParent()); + !newEndNode->GetParentNode() || !newStartNode->GetParentNode()); } } @@ -662,7 +662,7 @@ nsRange::IntersectsNode(nsIDOMNode* aNode, bool* aResult) NS_ENSURE_TRUE(mIsPositioned, NS_ERROR_NOT_INITIALIZED); // Step 3. - nsINode* parent = node->GetNodeParent(); + nsINode* parent = node->GetParentNode(); if (!parent) { // Steps 2 and 4. // |parent| is null, so |node|'s root is |node| itself. @@ -720,7 +720,7 @@ nsRange::DoSetRange(nsINode* aStartN, int32_t aStartOffset, static_cast(aStartN)->GetBindingParent() && aRoot == static_cast(aEndN)->GetBindingParent()) || - (!aRoot->GetNodeParent() && + (!aRoot->GetParentNode() && (aRoot->IsNodeOfType(nsINode::eDOCUMENT) || aRoot->IsNodeOfType(nsINode::eATTRIBUTE) || aRoot->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) || @@ -774,7 +774,7 @@ IndexOf(nsIDOMNode* aChildNode) return -1; } - nsINode *parent = child->GetNodeParent(); + nsINode *parent = child->GetParentNode(); // finally we get the index return parent ? parent->IndexOf(child) : -1; @@ -895,7 +895,7 @@ nsRange::IsValidBoundary(nsINode* aNode) } root = aNode; - while ((aNode = aNode->GetNodeParent())) { + while ((aNode = aNode->GetParentNode())) { root = aNode; } @@ -1062,7 +1062,7 @@ nsRange::SelectNode(nsIDOMNode* aN) nsCOMPtr node = do_QueryInterface(aN); NS_ENSURE_TRUE(node, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR); - nsINode* parent = node->GetNodeParent(); + nsINode* parent = node->GetParentNode(); nsINode* newRoot = IsValidBoundary(parent); NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR); @@ -1439,19 +1439,6 @@ CollapseRangeAfterDelete(nsIDOMRange *aRange) return aRange->Collapse(false); } -/** - * Remove a node from the DOM entirely. - * - * @param aNode The node to remove. - */ -static nsresult -RemoveNode(nsIDOMNode* aNode) -{ - nsCOMPtr node = do_QueryInterface(aNode); - nsCOMPtr parent = node->GetNodeParent(); - return parent ? parent->RemoveChild(node) : NS_OK; -} - /** * Split a data node into two parts. * @@ -1760,8 +1747,13 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment) ValidateCurrentNode(this, iter)); } else if (nodeToResult) { nsMutationGuard guard; - rv = RemoveNode(nodeToResult); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr node = do_QueryInterface(nodeToResult); + nsINode* parent = node->GetParentNode(); + if (parent) { + mozilla::ErrorResult error; + parent->RemoveChild(*node, error); + NS_ENSURE_FALSE(error.Failed(), error.ErrorCode()); + } NS_ENSURE_STATE(!guard.Mutated(1) || ValidateCurrentNode(this, iter)); } @@ -2195,8 +2187,8 @@ nsRange::SurroundContents(nsIDOMNode* aNewParent) if (mStartParent != mEndParent) { bool startIsText = mStartParent->IsNodeOfType(nsINode::eTEXT); bool endIsText = mEndParent->IsNodeOfType(nsINode::eTEXT); - nsINode* startGrandParent = mStartParent->GetNodeParent(); - nsINode* endGrandParent = mEndParent->GetNodeParent(); + nsINode* startGrandParent = mStartParent->GetParentNode(); + nsINode* endGrandParent = mEndParent->GetParentNode(); NS_ENSURE_TRUE((startIsText && endIsText && startGrandParent && startGrandParent == endGrandParent) || @@ -2630,7 +2622,7 @@ nsRange::GetRegisteredCommonAncestor() if (ranges->GetEntry(this)) { break; } - ancestor = GetNextRangeCommonAncestor(ancestor->GetNodeParent()); + ancestor = GetNextRangeCommonAncestor(ancestor->GetParentNode()); } NS_ASSERTION(ancestor, "can't find common ancestor for selected range"); return ancestor; diff --git a/content/base/src/nsTextNode.h b/content/base/src/nsTextNode.h index 2a039062e6f..b10a27c6d30 100644 --- a/content/base/src/nsTextNode.h +++ b/content/base/src/nsTextNode.h @@ -24,7 +24,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) diff --git a/content/base/src/nsTreeSanitizer.cpp b/content/base/src/nsTreeSanitizer.cpp index 3109cdaf0bc..78f3af8b442 100644 --- a/content/base/src/nsTreeSanitizer.cpp +++ b/content/base/src/nsTreeSanitizer.cpp @@ -1413,7 +1413,7 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot) RemoveAllAttributes(descendant); } nsIContent* next = node->GetNextNonChildNode(aRoot); - node->GetParent()->RemoveChild(node); + node->RemoveFromParent(); node = next; continue; } @@ -1459,14 +1459,14 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot) nsIContent* next = node->GetNextNode(aRoot); nsIContent* parent = node->GetParent(); nsCOMPtr child; // Must keep the child alive during move - nsresult rv; + ErrorResult rv; while ((child = node->GetFirstChild())) { - parent->InsertBefore(child, node, &rv); - if (NS_FAILED(rv)) { + parent->InsertBefore(*child, node, rv); + if (rv.Failed()) { break; } } - parent->RemoveChild(node); + node->RemoveFromParent(); node = next; continue; } @@ -1502,7 +1502,7 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot) NS_ASSERTION(!node->GetFirstChild(), "How come non-element node had kids?"); nsIContent* next = node->GetNextNonChildNode(aRoot); if (!mAllowComments && node->IsNodeOfType(nsINode::eCOMMENT)) { - node->GetNodeParent()->RemoveChild(node); + node->RemoveFromParent(); } node = next; } diff --git a/content/base/src/nsTreeWalker.cpp b/content/base/src/nsTreeWalker.cpp index 03ab05a9e2a..a2cbd9473a7 100644 --- a/content/base/src/nsTreeWalker.cpp +++ b/content/base/src/nsTreeWalker.cpp @@ -135,7 +135,7 @@ NS_IMETHODIMP nsTreeWalker::ParentNode(nsIDOMNode **_retval) nsCOMPtr node = mCurrentNode; while (node && node != mRoot) { - node = node->GetNodeParent(); + node = node->GetParentNode(); if (node) { int16_t filtered; @@ -209,7 +209,7 @@ NS_IMETHODIMP nsTreeWalker::PreviousNode(nsIDOMNode **_retval) if (node == mRoot) break; - node = node->GetNodeParent(); + node = node->GetParentNode(); if (!node) break; @@ -262,7 +262,7 @@ NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval) if (sibling) break; - temp = temp->GetNodeParent(); + temp = temp->GetParentNode(); } while (temp); if (!sibling) @@ -336,7 +336,7 @@ nsresult nsTreeWalker::FirstChildInternal(bool aReversed, nsIDOMNode **_retval) break; } - nsINode *parent = node->GetNodeParent(); + nsINode *parent = node->GetParentNode(); if (!parent || parent == mRoot || parent == mCurrentNode) { return NS_OK; @@ -394,7 +394,7 @@ nsresult nsTreeWalker::NextSiblingInternal(bool aReversed, nsIDOMNode **_retval) } } - node = node->GetNodeParent(); + node = node->GetParentNode(); if (!node || node == mRoot) return NS_OK; diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index d14faa577ec..7e0f82d5533 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -1214,7 +1214,7 @@ nsXMLContentSerializer::MaybeAddNewlineForRootNode(nsAString& aStr) void nsXMLContentSerializer::MaybeFlagNewlineForRootNode(nsINode* aNode) { - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); if (parent) { mAddNewlineForRootNode = parent->IsNodeOfType(nsINode::eDOCUMENT); } diff --git a/content/events/src/nsIMEStateManager.cpp b/content/events/src/nsIMEStateManager.cpp index 9bc10d6654e..2c61e984763 100644 --- a/content/events/src/nsIMEStateManager.cpp +++ b/content/events/src/nsIMEStateManager.cpp @@ -901,7 +901,7 @@ static nsINode* GetRootEditableNode(nsPresContext* aPresContext, nsINode* node = aContent; while (node && IsEditable(node)) { root = node; - node = node->GetNodeParent(); + node = node->GetParentNode(); } return root; } diff --git a/content/events/src/nsXMLEventsElement.cpp b/content/events/src/nsXMLEventsElement.cpp index fbd36dff601..39c11f4369b 100644 --- a/content/events/src/nsXMLEventsElement.cpp +++ b/content/events/src/nsXMLEventsElement.cpp @@ -11,7 +11,6 @@ class nsXMLEventsElement : public nsXMLElement { public: nsXMLEventsElement(already_AddRefed aNodeInfo); virtual ~nsXMLEventsElement(); - NS_FORWARD_NSIDOMNODE(nsXMLElement::) virtual nsIAtom *GetIDAttributeName() const; virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName, diff --git a/content/html/content/public/nsHTMLAudioElement.h b/content/html/content/public/nsHTMLAudioElement.h index f76f96a3814..2d4e6f5c83b 100644 --- a/content/html/content/public/nsHTMLAudioElement.h +++ b/content/html/content/public/nsHTMLAudioElement.h @@ -25,7 +25,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::) diff --git a/content/html/content/public/nsHTMLCanvasElement.h b/content/html/content/public/nsHTMLCanvasElement.h index 9212ff642ff..e21e3f69299 100644 --- a/content/html/content/public/nsHTMLCanvasElement.h +++ b/content/html/content/public/nsHTMLCanvasElement.h @@ -51,7 +51,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/public/nsHTMLVideoElement.h b/content/html/content/public/nsHTMLVideoElement.h index ea57c61c2d1..787b9c3917b 100644 --- a/content/html/content/public/nsHTMLVideoElement.h +++ b/content/html/content/public/nsHTMLVideoElement.h @@ -28,7 +28,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index ad68b4f632c..d67d9a4bb4a 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1241,7 +1241,7 @@ Serialize(Element* aRoot, bool aDescendentsOnly, nsAString& aOut) break; } - current = current->GetNodeParent(); + current = current->GetParentNode(); if (aDescendentsOnly && current == aRoot) { return builder.ToString(aOut); } @@ -1392,9 +1392,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML, // listeners on the fragment that comes from the parser. nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker; - nsresult rv = NS_OK; - static_cast(this)->AppendChild(fragment, &rv); - aError = rv; + static_cast(this)->AppendChild(*fragment, aError); mb.NodesAdded(); } } @@ -1403,7 +1401,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML, NS_IMETHODIMP nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML) { - nsCOMPtr parent = GetNodeParent(); + nsCOMPtr parent = GetParentNode(); if (!parent) { return NS_OK; } @@ -1437,8 +1435,9 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML) eCompatibility_NavQuirks, true); nsAutoMutationBatch mb(parent, true, false); - parent->ReplaceChild(fragment, this, &rv); - return rv; + ErrorResult error; + parent->ReplaceChild(*fragment, *this, error); + return error.ErrorCode(); } nsCOMPtr context; @@ -1463,8 +1462,9 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML) NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr fragment = do_QueryInterface(df); nsAutoMutationBatch mb(parent, true, false); - parent->ReplaceChild(fragment, this, &rv); - return rv; + ErrorResult error; + parent->ReplaceChild(*fragment, *this, error); + return error.ErrorCode(); } enum nsAdjacentPosition { @@ -1551,22 +1551,23 @@ nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition, // listeners on the fragment that comes from the parser. nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker; + ErrorResult error; nsAutoMutationBatch mb(destination, true, false); switch (position) { case eBeforeBegin: - destination->InsertBefore(fragment, this, &rv); + destination->InsertBefore(*fragment, this, error); break; case eAfterBegin: - static_cast(this)->InsertBefore(fragment, GetFirstChild(), &rv); + static_cast(this)->InsertBefore(*fragment, GetFirstChild(), error); break; case eBeforeEnd: - static_cast(this)->AppendChild(fragment, &rv); + static_cast(this)->AppendChild(*fragment, error); break; case eAfterEnd: - destination->InsertBefore(fragment, GetNextSibling(), &rv); + destination->InsertBefore(*fragment, GetNextSibling(), error); break; } - return rv; + return error.ErrorCode(); } nsresult @@ -4232,13 +4233,14 @@ nsGenericHTMLElement::SetItemValue(nsIVariant* aValue) void nsGenericHTMLElement::GetItemValueText(nsAString& text) { - GetTextContent(text); + GetTextContentInternal(text); } void nsGenericHTMLElement::SetItemValueText(const nsAString& text) { - SetTextContent(text); + mozilla::ErrorResult rv; + SetTextContentInternal(text, rv); } static void diff --git a/content/html/content/src/nsHTMLAnchorElement.cpp b/content/html/content/src/nsHTMLAnchorElement.cpp index da7cbf47b7f..db5c685553c 100644 --- a/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/content/html/content/src/nsHTMLAnchorElement.cpp @@ -35,7 +35,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLAreaElement.cpp b/content/html/content/src/nsHTMLAreaElement.cpp index 17bdf336e2b..fa01b182217 100644 --- a/content/html/content/src/nsHTMLAreaElement.cpp +++ b/content/html/content/src/nsHTMLAreaElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_SIZEOF_EXCLUDING_THIS // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index e9c41035244..285509ff9ae 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index fd85ac9a816..c79ae3d9b8c 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -62,7 +62,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index c4aa00d95d3..ac37f6d9622 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -63,7 +63,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLDataListElement.cpp b/content/html/content/src/nsHTMLDataListElement.cpp index c2b658dcbbb..8a9c7089718 100644 --- a/content/html/content/src/nsHTMLDataListElement.cpp +++ b/content/html/content/src/nsHTMLDataListElement.cpp @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLDivElement.cpp b/content/html/content/src/nsHTMLDivElement.cpp index 6abfbc9e999..92535700c30 100644 --- a/content/html/content/src/nsHTMLDivElement.cpp +++ b/content/html/content/src/nsHTMLDivElement.cpp @@ -25,7 +25,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLElement.cpp b/content/html/content/src/nsHTMLElement.cpp index d3786bdd7bb..733d33bbf3b 100644 --- a/content/html/content/src/nsHTMLElement.cpp +++ b/content/html/content/src/nsHTMLElement.cpp @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLFieldSetElement.h b/content/html/content/src/nsHTMLFieldSetElement.h index ad6907efd98..f6c1a15645b 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.h +++ b/content/html/content/src/nsHTMLFieldSetElement.h @@ -34,7 +34,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 3a2491006d8..23de04f8d9f 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -31,7 +31,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 278f353a3f6..8c7f715fc71 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -526,7 +526,7 @@ nsHTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent) nsINode* ancestor = this; nsINode* cur; do { - cur = ancestor->GetNodeParent(); + cur = ancestor->GetParentNode(); if (!cur) { break; } diff --git a/content/html/content/src/nsHTMLFormElement.h b/content/html/content/src/nsHTMLFormElement.h index 63a03ac270f..258812c80ae 100644 --- a/content/html/content/src/nsHTMLFormElement.h +++ b/content/html/content/src/nsHTMLFormElement.h @@ -40,7 +40,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLFrameElement.cpp b/content/html/content/src/nsHTMLFrameElement.cpp index 4de5cf9ad7d..4e0c45fd9bd 100644 --- a/content/html/content/src/nsHTMLFrameElement.cpp +++ b/content/html/content/src/nsHTMLFrameElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::) diff --git a/content/html/content/src/nsHTMLFrameSetElement.h b/content/html/content/src/nsHTMLFrameSetElement.h index 213c2e0e2d4..7e09d400213 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.h +++ b/content/html/content/src/nsHTMLFrameSetElement.h @@ -51,7 +51,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index 5b124ca3eed..85bdcc3eb44 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -30,7 +30,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLHeadingElement.cpp b/content/html/content/src/nsHTMLHeadingElement.cpp index cffd38bfc24..be3e4f61b22 100644 --- a/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/content/html/content/src/nsHTMLHeadingElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLIFrameElement.h b/content/html/content/src/nsHTMLIFrameElement.h index 0decc95ccdd..9fa8894e92a 100644 --- a/content/html/content/src/nsHTMLIFrameElement.h +++ b/content/html/content/src/nsHTMLIFrameElement.h @@ -21,7 +21,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::) diff --git a/content/html/content/src/nsHTMLImageElement.h b/content/html/content/src/nsHTMLImageElement.h index 3223823b8a1..a7d5febd831 100644 --- a/content/html/content/src/nsHTMLImageElement.h +++ b/content/html/content/src/nsHTMLImageElement.h @@ -24,7 +24,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index 65be6976ff6..36f5176ff51 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -69,7 +69,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index 365902cc7db..95048e607df 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLLabelElement.h b/content/html/content/src/nsHTMLLabelElement.h index db01973b1fc..f4d3b74b629 100644 --- a/content/html/content/src/nsHTMLLabelElement.h +++ b/content/html/content/src/nsHTMLLabelElement.h @@ -32,7 +32,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLLegendElement.h b/content/html/content/src/nsHTMLLegendElement.h index 7b17d903e94..76492e8cffb 100644 --- a/content/html/content/src/nsHTMLLegendElement.h +++ b/content/html/content/src/nsHTMLLegendElement.h @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index 25c4b0e13e3..664b6aa08a6 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -46,7 +46,7 @@ public: nsGenericHTMLElement) // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp index bf9bc05ae67..7d53edb816e 100644 --- a/content/html/content/src/nsHTMLMapElement.cpp +++ b/content/html/content/src/nsHTMLMapElement.cpp @@ -21,7 +21,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLMenuElement.h b/content/html/content/src/nsHTMLMenuElement.h index 6933d717205..9e06c488668 100644 --- a/content/html/content/src/nsHTMLMenuElement.h +++ b/content/html/content/src/nsHTMLMenuElement.h @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLMenuItemElement.h b/content/html/content/src/nsHTMLMenuItemElement.h index b29afc2ac26..e0ad0ade0d7 100644 --- a/content/html/content/src/nsHTMLMenuItemElement.h +++ b/content/html/content/src/nsHTMLMenuItemElement.h @@ -31,7 +31,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLMetaElement.cpp b/content/html/content/src/nsHTMLMetaElement.cpp index f82bafa21b2..3f3854a254f 100644 --- a/content/html/content/src/nsHTMLMetaElement.cpp +++ b/content/html/content/src/nsHTMLMetaElement.cpp @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLMeterElement.cpp b/content/html/content/src/nsHTMLMeterElement.cpp index ff49435922a..e3d9599e491 100644 --- a/content/html/content/src/nsHTMLMeterElement.cpp +++ b/content/html/content/src/nsHTMLMeterElement.cpp @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED /* nsIDOMNode */ - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE /* nsIDOMElement */ NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLModElement.cpp b/content/html/content/src/nsHTMLModElement.cpp index 7de9025ef7c..07af1cc7b8b 100644 --- a/content/html/content/src/nsHTMLModElement.cpp +++ b/content/html/content/src/nsHTMLModElement.cpp @@ -20,7 +20,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLOListElement.cpp b/content/html/content/src/nsHTMLOListElement.cpp index 3cab8f7cb44..c697c3d76ae 100644 --- a/content/html/content/src/nsHTMLOListElement.cpp +++ b/content/html/content/src/nsHTMLOListElement.cpp @@ -31,7 +31,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index b79030dd753..b58db23c38b 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -43,7 +43,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLOptGroupElement.h b/content/html/content/src/nsHTMLOptGroupElement.h index 900322dcaad..abe54a8f886 100644 --- a/content/html/content/src/nsHTMLOptGroupElement.h +++ b/content/html/content/src/nsHTMLOptGroupElement.h @@ -20,7 +20,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLOptionElement.h b/content/html/content/src/nsHTMLOptionElement.h index 56de231384e..d6d0a9333d8 100644 --- a/content/html/content/src/nsHTMLOptionElement.h +++ b/content/html/content/src/nsHTMLOptionElement.h @@ -33,7 +33,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLOutputElement.cpp b/content/html/content/src/nsHTMLOutputElement.cpp index 3b3581abd21..71f56dfa797 100644 --- a/content/html/content/src/nsHTMLOutputElement.cpp +++ b/content/html/content/src/nsHTMLOutputElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLParagraphElement.cpp b/content/html/content/src/nsHTMLParagraphElement.cpp index 3f824ae1520..21561eb1e2f 100644 --- a/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/content/html/content/src/nsHTMLParagraphElement.cpp @@ -28,7 +28,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLPreElement.cpp b/content/html/content/src/nsHTMLPreElement.cpp index b38ef0ee180..9f0ba011b1d 100644 --- a/content/html/content/src/nsHTMLPreElement.cpp +++ b/content/html/content/src/nsHTMLPreElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLProgressElement.cpp b/content/html/content/src/nsHTMLProgressElement.cpp index 07123272269..d907413e6b8 100644 --- a/content/html/content/src/nsHTMLProgressElement.cpp +++ b/content/html/content/src/nsHTMLProgressElement.cpp @@ -21,7 +21,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index f69d2b0ec0e..d293575e7d1 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -43,7 +43,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLSelectElement.h b/content/html/content/src/nsHTMLSelectElement.h index 68c4a8b4ce5..468a3db20dd 100644 --- a/content/html/content/src/nsHTMLSelectElement.h +++ b/content/html/content/src/nsHTMLSelectElement.h @@ -248,7 +248,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLSharedElement.cpp b/content/html/content/src/nsHTMLSharedElement.cpp index e2cfda9e049..67d065a59f6 100644 --- a/content/html/content/src/nsHTMLSharedElement.cpp +++ b/content/html/content/src/nsHTMLSharedElement.cpp @@ -41,7 +41,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index 56a8b4a27e4..a8b97ca959f 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -38,7 +38,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLSourceElement.cpp b/content/html/content/src/nsHTMLSourceElement.cpp index 64e4a24b08a..1c7d93c2cd0 100644 --- a/content/html/content/src/nsHTMLSourceElement.cpp +++ b/content/html/content/src/nsHTMLSourceElement.cpp @@ -25,7 +25,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLSpanElement.cpp b/content/html/content/src/nsHTMLSpanElement.cpp index e893631bfa2..9c35d95f6b0 100644 --- a/content/html/content/src/nsHTMLSpanElement.cpp +++ b/content/html/content/src/nsHTMLSpanElement.cpp @@ -21,7 +21,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLStyleElement.cpp b/content/html/content/src/nsHTMLStyleElement.cpp index deb7140c74b..f974b75377e 100644 --- a/content/html/content/src/nsHTMLStyleElement.cpp +++ b/content/html/content/src/nsHTMLStyleElement.cpp @@ -38,7 +38,7 @@ public: nsGenericHTMLElement) // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index 572e9f6c630..f561bdbf284 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index 9ce90ca6dc3..ab57ddbfc4f 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -33,7 +33,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableColElement.cpp b/content/html/content/src/nsHTMLTableColElement.cpp index 13436ec6107..eab08677a55 100644 --- a/content/html/content/src/nsHTMLTableColElement.cpp +++ b/content/html/content/src/nsHTMLTableColElement.cpp @@ -31,7 +31,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableElement.h b/content/html/content/src/nsHTMLTableElement.h index 4b054d15eaf..6f0b4f03a95 100644 --- a/content/html/content/src/nsHTMLTableElement.h +++ b/content/html/content/src/nsHTMLTableElement.h @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index c362621b7a4..d7f80b34f37 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -33,7 +33,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTableSectionElement.cpp b/content/html/content/src/nsHTMLTableSectionElement.cpp index e42cae49bfa..37e0d8e26e8 100644 --- a/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -32,7 +32,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index ef7e89b8ff4..064b4d6263d 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -71,7 +71,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) diff --git a/content/html/content/src/nsHTMLTitleElement.cpp b/content/html/content/src/nsHTMLTitleElement.cpp index f752a813b0f..964fda4424a 100644 --- a/content/html/content/src/nsHTMLTitleElement.cpp +++ b/content/html/content/src/nsHTMLTitleElement.cpp @@ -25,7 +25,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/content/src/nsHTMLUnknownElement.cpp b/content/html/content/src/nsHTMLUnknownElement.cpp index 1ef1219c069..5ae40daf82e 100644 --- a/content/html/content/src/nsHTMLUnknownElement.cpp +++ b/content/html/content/src/nsHTMLUnknownElement.cpp @@ -17,7 +17,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) diff --git a/content/html/document/src/ImageDocument.cpp b/content/html/document/src/ImageDocument.cpp index 7993afe9643..02e8838431b 100644 --- a/content/html/document/src/ImageDocument.cpp +++ b/content/html/document/src/ImageDocument.cpp @@ -641,7 +641,9 @@ ImageDocument::CreateSyntheticDocument() nsRefPtr styleContent = NS_NewHTMLStyleElement(nodeInfo.forget()); NS_ENSURE_TRUE(styleContent, NS_ERROR_OUT_OF_MEMORY); - styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }")); + ErrorResult error; + styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"), + error); head->AppendChildTo(styleContent, false); } diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 17d97ffcae3..944b3575a45 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -87,7 +87,7 @@ public: NS_FORWARD_NSIDOMDOCUMENT(nsDocument::) // nsIDOMNode interface - NS_FORWARD_NSIDOMNODE(nsDocument::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMHTMLDocument interface NS_DECL_NSIDOMHTMLDOCUMENT diff --git a/content/mathml/content/src/nsMathMLElement.h b/content/mathml/content/src/nsMathMLElement.h index b09f994cb30..58a3c819a26 100644 --- a/content/mathml/content/src/nsMathMLElement.h +++ b/content/mathml/content/src/nsMathMLElement.h @@ -34,7 +34,7 @@ public: // Forward implementations of parent interfaces of nsMathMLElement to // our base class - NS_FORWARD_NSIDOMNODE(nsMathMLElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsMathMLElementBase::) nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, diff --git a/content/svg/content/src/nsSVGAElement.h b/content/svg/content/src/nsSVGAElement.h index 39b08c9baa1..5eb2a7795d0 100644 --- a/content/svg/content/src/nsSVGAElement.h +++ b/content/svg/content/src/nsSVGAElement.h @@ -36,7 +36,7 @@ public: NS_DECL_NSIDOMSVGURIREFERENCE // XXX: I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGAElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGAElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAElementBase::) diff --git a/content/svg/content/src/nsSVGAltGlyphElement.cpp b/content/svg/content/src/nsSVGAltGlyphElement.cpp index 7a8728ce1bf..5888860ebb8 100644 --- a/content/svg/content/src/nsSVGAltGlyphElement.cpp +++ b/content/svg/content/src/nsSVGAltGlyphElement.cpp @@ -34,7 +34,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGAltGlyphElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGAltGlyphElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAltGlyphElementBase::) NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGAltGlyphElementBase::) diff --git a/content/svg/content/src/nsSVGAnimateElement.cpp b/content/svg/content/src/nsSVGAnimateElement.cpp index b2bcd87d28d..0f145754a32 100644 --- a/content/svg/content/src/nsSVGAnimateElement.cpp +++ b/content/svg/content/src/nsSVGAnimateElement.cpp @@ -24,7 +24,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMSVGANIMATEELEMENT - NS_FORWARD_NSIDOMNODE(nsSVGAnimateElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGAnimateElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAnimateElementBase::) NS_FORWARD_NSIDOMSVGANIMATIONELEMENT(nsSVGAnimateElementBase::) diff --git a/content/svg/content/src/nsSVGAnimateMotionElement.h b/content/svg/content/src/nsSVGAnimateMotionElement.h index e9c71615227..1c893666b9d 100644 --- a/content/svg/content/src/nsSVGAnimateMotionElement.h +++ b/content/svg/content/src/nsSVGAnimateMotionElement.h @@ -28,7 +28,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMSVGANIMATEMOTIONELEMENT - NS_FORWARD_NSIDOMNODE(nsSVGAnimateMotionElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGAnimateMotionElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAnimateMotionElementBase::) NS_FORWARD_NSIDOMSVGANIMATIONELEMENT(nsSVGAnimateMotionElementBase::) diff --git a/content/svg/content/src/nsSVGAnimateTransformElement.cpp b/content/svg/content/src/nsSVGAnimateTransformElement.cpp index 95d88f51710..5c9f04ed339 100644 --- a/content/svg/content/src/nsSVGAnimateTransformElement.cpp +++ b/content/svg/content/src/nsSVGAnimateTransformElement.cpp @@ -27,7 +27,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMSVGANIMATETRANSFORMELEMENT - NS_FORWARD_NSIDOMNODE(nsSVGAnimateTransformElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGAnimateTransformElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAnimateTransformElementBase::) NS_FORWARD_NSIDOMSVGANIMATIONELEMENT(nsSVGAnimateTransformElementBase::) diff --git a/content/svg/content/src/nsSVGCircleElement.cpp b/content/svg/content/src/nsSVGCircleElement.cpp index c6ef92bbb65..9b60e4a80d8 100644 --- a/content/svg/content/src/nsSVGCircleElement.cpp +++ b/content/svg/content/src/nsSVGCircleElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGCIRCLEELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGCircleElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGCircleElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGCircleElementBase::) diff --git a/content/svg/content/src/nsSVGClipPathElement.h b/content/svg/content/src/nsSVGClipPathElement.h index 0ef203a6fd7..75a410253d5 100644 --- a/content/svg/content/src/nsSVGClipPathElement.h +++ b/content/svg/content/src/nsSVGClipPathElement.h @@ -33,7 +33,7 @@ public: NS_DECL_NSIDOMSVGCLIPPATHELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGClipPathElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGClipPathElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGClipPathElementBase::) diff --git a/content/svg/content/src/nsSVGDefsElement.cpp b/content/svg/content/src/nsSVGDefsElement.cpp index eb317cffdb5..533cc300279 100644 --- a/content/svg/content/src/nsSVGDefsElement.cpp +++ b/content/svg/content/src/nsSVGDefsElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGDEFSELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGDefsElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGDefsElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDefsElementBase::) diff --git a/content/svg/content/src/nsSVGDescElement.cpp b/content/svg/content/src/nsSVGDescElement.cpp index 36e3cef6855..bb60e8d5435 100644 --- a/content/svg/content/src/nsSVGDescElement.cpp +++ b/content/svg/content/src/nsSVGDescElement.cpp @@ -24,7 +24,7 @@ public: NS_DECL_NSIDOMSVGDESCELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGDescElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGDescElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDescElementBase::) diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index f2f99b2898c..5274c5f2c00 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -1015,7 +1015,8 @@ nsSVGElement::sLightingEffectsMap[] = { NS_IMETHODIMP nsSVGElement::IsSupported(const nsAString& aFeature, const nsAString& aVersion, bool* aReturn) { - return nsGenericElement::IsSupported(aFeature, aVersion, aReturn); + *aReturn = nsGenericElement::IsSupported(aFeature, aVersion); + return NS_OK; } //---------------------------------------------------------------------- diff --git a/content/svg/content/src/nsSVGEllipseElement.cpp b/content/svg/content/src/nsSVGEllipseElement.cpp index e5e96e25fe9..fc5030e40ed 100644 --- a/content/svg/content/src/nsSVGEllipseElement.cpp +++ b/content/svg/content/src/nsSVGEllipseElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGELLIPSEELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGEllipseElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGEllipseElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGEllipseElementBase::) diff --git a/content/svg/content/src/nsSVGFilterElement.h b/content/svg/content/src/nsSVGFilterElement.h index 437b04775e2..fae6a6e0728 100644 --- a/content/svg/content/src/nsSVGFilterElement.h +++ b/content/svg/content/src/nsSVGFilterElement.h @@ -40,7 +40,7 @@ public: NS_DECL_NSIDOMSVGURIREFERENCE // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGFilterElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFilterElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFilterElementBase::) diff --git a/content/svg/content/src/nsSVGFilters.cpp b/content/svg/content/src/nsSVGFilters.cpp index 7a076aa3cc8..be67c2af00b 100644 --- a/content/svg/content/src/nsSVGFilters.cpp +++ b/content/svg/content/src/nsSVGFilters.cpp @@ -356,7 +356,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEGaussianBlurElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEGaussianBlurElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEGaussianBlurElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -834,7 +834,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEBlendElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEBlendElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEBlendElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -1051,7 +1051,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEColorMatrixElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEColorMatrixElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEColorMatrixElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -1371,7 +1371,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFECompositeElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFECompositeElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFECompositeElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -1682,7 +1682,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEComponentTransferElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEComponentTransferElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEComponentTransferElementBase::) // nsIContent @@ -2096,7 +2096,7 @@ public: virtual int32_t GetChannel() { return 0; } NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::) - NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2143,7 +2143,7 @@ public: virtual int32_t GetChannel() { return 1; } NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::) - NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2190,7 +2190,7 @@ public: virtual int32_t GetChannel() { return 2; } NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::) - NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2237,7 +2237,7 @@ public: virtual int32_t GetChannel() { return 3; } NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::) - NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2295,7 +2295,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMergeElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEMergeElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEMergeElementBase::) // nsIContent @@ -2337,7 +2337,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMergeNodeElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEMergeNodeElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEMergeNodeElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2532,7 +2532,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEOffsetElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEOffsetElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEOffsetElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -2731,7 +2731,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEFloodElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEFloodElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEFloodElementBase::) // nsIContent interface @@ -2881,7 +2881,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFETileElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFETileElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFETileElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -3080,7 +3080,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFETurbulenceElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFETurbulenceElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFETurbulenceElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -3629,7 +3629,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMorphologyElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEMorphologyElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEMorphologyElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -3941,7 +3941,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEConvolveMatrixElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEConvolveMatrixElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEConvolveMatrixElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -4435,7 +4435,7 @@ public: NS_DECL_NSIDOMSVGFEDISTANTLIGHTELEMENT NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDistantLightElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEDistantLightElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEDistantLightElementBase::) virtual bool AttributeAffectsRendering( @@ -4540,7 +4540,7 @@ public: NS_DECL_NSIDOMSVGFEPOINTLIGHTELEMENT NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEPointLightElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEPointLightElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEPointLightElementBase::) virtual bool AttributeAffectsRendering( @@ -4652,7 +4652,7 @@ public: NS_DECL_NSIDOMSVGFESPOTLIGHTELEMENT NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFESpotLightElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFESpotLightElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFESpotLightElementBase::) virtual bool AttributeAffectsRendering( @@ -4820,7 +4820,6 @@ public: const nsSVGFilterInstance& aInstance); NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFELightingElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFELightingElementBase::) NS_FORWARD_NSIDOMELEMENT(nsSVGFELightingElementBase::) NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; @@ -5200,7 +5199,7 @@ public: NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEDiffuseLightingElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDiffuseLightingElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEDiffuseLightingElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEDiffuseLightingElementBase::) virtual bool AttributeAffectsRendering( @@ -5331,7 +5330,7 @@ public: NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFESpecularLightingElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFESpecularLightingElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFESpecularLightingElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFESpecularLightingElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -5832,7 +5831,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDisplacementMapElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEDisplacementMapElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEDisplacementMapElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; diff --git a/content/svg/content/src/nsSVGFilters.h b/content/svg/content/src/nsSVGFilters.h index 15b3df1f137..16f268e5383 100644 --- a/content/svg/content/src/nsSVGFilters.h +++ b/content/svg/content/src/nsSVGFilters.h @@ -251,7 +251,7 @@ public: NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEImageElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::) // nsIContent diff --git a/content/svg/content/src/nsSVGForeignObjectElement.h b/content/svg/content/src/nsSVGForeignObjectElement.h index efadd4290fc..1dabee89510 100644 --- a/content/svg/content/src/nsSVGForeignObjectElement.h +++ b/content/svg/content/src/nsSVGForeignObjectElement.h @@ -31,7 +31,7 @@ public: NS_DECL_NSIDOMSVGFOREIGNOBJECTELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGForeignObjectElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGForeignObjectElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::) diff --git a/content/svg/content/src/nsSVGGElement.cpp b/content/svg/content/src/nsSVGGElement.cpp index 1badf948078..b15597de47a 100644 --- a/content/svg/content/src/nsSVGGElement.cpp +++ b/content/svg/content/src/nsSVGGElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGGELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGGElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGGElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGGElementBase::) diff --git a/content/svg/content/src/nsSVGGradientElement.h b/content/svg/content/src/nsSVGGradientElement.h index 5711e3f37a7..842c8dfd650 100644 --- a/content/svg/content/src/nsSVGGradientElement.h +++ b/content/svg/content/src/nsSVGGradientElement.h @@ -93,7 +93,7 @@ public: // The Gradient Element base class implements these NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLinearGradientElementBase::) - NS_FORWARD_NSIDOMNODE(nsSVGLinearGradientElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGLinearGradientElementBase::) virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; @@ -137,7 +137,7 @@ public: NS_DECL_NSIDOMSVGRADIALGRADIENTELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGRadialGradientElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGRadialGradientElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRadialGradientElementBase::) diff --git a/content/svg/content/src/nsSVGImageElement.h b/content/svg/content/src/nsSVGImageElement.h index f3d77d4b028..4a60a2da77d 100644 --- a/content/svg/content/src/nsSVGImageElement.h +++ b/content/svg/content/src/nsSVGImageElement.h @@ -39,7 +39,7 @@ public: NS_DECL_NSIDOMSVGURIREFERENCE // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGImageElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGImageElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGImageElementBase::) diff --git a/content/svg/content/src/nsSVGLineElement.cpp b/content/svg/content/src/nsSVGLineElement.cpp index 8dff6bd8c25..db90d68bb91 100644 --- a/content/svg/content/src/nsSVGLineElement.cpp +++ b/content/svg/content/src/nsSVGLineElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGLINEELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGLineElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGLineElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLineElementBase::) diff --git a/content/svg/content/src/nsSVGMarkerElement.h b/content/svg/content/src/nsSVGMarkerElement.h index d338a9369a7..8c2b89ce328 100644 --- a/content/svg/content/src/nsSVGMarkerElement.h +++ b/content/svg/content/src/nsSVGMarkerElement.h @@ -91,7 +91,7 @@ public: NS_DECL_NSIDOMSVGFITTOVIEWBOX // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) diff --git a/content/svg/content/src/nsSVGMaskElement.h b/content/svg/content/src/nsSVGMaskElement.h index 588606f04cb..3a66b760340 100644 --- a/content/svg/content/src/nsSVGMaskElement.h +++ b/content/svg/content/src/nsSVGMaskElement.h @@ -36,7 +36,7 @@ public: // Mask Element NS_DECL_NSIDOMSVGMASKELEMENT - NS_FORWARD_NSIDOMNODE(nsSVGElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) diff --git a/content/svg/content/src/nsSVGMetadataElement.cpp b/content/svg/content/src/nsSVGMetadataElement.cpp index 82fe2588f26..e72a377f5ff 100644 --- a/content/svg/content/src/nsSVGMetadataElement.cpp +++ b/content/svg/content/src/nsSVGMetadataElement.cpp @@ -24,7 +24,7 @@ public: NS_DECL_NSIDOMSVGMETADATAELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) diff --git a/content/svg/content/src/nsSVGMpathElement.h b/content/svg/content/src/nsSVGMpathElement.h index 19bea672616..0e1ca857bce 100644 --- a/content/svg/content/src/nsSVGMpathElement.h +++ b/content/svg/content/src/nsSVGMpathElement.h @@ -41,7 +41,7 @@ public: NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED // Forward interface implementations to base class - NS_FORWARD_NSIDOMNODE(nsSVGMpathElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGMpathElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGMpathElementBase::) diff --git a/content/svg/content/src/nsSVGPathElement.h b/content/svg/content/src/nsSVGPathElement.h index a63a706f388..f58ec1f1c50 100644 --- a/content/svg/content/src/nsSVGPathElement.h +++ b/content/svg/content/src/nsSVGPathElement.h @@ -36,7 +36,7 @@ public: NS_DECL_NSIDOMSVGANIMATEDPATHDATA // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGPathElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGPathElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::) diff --git a/content/svg/content/src/nsSVGPatternElement.h b/content/svg/content/src/nsSVGPatternElement.h index ada06cdb4fb..b81c4f77365 100644 --- a/content/svg/content/src/nsSVGPatternElement.h +++ b/content/svg/content/src/nsSVGPatternElement.h @@ -52,7 +52,7 @@ public: // FitToViewbox NS_DECL_NSIDOMSVGFITTOVIEWBOX - NS_FORWARD_NSIDOMNODE(nsSVGElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) diff --git a/content/svg/content/src/nsSVGPolygonElement.cpp b/content/svg/content/src/nsSVGPolygonElement.cpp index 04c3f6efb64..046365f3b82 100644 --- a/content/svg/content/src/nsSVGPolygonElement.cpp +++ b/content/svg/content/src/nsSVGPolygonElement.cpp @@ -25,7 +25,7 @@ public: NS_DECL_NSIDOMSVGPOLYGONELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGPolygonElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGPolygonElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolygonElementBase::) diff --git a/content/svg/content/src/nsSVGPolylineElement.cpp b/content/svg/content/src/nsSVGPolylineElement.cpp index dd7d0f4145a..e0bd3e53118 100644 --- a/content/svg/content/src/nsSVGPolylineElement.cpp +++ b/content/svg/content/src/nsSVGPolylineElement.cpp @@ -23,7 +23,7 @@ public: NS_DECL_NSIDOMSVGPOLYLINEELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGPolylineElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGPolylineElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolylineElementBase::) diff --git a/content/svg/content/src/nsSVGRectElement.cpp b/content/svg/content/src/nsSVGRectElement.cpp index 6dd7cd477c4..67f154b1e26 100644 --- a/content/svg/content/src/nsSVGRectElement.cpp +++ b/content/svg/content/src/nsSVGRectElement.cpp @@ -29,7 +29,7 @@ public: NS_DECL_NSIDOMSVGRECTELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGRectElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGRectElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRectElementBase::) diff --git a/content/svg/content/src/nsSVGSVGElement.h b/content/svg/content/src/nsSVGSVGElement.h index 6b0d0cbeff4..dafa3ae2a41 100644 --- a/content/svg/content/src/nsSVGSVGElement.h +++ b/content/svg/content/src/nsSVGSVGElement.h @@ -130,7 +130,7 @@ public: NS_DECL_NSIDOMSVGZOOMANDPAN // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGSVGElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGSVGElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSVGElementBase::) diff --git a/content/svg/content/src/nsSVGScriptElement.cpp b/content/svg/content/src/nsSVGScriptElement.cpp index 71bef5c09f6..2d4867b98cd 100644 --- a/content/svg/content/src/nsSVGScriptElement.cpp +++ b/content/svg/content/src/nsSVGScriptElement.cpp @@ -44,7 +44,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGScriptElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGScriptElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGScriptElementBase::) diff --git a/content/svg/content/src/nsSVGSetElement.cpp b/content/svg/content/src/nsSVGSetElement.cpp index b7fa2557622..da3c151188e 100644 --- a/content/svg/content/src/nsSVGSetElement.cpp +++ b/content/svg/content/src/nsSVGSetElement.cpp @@ -24,7 +24,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMSVGSETELEMENT - NS_FORWARD_NSIDOMNODE(nsSVGSetElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGSetElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSetElementBase::) NS_FORWARD_NSIDOMSVGANIMATIONELEMENT(nsSVGSetElementBase::) diff --git a/content/svg/content/src/nsSVGStopElement.cpp b/content/svg/content/src/nsSVGStopElement.cpp index 4471205c402..aa54b6e416c 100644 --- a/content/svg/content/src/nsSVGStopElement.cpp +++ b/content/svg/content/src/nsSVGStopElement.cpp @@ -30,7 +30,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGStopElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGStopElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGStopElementBase::) diff --git a/content/svg/content/src/nsSVGStyleElement.cpp b/content/svg/content/src/nsSVGStyleElement.cpp index 469caa9a2b8..f23808a0def 100644 --- a/content/svg/content/src/nsSVGStyleElement.cpp +++ b/content/svg/content/src/nsSVGStyleElement.cpp @@ -34,7 +34,7 @@ public: nsSVGStyleElementBase) // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGStyleElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGStyleElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGStyleElementBase::) diff --git a/content/svg/content/src/nsSVGSwitchElement.h b/content/svg/content/src/nsSVGSwitchElement.h index 976e65d0919..3c46be2639c 100644 --- a/content/svg/content/src/nsSVGSwitchElement.h +++ b/content/svg/content/src/nsSVGSwitchElement.h @@ -35,7 +35,7 @@ public: NS_DECL_NSIDOMSVGSWITCHELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGSwitchElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGSwitchElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSwitchElementBase::) diff --git a/content/svg/content/src/nsSVGSymbolElement.cpp b/content/svg/content/src/nsSVGSymbolElement.cpp index 4028912b839..2d16c64b3d0 100644 --- a/content/svg/content/src/nsSVGSymbolElement.cpp +++ b/content/svg/content/src/nsSVGSymbolElement.cpp @@ -34,7 +34,7 @@ public: NS_DECL_NSIDOMSVGFITTOVIEWBOX // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) diff --git a/content/svg/content/src/nsSVGTSpanElement.cpp b/content/svg/content/src/nsSVGTSpanElement.cpp index 7ed1391f1b7..7fff229a7ed 100644 --- a/content/svg/content/src/nsSVGTSpanElement.cpp +++ b/content/svg/content/src/nsSVGTSpanElement.cpp @@ -31,7 +31,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGTSpanElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::) NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTSpanElementBase::) diff --git a/content/svg/content/src/nsSVGTextElement.cpp b/content/svg/content/src/nsSVGTextElement.cpp index 06496776268..f420d620a79 100644 --- a/content/svg/content/src/nsSVGTextElement.cpp +++ b/content/svg/content/src/nsSVGTextElement.cpp @@ -56,7 +56,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGTextElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGTextElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTextElementBase::) diff --git a/content/svg/content/src/nsSVGTextPathElement.h b/content/svg/content/src/nsSVGTextPathElement.h index e7b6940c372..359601c922a 100644 --- a/content/svg/content/src/nsSVGTextPathElement.h +++ b/content/svg/content/src/nsSVGTextPathElement.h @@ -45,7 +45,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGTextPathElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGTextPathElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTextPathElementBase::) NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTextPathElementBase::) diff --git a/content/svg/content/src/nsSVGTitleElement.cpp b/content/svg/content/src/nsSVGTitleElement.cpp index 9dacd205e6d..c6498885e83 100644 --- a/content/svg/content/src/nsSVGTitleElement.cpp +++ b/content/svg/content/src/nsSVGTitleElement.cpp @@ -26,7 +26,7 @@ public: NS_DECL_NSIDOMSVGTITLEELEMENT // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGTitleElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGTitleElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTitleElementBase::) diff --git a/content/svg/content/src/nsSVGUnknownElement.cpp b/content/svg/content/src/nsSVGUnknownElement.cpp index 6006bc521f7..c2937dd34cf 100644 --- a/content/svg/content/src/nsSVGUnknownElement.cpp +++ b/content/svg/content/src/nsSVGUnknownElement.cpp @@ -23,7 +23,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGUnknownElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGUnknownElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGUnknownElementBase::) diff --git a/content/svg/content/src/nsSVGUseElement.cpp b/content/svg/content/src/nsSVGUseElement.cpp index 3fa15f2f501..e891080187e 100644 --- a/content/svg/content/src/nsSVGUseElement.cpp +++ b/content/svg/content/src/nsSVGUseElement.cpp @@ -280,7 +280,7 @@ nsSVGUseElement::CreateAnonymousContent() } } - nsCOMPtr newnode; + nsCOMPtr newnode; nsCOMArray unused; nsNodeInfoManager* nodeInfoManager = targetContent->OwnerDoc() == OwnerDoc() ? diff --git a/content/svg/content/src/nsSVGUseElement.h b/content/svg/content/src/nsSVGUseElement.h index 4883547983e..725d5499f8c 100644 --- a/content/svg/content/src/nsSVGUseElement.h +++ b/content/svg/content/src/nsSVGUseElement.h @@ -62,7 +62,7 @@ public: NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE(nsSVGUseElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGUseElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGUseElementBase::) diff --git a/content/svg/content/src/nsSVGViewElement.h b/content/svg/content/src/nsSVGViewElement.h index a6bdecdaf88..bbf14e2be5b 100644 --- a/content/svg/content/src/nsSVGViewElement.h +++ b/content/svg/content/src/nsSVGViewElement.h @@ -43,7 +43,7 @@ public: // xxx If xpcom allowed virtual inheritance we wouldn't need to // forward here :-( - NS_FORWARD_NSIDOMNODE(nsSVGViewElementBase::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT(nsSVGViewElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGViewElementBase::) diff --git a/content/svg/document/src/nsSVGDocument.h b/content/svg/document/src/nsSVGDocument.h index 08033143402..8020ba7670c 100644 --- a/content/svg/document/src/nsSVGDocument.h +++ b/content/svg/document/src/nsSVGDocument.h @@ -20,7 +20,7 @@ public: NS_DECL_NSIDOMSVGDOCUMENT NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::) - NS_FORWARD_NSIDOMNODE(nsXMLDocument::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_DECL_ISUPPORTS_INHERITED virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsXPCClassInfo* GetClassInfo(); diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index baf3aee09e3..a5200cf4184 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -692,7 +692,7 @@ nsBindingManager::GetContentListFor(nsIContent* aContent) } if (!result) { - result = aContent->GetChildNodesList(); + result = aContent->ChildNodes(); } return result; diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index b2c479ec692..cf8480db8e1 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -690,7 +690,7 @@ RealizeDefaultContent(nsISupports* aKey, return PL_DHASH_STOP; } nsIDocument *document = insParent->OwnerDoc(); - nsCOMPtr clonedNode; + nsCOMPtr clonedNode; nsCOMArray nodesWithProperties; nsNodeUtils::Clone(defContent, true, document->NodeInfoManager(), nodesWithProperties, getter_AddRefs(clonedNode)); @@ -806,7 +806,7 @@ nsXBLBinding::GenerateAnonymousContent() } if (hasContent || hasInsertionPoints) { - nsCOMPtr clonedNode; + nsCOMPtr clonedNode; nsCOMArray nodesWithProperties; nsNodeUtils::Clone(content, true, doc->NodeInfoManager(), nodesWithProperties, getter_AddRefs(clonedNode)); @@ -1689,7 +1689,7 @@ nsINodeList* nsXBLBinding::GetAnonymousNodes() { if (mContent) { - return mContent->GetChildNodesList(); + return mContent->ChildNodes(); } if (mNextBinding) diff --git a/content/xml/content/src/nsXMLCDATASection.cpp b/content/xml/content/src/nsXMLCDATASection.cpp index 0fcc72f55d8..572e6fe964b 100644 --- a/content/xml/content/src/nsXMLCDATASection.cpp +++ b/content/xml/content/src/nsXMLCDATASection.cpp @@ -18,7 +18,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) diff --git a/content/xml/content/src/nsXMLElement.h b/content/xml/content/src/nsXMLElement.h index e589b7f6c8e..44dc90ec6ca 100644 --- a/content/xml/content/src/nsXMLElement.h +++ b/content/xml/content/src/nsXMLElement.h @@ -22,7 +22,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericElement::) diff --git a/content/xml/content/src/nsXMLProcessingInstruction.h b/content/xml/content/src/nsXMLProcessingInstruction.h index f337d243cf1..0f4fcd93528 100644 --- a/content/xml/content/src/nsXMLProcessingInstruction.h +++ b/content/xml/content/src/nsXMLProcessingInstruction.h @@ -23,7 +23,7 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) diff --git a/content/xml/content/src/nsXMLStylesheetPI.cpp b/content/xml/content/src/nsXMLStylesheetPI.cpp index 39742c5dd10..64cc9da6444 100644 --- a/content/xml/content/src/nsXMLStylesheetPI.cpp +++ b/content/xml/content/src/nsXMLStylesheetPI.cpp @@ -16,6 +16,8 @@ #include "nsThreadUtils.h" #include "nsContentUtils.h" +using namespace mozilla; + class nsXMLStylesheetPI : public nsXMLProcessingInstruction, public nsStyleLinkElement { @@ -31,7 +33,8 @@ public: nsXMLProcessingInstruction) // nsIDOMNode - NS_IMETHOD SetNodeValue(const nsAString& aData); + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError); // nsIContent virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, @@ -123,14 +126,14 @@ nsXMLStylesheetPI::UnbindFromTree(bool aDeep, bool aNullParent) // nsIDOMNode -NS_IMETHODIMP -nsXMLStylesheetPI::SetNodeValue(const nsAString& aNodeValue) +void +nsXMLStylesheetPI::SetNodeValueInternal(const nsAString& aNodeValue, + ErrorResult& aError) { - nsresult rv = nsGenericDOMDataNode::SetNodeValue(aNodeValue); - if (NS_SUCCEEDED(rv)) { + nsGenericDOMDataNode::SetNodeValue(aNodeValue, aError); + if (!aError.Failed()) { UpdateStyleSheetInternal(nullptr, true); } - return rv; } // nsStyleLinkElement diff --git a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp index fc1b5f76847..52b3d4e4e10 100644 --- a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp +++ b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp @@ -254,7 +254,7 @@ txXPathTreeWalker::moveToParent() return true; } - nsINode* parent = mPosition.mNode->GetNodeParent(); + nsINode* parent = mPosition.mNode->GetParentNode(); if (!parent) { return false; } @@ -281,7 +281,7 @@ txXPathTreeWalker::moveToSibling(int32_t aDir) NS_ASSERTION(mPosition.isContent(), "moveToSibling should only be called for content"); - nsINode* parent = mPosition.mNode->GetNodeParent(); + nsINode* parent = mPosition.mNode->GetParentNode(); if (!parent) { return false; } @@ -568,7 +568,7 @@ txXPathNodeUtils::getXSLTId(const txXPathNode& aNode, void txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsAString& aURI) { - aNode.mNode->GetDOMBaseURI(aURI); + aNode.mNode->GetBaseURI(aURI); } /* static */ @@ -612,8 +612,8 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode, nsINode* otherNode = aOtherNode.mNode; nsINode* parent, *otherParent; while (node && otherNode) { - parent = node->GetNodeParent(); - otherParent = otherNode->GetNodeParent(); + parent = node->GetParentNode(); + otherParent = otherNode->GetParentNode(); // Hopefully this is a common case. if (parent == otherParent) { @@ -635,11 +635,11 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode, while (node) { parents.AppendElement(node); - node = node->GetNodeParent(); + node = node->GetParentNode(); } while (otherNode) { otherParents.AppendElement(otherNode); - otherNode = otherNode->GetNodeParent(); + otherNode = otherNode->GetParentNode(); } // Walk back down along the parent-chains until we find where they split. diff --git a/content/xslt/src/xpath/txXPathNode.h b/content/xslt/src/xpath/txXPathNode.h index 99842870e6f..1a29ab8cc40 100644 --- a/content/xslt/src/xpath/txXPathNode.h +++ b/content/xslt/src/xpath/txXPathNode.h @@ -53,7 +53,7 @@ private: static nsINode *RootOf(nsINode *aNode) { nsINode *ancestor, *root = aNode; - while ((ancestor = root->GetNodeParent())) { + while ((ancestor = root->GetParentNode())) { root = ancestor; } return root; diff --git a/content/xslt/src/xpath/txXPathTreeWalker.h b/content/xslt/src/xpath/txXPathTreeWalker.h index eb8f35ad69f..41acf134318 100644 --- a/content/xslt/src/xpath/txXPathTreeWalker.h +++ b/content/xslt/src/xpath/txXPathTreeWalker.h @@ -231,7 +231,7 @@ txXPathNodeUtils::localNameEquals(const txXPathNode& aNode, inline bool txXPathNodeUtils::isRoot(const txXPathNode& aNode) { - return !aNode.isAttribute() && !aNode.mNode->GetNodeParent(); + return !aNode.isAttribute() && !aNode.mNode->GetParentNode(); } /* static */ diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index 043a671e275..aac233bbe69 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -353,7 +353,7 @@ txMozillaXMLOutput::endElement() // Check to make sure that script hasn't inserted the node somewhere // else in the tree - if (!mCurrentNode->GetNodeParent()) { + if (!mCurrentNode->GetParentNode()) { parent->AppendChildTo(mNonAddedNode, true); } mNonAddedNode = nullptr; diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 53aa453cc5f..c10e3934a9c 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -398,7 +398,7 @@ public: bool GetTemplateGenerated() { return HasFlag(XUL_ELEMENT_TEMPLATE_GENERATED); } // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericElement::) + NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement NS_FORWARD_NSIDOMELEMENT(nsGenericElement::) diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 15e1f53ebee..cb00fdbda5f 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1774,7 +1774,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow, mFocusedContent = aContent; nsIContent* focusedNode = aWindow->GetFocusedNode(); - bool isRefocus = focusedNode && focusedNode->IsEqualTo(aContent); + bool isRefocus = focusedNode && focusedNode->IsEqualNode(aContent); aWindow->SetFocusedNode(aContent, focusMethod); diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 3ac1482fd15..88396a36997 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -648,6 +648,8 @@ addExternalIface('ImageData', nativeType='mozilla::dom::ImageData') addExternalIface('MediaStream') addExternalIface('Node', nativeType='nsINode') addExternalIface('PaintRequest') +addExternalIface('Principal', nativeType='nsIPrincipal', + headerFile='nsIPrincipal.h') addExternalIface('SVGLength') addExternalIface('SVGMatrix') addExternalIface('SVGNumber') @@ -656,6 +658,7 @@ addExternalIface('SVGPoint') addExternalIface('SVGTransform') addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h') addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h') +addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h') addExternalIface('WebGLContextAttributes', nativeType='JSObject', headerFile='jsapi.h') addExternalIface('Window') diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index 2088a730c5b..4cccdd04d91 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -57,27 +57,7 @@ CreateAttributeWarning=Use of document.createAttribute() is deprecated. Use elem CreateAttributeNSWarning=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead. SpecifiedWarning=Use of attributes' specified attribute is deprecated. It always returns true. OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated. -NodeNameWarning=Use of attributes' nodeName attribute is deprecated. Use name instead. NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead. -NodeTypeWarning=Use of attributes' nodeType attribute is deprecated. It always returns 2. -ParentNodeWarning=Use of attributes' parentNode attribute is deprecated. It always returns null. -ChildNodesWarning=Use of attributes' childNodes attribute is deprecated. It always returns null. -HasChildNodesWarning=Use of attributes' hasChildNodes() is deprecated. It always returns false. -HasAttributesWarning=Use of attributes' hasAttributes() is deprecated. It always returns false. -FirstChildWarning=Use of attributes' firstChild attribute is deprecated. Use value instead. -LastChildWarning=Use of attributes' lastChild attribute is deprecated. Use value instead. -PreviousSiblingWarning=Use of attributes' previousSibling attribute is deprecated. It always returns null. -NextSiblingWarning=Use of attributes' nextSibling attribute is deprecated. It always returns null. -AttributesWarning=Use of attributes' attributes attribute is deprecated. It always returns null. -InsertBeforeWarning=Use of attributes' insertBefore() is deprecated. Use value instead. -ReplaceChildWarning=Use of attributes' replaceChild() is deprecated. Use value instead. -RemoveChildWarning=Use of attributes' removeChild() is deprecated. Use value instead. -AppendChildWarning=Use of attributes' appendChild() is deprecated. Use value instead. -CloneNodeWarning=Use of attributes' cloneNode() is deprecated. -OwnerDocumentWarning=Use of attributes' ownerDocument attribute is deprecated. -NormalizeWarning=Use of attributes' normalize() is deprecated. -IsSupportedWarning=Use of attributes' isSupported() is deprecated. -IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated. TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead. EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead. PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated. diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 9a63ced9c7a..ccf3ce4022d 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -6,10 +6,14 @@ * The origin of this IDL file is * http://www.whatwg.org/specs/web-apps/current-work/#eventhandler * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and * Opera Software ASA. You are granted a license to use, reproduce * and create derivative works of this document. */ [TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler; + +[TreatNonCallableAsNull] +callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, DOMString source, unsigned long lineno, unsigned long column); +typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; diff --git a/dom/webidl/Node.webidl b/dom/webidl/Node.webidl index 6f88a658453..77c9487c4d5 100644 --- a/dom/webidl/Node.webidl +++ b/dom/webidl/Node.webidl @@ -10,6 +10,11 @@ * liability, trademark and document use rules apply. */ +interface NamedNodeMap; +interface Principal; +interface URI; +interface UserDataHandler; + interface Node : EventTarget { const unsigned short ELEMENT_NODE = 1; const unsigned short ATTRIBUTE_NODE = 2; // historical @@ -38,6 +43,24 @@ interface Node : EventTarget { readonly attribute Node? previousSibling; readonly attribute Node? nextSibling; + [SetterThrows] + attribute DOMString? nodeValue; + [SetterThrows] + attribute DOMString? textContent; + [Throws] + Node insertBefore(Node node, Node? child); + [Throws] + Node appendChild(Node node); + [Throws] + Node replaceChild(Node node, Node child); + [Throws] + Node removeChild(Node child); + void normalize(); + + [Throws] + Node cloneNode(optional boolean deep = true); + boolean isEqualNode(Node? node); + const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; @@ -47,18 +70,28 @@ interface Node : EventTarget { unsigned short compareDocumentPosition(Node other); boolean contains(Node? other); - attribute DOMString? nodeValue; - attribute DOMString? textContent; - Node insertBefore(Node node, Node? child); - Node appendChild(Node node); - Node replaceChild(Node node, Node child); - Node removeChild(Node child); - void normalize(); - - Node cloneNode(optional boolean deep); - boolean isEqualNode(Node? node); - - DOMString lookupPrefix(DOMString? namespace); - DOMString lookupNamespaceURI(DOMString? prefix); + DOMString? lookupPrefix(DOMString? namespace); + DOMString? lookupNamespaceURI(DOMString? prefix); boolean isDefaultNamespace(DOMString? namespace); -;} + + // Mozilla-specific stuff + // These have been moved to Element in the spec. + readonly attribute NamedNodeMap? attributes; + [Throws] + readonly attribute DOMString namespaceURI; + readonly attribute DOMString prefix; + readonly attribute DOMString localName; + + // This has been removed from the spec. + boolean isSupported(DOMString feature, DOMString version); + + boolean hasAttributes(); + [Throws] + any setUserData(DOMString key, any data, UserDataHandler handler); + [Throws] + any getUserData(DOMString key); + [ChromeOnly] + readonly attribute Principal nodePrincipal; + [ChromeOnly] + readonly attribute URI? baseURIObject; +}; diff --git a/editor/libeditor/base/DeleteNodeTxn.cpp b/editor/libeditor/base/DeleteNodeTxn.cpp index efaa9edfef1..3147f83139b 100644 --- a/editor/libeditor/base/DeleteNodeTxn.cpp +++ b/editor/libeditor/base/DeleteNodeTxn.cpp @@ -10,6 +10,7 @@ #include "nsSelectionState.h" // nsRangeUpdater #include "nsAString.h" +using namespace mozilla; DeleteNodeTxn::DeleteNodeTxn() : EditTxn(), mNode(), mParent(), mRefNode(), mRangeUpdater(nullptr) @@ -42,7 +43,7 @@ DeleteNodeTxn::Init(nsEditor* aEditor, nsINode* aNode, NS_ENSURE_TRUE(aEditor && aNode, NS_ERROR_NULL_POINTER); mEditor = aEditor; mNode = aNode; - mParent = aNode->GetNodeParent(); + mParent = aNode->GetParentNode(); // do nothing if the node has a parent and it's read-only NS_ENSURE_TRUE(!mParent || mEditor->IsModifiableNode(mParent), @@ -74,7 +75,9 @@ DeleteNodeTxn::DoTransaction() mRangeUpdater->SelAdjDeleteNode(mNode->AsDOMNode()); } - return mParent->RemoveChild(mNode); + ErrorResult error; + mParent->RemoveChild(*mNode, error); + return error.ErrorCode(); } NS_IMETHODIMP @@ -88,9 +91,9 @@ DeleteNodeTxn::UndoTransaction() return NS_ERROR_NULL_POINTER; } - nsresult res; - mParent->InsertBefore(mNode, mRefNode, &res); - return res; + ErrorResult error; + mParent->InsertBefore(*mNode, mRefNode, error); + return error.ErrorCode(); } NS_IMETHODIMP @@ -108,7 +111,9 @@ DeleteNodeTxn::RedoTransaction() mRangeUpdater->SelAdjDeleteNode(mNode->AsDOMNode()); } - return mParent->RemoveChild(mNode); + ErrorResult error; + mParent->RemoveChild(*mNode, error); + return error.ErrorCode(); } NS_IMETHODIMP diff --git a/editor/libeditor/base/JoinElementTxn.cpp b/editor/libeditor/base/JoinElementTxn.cpp index 98bf8313dcd..c30ba397369 100644 --- a/editor/libeditor/base/JoinElementTxn.cpp +++ b/editor/libeditor/base/JoinElementTxn.cpp @@ -83,11 +83,11 @@ NS_IMETHODIMP JoinElementTxn::DoTransaction(void) NS_ENSURE_STATE(rightNode); // get the parent node - nsCOMPtr leftParent = leftNode->GetNodeParent(); + nsCOMPtr leftParent = leftNode->GetParentNode(); NS_ENSURE_TRUE(leftParent, NS_ERROR_NULL_POINTER); // verify that mLeftNode and mRightNode have the same parent - nsCOMPtr rightParent = rightNode->GetNodeParent(); + nsCOMPtr rightParent = rightNode->GetParentNode(); NS_ENSURE_TRUE(rightParent, NS_ERROR_NULL_POINTER); if (leftParent != rightParent) { diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index fb18d825f49..33f20b5e1ca 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -1434,9 +1434,9 @@ nsEditor::JoinNodes(nsINode* aNodeToKeep, nsIContent* aNodeToMove) // We don't really need aNodeToMove's parent to be non-null -- we could just // skip adjusting any ranges in aNodeToMove's parent if there is none. But // the current implementation requires it. - MOZ_ASSERT(aNodeToKeep && aNodeToMove && aNodeToMove->GetNodeParent()); + MOZ_ASSERT(aNodeToKeep && aNodeToMove && aNodeToMove->GetParentNode()); nsresult res = JoinNodes(aNodeToKeep->AsDOMNode(), aNodeToMove->AsDOMNode(), - aNodeToMove->GetNodeParent()->AsDOMNode()); + aNodeToMove->GetParentNode()->AsDOMNode()); NS_ASSERTION(NS_SUCCEEDED(res), "JoinNodes failed"); NS_ENSURE_SUCCESS(res, res); return NS_OK; @@ -1611,7 +1611,7 @@ nsEditor::RemoveContainer(nsINode* aNode) { NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER); - nsCOMPtr parent = aNode->GetNodeParent(); + nsCOMPtr parent = aNode->GetParentNode(); NS_ENSURE_STATE(parent); int32_t offset = parent->IndexOf(aNode); @@ -3189,7 +3189,7 @@ nsEditor::GetNextNode(nsINode* aParentNode, // if aParentNode is a text node, use its location instead if (aParentNode->NodeType() == nsIDOMNode::TEXT_NODE) { - nsINode* parent = aParentNode->GetNodeParent(); + nsINode* parent = aParentNode->GetParentNode(); NS_ENSURE_TRUE(parent, nullptr); aOffset = parent->IndexOf(aParentNode) + 1; // _after_ the text node aParentNode = parent; @@ -3290,7 +3290,7 @@ nsEditor::FindNextLeafNode(nsINode *aCurrentNode, return leaf; } - nsINode *parent = cur->GetNodeParent(); + nsINode *parent = cur->GetParentNode(); if (!parent) { return nullptr; } @@ -4044,7 +4044,7 @@ nsEditor::SplitNodeDeep(nsIDOMNode *aNode, } } - nsINode* parentNode = nodeToSplit->GetNodeParent(); + nsINode* parentNode = nodeToSplit->GetParentNode(); NS_ENSURE_TRUE(parentNode, NS_ERROR_FAILURE); if (!bDoSplit && offset) { @@ -4359,29 +4359,29 @@ nsEditor::DeleteSelectionAndPrepareToCreateNode() MOZ_ASSERT(node, "Selection has no ranges in it"); if (node && node->IsNodeOfType(nsINode::eDATA_NODE)) { - NS_ASSERTION(node->GetNodeParent(), + NS_ASSERTION(node->GetParentNode(), "It's impossible to insert into chardata with no parent -- " "fix the caller"); - NS_ENSURE_STATE(node->GetNodeParent()); + NS_ENSURE_STATE(node->GetParentNode()); int32_t offset = selection->GetAnchorOffset(); if (offset == 0) { - res = selection->Collapse(node->GetNodeParent(), - node->GetNodeParent()->IndexOf(node)); + res = selection->Collapse(node->GetParentNode(), + node->GetParentNode()->IndexOf(node)); MOZ_ASSERT(NS_SUCCEEDED(res)); NS_ENSURE_SUCCESS(res, res); } else if (offset == (int32_t)node->Length()) { - res = selection->Collapse(node->GetNodeParent(), - node->GetNodeParent()->IndexOf(node) + 1); + res = selection->Collapse(node->GetParentNode(), + node->GetParentNode()->IndexOf(node) + 1); MOZ_ASSERT(NS_SUCCEEDED(res)); NS_ENSURE_SUCCESS(res, res); } else { nsCOMPtr tmp; res = SplitNode(node->AsDOMNode(), offset, getter_AddRefs(tmp)); NS_ENSURE_SUCCESS(res, res); - res = selection->Collapse(node->GetNodeParent(), - node->GetNodeParent()->IndexOf(node)); + res = selection->Collapse(node->GetParentNode(), + node->GetParentNode()->IndexOf(node)); MOZ_ASSERT(NS_SUCCEEDED(res)); NS_ENSURE_SUCCESS(res, res); } diff --git a/editor/libeditor/html/nsHTMLAbsPosition.cpp b/editor/libeditor/html/nsHTMLAbsPosition.cpp index c36178cf583..a8e95e371d5 100644 --- a/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -528,7 +528,7 @@ nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement * aElement, nsCOMPtr element = do_QueryInterface(aElement); NS_ENSURE_STATE(element); - nsINode* parentNode = element->GetNodeParent(); + nsINode* parentNode = element->GetParentNode(); if (parentNode->GetChildCount() == 1) { nsCOMPtr brNode; nsresult res = CreateBR(parentNode->AsDOMNode(), 0, address_of(brNode)); diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index 3f0126a31da..0fe1572ab8f 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -1422,7 +1422,7 @@ nsHTMLCSSUtils::GetElementContainerOrSelf(nsINode* aNode) nsINode* node = aNode; // Loop until we find an element. while (node && !node->IsElement()) { - node = node->GetNodeParent(); + node = node->GetParentNode(); } NS_ENSURE_TRUE(node, nullptr); diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 113eac82538..183f0d7f08f 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -5265,12 +5265,12 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, if (aWhere == kStart) { // some special casing for text nodes if (node->IsNodeOfType(nsINode::eTEXT)) { - if (!node->GetNodeParent()) { + if (!node->GetParentNode()) { // Okay, can't promote any further return; } - offset = node->GetNodeParent()->IndexOf(node); - node = node->GetNodeParent(); + offset = node->GetParentNode()->IndexOf(node); + node = node->GetParentNode(); } // look back through any further inline nodes that aren't across a
@@ -5278,11 +5278,11 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, nsCOMPtr priorNode = mHTMLEditor->GetPriorHTMLNode(node, offset, true); - while (priorNode && priorNode->GetNodeParent() && + while (priorNode && priorNode->GetParentNode() && !mHTMLEditor->IsVisBreak(priorNode->AsDOMNode()) && !IsBlockNode(priorNode->AsDOMNode())) { - offset = priorNode->GetNodeParent()->IndexOf(priorNode); - node = priorNode->GetNodeParent(); + offset = priorNode->GetParentNode()->IndexOf(priorNode); + node = priorNode->GetParentNode(); priorNode = mHTMLEditor->GetPriorHTMLNode(node, offset, true); } @@ -5292,7 +5292,7 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, nsCOMPtr nearNode = mHTMLEditor->GetPriorHTMLNode(node, offset, true); while (!nearNode && node->Tag() != nsGkAtoms::body && - node->GetNodeParent()) { + node->GetParentNode()) { // some cutoffs are here: we don't need to also include them in the // aWhere == kEnd case. as long as they are in one or the other it will // work. special case for outdent: don't keep looking up if we have @@ -5302,8 +5302,8 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, break; } - int32_t parentOffset = node->GetNodeParent()->IndexOf(node); - nsCOMPtr parent = node->GetNodeParent(); + int32_t parentOffset = node->GetParentNode()->IndexOf(node); + nsCOMPtr parent = node->GetParentNode(); // Don't walk past the editable section. Note that we need to check // before walking up to a parent because we need to return the parent @@ -5330,13 +5330,13 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, // aWhere == kEnd // some special casing for text nodes if (node->IsNodeOfType(nsINode::eTEXT)) { - if (!node->GetNodeParent()) { + if (!node->GetParentNode()) { // Okay, can't promote any further return; } // want to be after the text node - offset = 1 + node->GetNodeParent()->IndexOf(node); - node = node->GetNodeParent(); + offset = 1 + node->GetParentNode()->IndexOf(node); + node = node->GetParentNode(); } // look ahead through any further inline nodes that aren't across a
from @@ -5345,9 +5345,9 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, mHTMLEditor->GetNextHTMLNode(node, offset, true); while (nextNode && !IsBlockNode(nextNode->AsDOMNode()) && - nextNode->GetNodeParent()) { - offset = 1 + nextNode->GetNodeParent()->IndexOf(nextNode); - node = nextNode->GetNodeParent(); + nextNode->GetParentNode()) { + offset = 1 + nextNode->GetParentNode()->IndexOf(nextNode); + node = nextNode->GetParentNode(); if (mHTMLEditor->IsVisBreak(nextNode->AsDOMNode())) { break; } @@ -5360,9 +5360,9 @@ nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, nsCOMPtr nearNode = mHTMLEditor->GetNextHTMLNode(node, offset, true); while (!nearNode && node->Tag() != nsGkAtoms::body && - node->GetNodeParent()) { - int32_t parentOffset = node->GetNodeParent()->IndexOf(node); - nsCOMPtr parent = node->GetNodeParent(); + node->GetParentNode()) { + int32_t parentOffset = node->GetParentNode()->IndexOf(node); + nsCOMPtr parent = node->GetParentNode(); // Don't walk past the editable section. Note that we need to check before // walking up to a parent because we need to return the parent object, so @@ -6198,13 +6198,13 @@ nsHTMLEditRules::IsInListItem(nsINode* aNode) return aNode; } - nsINode* parent = aNode->GetNodeParent(); + nsINode* parent = aNode->GetParentNode(); while (parent && mHTMLEditor->IsDescendantOfEditorRoot(parent) && !nsHTMLEditUtils::IsTableElement(parent)) { if (nsHTMLEditUtils::IsListItem(parent)) { return parent; } - parent = parent->GetNodeParent(); + parent = parent->GetParentNode(); } return nullptr; } @@ -7584,11 +7584,11 @@ nsHTMLEditRules::InDifferentTableElements(nsINode* aNode1, nsINode* aNode2) MOZ_ASSERT(aNode1 && aNode2); while (aNode1 && !nsHTMLEditUtils::IsTableElement(aNode1)) { - aNode1 = aNode1->GetNodeParent(); + aNode1 = aNode1->GetParentNode(); } while (aNode2 && !nsHTMLEditUtils::IsTableElement(aNode2)) { - aNode2 = aNode2->GetNodeParent(); + aNode2 = aNode2->GetParentNode(); } return aNode1 != aNode2; @@ -7636,7 +7636,7 @@ nsHTMLEditRules::RemoveEmptyNodes() nsINode* node = iter->GetCurrentNode(); NS_ENSURE_TRUE(node, NS_ERROR_FAILURE); - nsINode* parent = node->GetNodeParent(); + nsINode* parent = node->GetParentNode(); uint32_t idx = skipList.IndexOf(node); if (idx != skipList.NoIndex) { diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index f3ffac67d9a..e86a90e9338 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -3358,7 +3358,7 @@ nsHTMLEditor::GetIsSelectionEditable(bool* aIsSelectionEditable) nsINode* commonAncestor = selection->GetAnchorFocusRange()->GetCommonAncestor(); while (commonAncestor && !commonAncestor->IsEditable()) { - commonAncestor = commonAncestor->GetNodeParent(); + commonAncestor = commonAncestor->GetParentNode(); } if (!commonAncestor) { // No editable common ancestor diff --git a/editor/libeditor/html/nsHTMLEditorStyle.cpp b/editor/libeditor/html/nsHTMLEditorStyle.cpp index 4396988ac09..69b56e92f15 100644 --- a/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -556,13 +556,13 @@ nsHTMLEditor::SetInlinePropertyOnNode(nsIContent* aNode, nsCOMPtr previousSibling = aNode->GetPreviousSibling(), nextSibling = aNode->GetNextSibling(); - nsCOMPtr parent = aNode->GetNodeParent(); + nsCOMPtr parent = aNode->GetParentNode(); NS_ENSURE_STATE(parent); nsresult res = RemoveStyleInside(aNode->AsDOMNode(), aProperty, aAttribute); NS_ENSURE_SUCCESS(res, res); - if (aNode->GetNodeParent()) { + if (aNode->GetParentNode()) { // The node is still where it was return SetInlinePropertyOnNodeImpl(aNode, aProperty, aAttribute, aValue); @@ -571,8 +571,8 @@ nsHTMLEditor::SetInlinePropertyOnNode(nsIContent* aNode, // It's vanished. Use the old siblings for reference to construct a // list. But first, verify that the previous/next siblings are still // where we expect them; otherwise we have to give up. - if ((previousSibling && previousSibling->GetNodeParent() != parent) || - (nextSibling && nextSibling->GetNodeParent() != parent)) { + if ((previousSibling && previousSibling->GetParentNode() != parent) || + (nextSibling && nextSibling->GetParentNode() != parent)) { return NS_ERROR_UNEXPECTED; } nsCOMArray nodesToSet; diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index e6447b4f9a3..c1da56c9ae8 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -1649,7 +1649,7 @@ ContentIsDescendantOf(nsINode* aPossibleDescendant, do { if (aPossibleDescendant == aPossibleAncestor) return true; - aPossibleDescendant = aPossibleDescendant->GetNodeParent(); + aPossibleDescendant = aPossibleDescendant->GetParentNode(); } while (aPossibleDescendant); return false; diff --git a/js/xpconnect/src/dom_quickstubs.qsconf b/js/xpconnect/src/dom_quickstubs.qsconf index c9b527404c5..5fc3ae751be 100644 --- a/js/xpconnect/src/dom_quickstubs.qsconf +++ b/js/xpconnect/src/dom_quickstubs.qsconf @@ -496,8 +496,8 @@ customReturnInterfaces = [ ] nsIDOMNode_GetChildNodes_customMethodCallCode = """ - nsChildContentList* result = static_cast(self->GetChildNodesList()); - rv = result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; + nsChildContentList* result = static_cast(self->ChildNodes()); + rv = NS_OK; """ nsIDOMHTMLDocument_Write_customMethodCallCode = """ @@ -563,7 +563,7 @@ customMethodCalls = { }, 'nsIDOMNode_GetParentNode': { 'thisType': 'nsINode', - 'code': ' nsINode *result = self->GetNodeParent();', + 'code': ' nsINode *result = self->GetParentNode();', 'canFail': False }, 'nsIDOMNode_GetParentElement': { @@ -575,30 +575,55 @@ customMethodCalls = { 'thisType': 'nsINode', 'arg0Type': 'nsINode', 'arg1Type': 'nsINode', - 'code': ' nsINode *result = self->InsertBefore(arg0, arg1, &rv);\n' - ' if(NS_FAILED(rv))\n' - ' result = nullptr;' + 'code': ' nsINode* result;' + ' if (arg0) {\n' + ' mozilla::ErrorResult error;\n' + ' result = self->InsertBefore(*arg0, arg1, error);\n' + ' rv = error.ErrorCode();\n' + ' } else {\n' + ' rv = NS_ERROR_NULL_POINTER;\n' + ' result = nullptr;\n' + ' }' }, 'nsIDOMNode_ReplaceChild': { 'thisType': 'nsINode', 'arg0Type': 'nsINode', 'arg1Type': 'nsINode', - 'code': ' nsINode *result = self->ReplaceChild(arg0, arg1, &rv);\n' - ' if(NS_FAILED(rv))\n' - ' result = nullptr;' + 'code': ' nsINode* result;' + ' if (arg0 && arg1) {\n' + ' mozilla::ErrorResult error;\n' + ' result = self->ReplaceChild(*arg0, *arg1, error);\n' + ' rv = error.ErrorCode();\n' + ' } else {\n' + ' rv = NS_ERROR_NULL_POINTER;\n' + ' result = nullptr;\n' + ' }' }, 'nsIDOMNode_RemoveChild': { 'thisType': 'nsINode', 'arg0Type': 'nsINode', - 'code': ' rv = self->RemoveChild(arg0);\n' - ' nsINode *result = NS_SUCCEEDED(rv) ? arg0 : nullptr;' + 'code': ' nsINode* result;\n' + ' if (arg0) {\n' + ' mozilla::ErrorResult error;\n' + ' result = self->RemoveChild(*arg0, error);\n' + ' rv = error.ErrorCode();\n' + ' } else {\n' + ' rv = NS_ERROR_NULL_POINTER;\n' + ' result = nullptr;\n' + ' }' }, 'nsIDOMNode_AppendChild': { 'thisType': 'nsINode', 'arg0Type': 'nsINode', - 'code': ' nsINode *result = self->AppendChild(arg0, &rv);\n' - ' if(NS_FAILED(rv))\n' - ' result = nullptr;' + 'code': ' nsINode* result;\n' + ' if (arg0) {\n' + ' mozilla::ErrorResult error;\n' + ' result = self->AppendChild(*arg0, error);\n' + ' rv = error.ErrorCode();\n' + ' } else {\n' + ' rv = NS_ERROR_NULL_POINTER;\n' + ' result = nullptr;\n' + ' }' }, 'nsIDOMNode_GetNodeType': { 'thisType': 'nsINode', @@ -766,7 +791,12 @@ customMethodCalls = { 'thisType': 'nsINode', 'arg0Type': 'nsINode', 'code': ' uint16_t result;\n' - ' rv = self->CompareDocPosition(arg0, &result);', + ' if (arg0) {\n' + ' result = self->CompareDocumentPosition(*arg0);\n' + ' rv = NS_OK;\n' + ' } else {\n' + ' rv = NS_ERROR_INVALID_ARG;\n' + ' }', 'canFail': True }, 'nsIDOMNode_GetTextContent': { @@ -779,6 +809,7 @@ customMethodCalls = { }, 'nsIDOMNode_IsDefaultNamespace': { 'thisType': 'nsINode', + 'code': ' bool result = self->IsDefaultNamespace(arg0);', 'canFail': False }, 'nsIDOMNode_LookupNamespaceURI': { @@ -788,7 +819,7 @@ customMethodCalls = { 'nsIDOMNode_IsEqualNode': { 'thisType': 'nsINode', 'arg0Type': 'nsINode', - 'code': ' bool result = self->IsEqualTo(arg0);', + 'code': ' bool result = self->IsEqualNode(arg0);', 'canFail': False }, 'nsIDOMNode_GetUserData': { diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 15a40086734..eeb23eddbf1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -9370,7 +9370,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent, return rv; } - nsINode* containerNode = aContent->GetNodeParent(); + nsINode* containerNode = aContent->GetParentNode(); // XXXbz how can containerNode be null here? if (containerNode) { // Before removing the frames associated with the content object, diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 995db67be6c..9e203523788 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -717,7 +717,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1, nsAutoTArray content1Ancestors; nsINode* c1; - for (c1 = aContent1; c1 && c1 != aCommonAncestor; c1 = c1->GetNodeParent()) { + for (c1 = aContent1; c1 && c1 != aCommonAncestor; c1 = c1->GetParentNode()) { content1Ancestors.AppendElement(c1); } if (!c1 && aCommonAncestor) { @@ -728,7 +728,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1, nsAutoTArray content2Ancestors; nsINode* c2; - for (c2 = aContent2; c2 && c2 != aCommonAncestor; c2 = c2->GetNodeParent()) { + for (c2 = aContent2; c2 && c2 != aCommonAncestor; c2 = c2->GetParentNode()) { content2Ancestors.AppendElement(c2); } if (!c2 && aCommonAncestor) { @@ -764,7 +764,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1, } // content1Ancestor != content2Ancestor, so they must be siblings with the same parent - nsINode* parent = content1Ancestor->GetNodeParent(); + nsINode* parent = content1Ancestor->GetParentNode(); #ifdef DEBUG // TODO: remove the uglyness, see bug 598468. NS_ASSERTION(gPreventAssertInCompareTreePosition || parent, diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index e07a82d7d76..709d99c302e 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -2376,7 +2376,7 @@ GetEqualNodeInCloneTree(nsIDOMNode* aNode, nsIDocument* aDoc) nsINode* current = node; NS_ENSURE_TRUE(current, nullptr); while (current) { - nsINode* parent = current->GetNodeParent(); + nsINode* parent = current->GetParentNode(); if (!parent) { break; } diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 286840f91d0..f761412a46f 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -3249,14 +3249,14 @@ AncestorFilter::Init(Element *aElement) if (NS_LIKELY(aElement)) { MOZ_ASSERT(aElement->IsInDoc(), "aElement must be in the document for the assumption that " - "GetNodeParent() is non-null on all element ancestors of " + "GetParentNode() is non-null on all element ancestors of " "aElement to be true"); // Collect up the ancestors nsAutoTArray ancestors; Element* cur = aElement; do { ancestors.AppendElement(cur); - nsINode* parent = cur->GetNodeParent(); + nsINode* parent = cur->GetParentNode(); if (!parent->IsElement()) { break; } @@ -3325,10 +3325,10 @@ AncestorFilter::PopAncestor() void AncestorFilter::AssertHasAllAncestors(Element *aElement) const { - nsINode* cur = aElement->GetNodeParent(); + nsINode* cur = aElement->GetParentNode(); while (cur && cur->IsElement()) { MOZ_ASSERT(mElements.Contains(cur)); - cur = cur->GetNodeParent(); + cur = cur->GetParentNode(); } } #endif