Fix for bug 773780 (Add API for new DOM bindings for Node). r=bz.

--HG--
extra : rebase_source : 5dd51c4ad5274da9235c8c341b0531f234e95a91
This commit is contained in:
Peter Van der Beken 2012-10-09 14:31:24 +02:00
parent 350f7dd89a
commit 57adeb4354
179 changed files with 1147 additions and 1484 deletions

View File

@ -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)) {

View File

@ -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<nsIContent>* 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!");

View File

@ -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;

View File

@ -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;
}

View File

@ -269,7 +269,7 @@ public:
*/
Accessible* GetContainerAccessible(nsINode* aNode)
{
return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nullptr;
return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
}
/**

View File

@ -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);
}

View File

@ -409,7 +409,7 @@ __try {
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(node->GetNodeParent());
*aNode = MakeAccessNode(node->GetParentNode());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -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<nsIContent> content(do_QueryInterface(parent));
if (!content)
return false;

View File

@ -156,7 +156,7 @@ nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue)
void
nsXFormsComboboxPopupWidgetAccessible::CacheChildren()
{
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetNodeParent());
nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetParentNode());
// Parent node must be an xforms:select1 element.
CacheSelectChildren(parent);
}

View File

@ -348,4 +348,9 @@ inline const mozilla::dom::Element* nsINode::AsElement() const
return static_cast<const mozilla::dom::Element*>(this);
}
inline bool nsINode::HasAttributes() const
{
return IsElement() && AsElement()->GetAttrCount() > 0;
}
#endif // mozilla_dom_Element_h__

View File

@ -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<nsINodeList> 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

View File

@ -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;

View File

@ -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)

View File

@ -27,7 +27,7 @@ public:
return mAttrMap;
}
nsINodeInfo *NodeInfo()
nsINodeInfo *NodeInfo() const
{
return mNodeInfo;
}

View File

@ -1721,6 +1721,11 @@ public:
}
}
bool CreatingStaticClone() const
{
return mCreatingStaticClone;
}
private:
uint64_t mWarnedAbout;

View File

@ -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<typename T> 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<nsIURI> GetBaseURI() const = 0;
already_AddRefed<nsIURI> 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<nsINode> 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<nsINode> 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___ */

View File

@ -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<nsINodeList>
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<nsINode> child;
for (child = GetFirstChild();
child && child->GetNodeParent() == this;
child && child->GetParentNode() == this;
child = child->GetNextSibling()) {
nsContentUtils::MaybeFireNodeRemoved(child, this, doc);
}

View File

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)

View File

@ -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<int32_t>* 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<int32_t>* 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(

View File

@ -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()) {

View File

@ -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<nsINode*, 30> 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<nsINode> 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;

View File

@ -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<nsIDOMAttr*>(this),
aFeature, aVersion);
return NS_OK;
}
already_AddRefed<nsIURI>
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

View File

@ -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

View File

@ -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();

View File

@ -485,7 +485,7 @@ nsDOMMutationObserver::GetAllSubtreeObserversFor(nsINode* aNode,
}
}
}
n = n->GetNodeParent();
n = n->GetParentNode();
}
}

View File

@ -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<nsIDOMNode> newNode;
nsCOMPtr<nsINode> newNode;
nsCOMArray<nsINode> 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<nsIDOMDocument*>(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<nsINode> parent = adoptedNode->GetNodeParent();
nsCOMPtr<nsINode> 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)
{

View File

@ -735,7 +735,7 @@ private:
public:
// nsIDOMNode
NS_DECL_NSIDOMNODE
NS_FORWARD_NSIDOMNODE_TO_NSINODE_OVERRIDABLE
// nsIDOMDocument
NS_DECL_NSIDOMDOCUMENT

View File

@ -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-<tr> to a <tr>
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 <tr> to a non-<tr>
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);

View File

@ -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

View File

@ -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<nsresult> 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<nsIContent*>(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<nsINode> parent = GetNodeParent();
nsCOMPtr<nsINode> parent = GetParentNode();
if (parent) {
int32_t insertionIndex = parent->IndexOf(this);
if (aCloneAfterOriginal) {

View File

@ -58,73 +58,9 @@ public:
nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> 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;
}

View File

@ -934,12 +934,11 @@ nsGenericElement::GetAttributeNode(const nsAString& aName,
document->WarnOnceAbout(nsIDocument::eGetAttributeNode);
}
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> 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<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> 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<nsIDOMNamedNodeMap> 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<nsIDOMNode> node;
rv = map->RemoveNamedItem(name, getter_AddRefs(node));
@ -1094,12 +1091,12 @@ nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMAttr** aReturn)
{
nsCOMPtr<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> 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<nsIDOMNamedNodeMap> map;
nsresult rv = GetAttributes(getter_AddRefs(map));
NS_ENSURE_SUCCESS(rv, rv);
nsDOMAttributeMap* map = GetAttributes();
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> returnNode;
rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode));
nsresult rv = map->SetNamedItemNS(aNewAttr, getter_AddRefs(returnNode));
NS_ENSURE_SUCCESS(rv, rv);
if (returnNode) {

View File

@ -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;
}
//----------------------------------------

View File

@ -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<nsINode> newChild = do_QueryInterface(aNewChild);
nsresult rv;
nsCOMPtr<nsINode> 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<nsIContent> oldChild = do_QueryInterface(aOldChild);
nsresult rv = RemoveChild(oldChild);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsINode> 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<nsINode> parent = node->GetNodeParent();
nsCOMPtr<nsINode> 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<nsIURI> 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<nsIVariant> data;
aError = nsContentUtils::XPConnect()->JSValToVariant(aCx, &aData,
getter_AddRefs(data));
if (aError.Failed()) {
return JS::UndefinedValue();
}
if (this == aOtherNode) {
nsCOMPtr<nsIVariant> 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<nsINode*, 32> parents1, parents2;
nsAutoTArray<const nsINode*, 32> 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<nsIAttribute*>(node1);
nsIContent* elem = attr1->GetContent();
attr1 = static_cast<const nsIAttribute*>(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<nsINode*>(attr1));
parents1.AppendElement(attr1);
}
}
if (node2->IsNodeOfType(nsINode::eATTRIBUTE)) {
nsIAttribute* attr2 = static_cast<nsIAttribute*>(node2);
nsIContent* elem = attr2->GetContent();
const nsIAttribute* attr2 = static_cast<const nsIAttribute*>(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<nsINode*>(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<nsIDOMNode> domNode1 = do_QueryInterface(node1);
nsCOMPtr<nsIDOMNode> 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<nsGenericElement*>(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<nsAutoTArray<nsCOMPtr<nsIContent>, 50> > fragChildren;
// Remove the new child from the old parent if one exists
nsCOMPtr<nsINode> oldParent = newContent->GetNodeParent();
nsCOMPtr<nsINode> 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<nsIContent*>(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<nsINode> newChild = do_QueryInterface(aNewChild);
if (!newChild) {
return NS_ERROR_NULL_POINTER;
}
if (aReplace && !aRefChild) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsINode> 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<nsINode> 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<nsINode> other = do_QueryInterface(aOther);
*aReturn = IsEqualTo(other);
*aReturn = IsEqualNode(other);
return NS_OK;
}
@ -2241,3 +2291,80 @@ nsINode::QuerySelectorAll(const nsAString& aSelector,
return FindMatchingElements<false>(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<true>(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<nsGenericElement*>(GetElementParent());
}
already_AddRefed<nsINode>
nsINode::CloneNode(bool aDeep, ErrorResult& aError)
{
bool callUserDataHandlers = NodeType() != nsIDOMNode::DOCUMENT_NODE ||
!static_cast<nsIDocument*>(this)->CreatingStaticClone();
nsCOMPtr<nsINode> result;
aError = nsNodeUtils::CloneNodeImpl(this, aDeep, callUserDataHandlers,
getter_AddRefs(result));
return result.forget();
}
nsDOMAttributeMap*
nsINode::GetAttributes()
{
if (!IsElement()) {
return nullptr;
}
return static_cast<nsGenericElement*>(nsINode::AsElement())->GetAttributes();
}
nsresult
nsINode::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
if (!IsElement()) {
*aAttributes = nullptr;
return NS_OK;
}
return CallQueryInterface(GetAttributes(), aAttributes);
}

View File

@ -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:

View File

@ -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;

View File

@ -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<nsIDOMNode> newNode;
nsCOMPtr<nsINode> newNode;
nsCOMArray<nsINode> nodesWithProperties;
nsresult rv = Clone(aNode, aDeep, nullptr, nodesWithProperties,
getter_AddRefs(newNode));

View File

@ -150,10 +150,10 @@ public:
static nsresult Clone(nsINode *aNode, bool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
nsCOMArray<nsINode> &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<nsINode> &aNodesWithProperties)
{
nsCOMPtr<nsINode> 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<nsINode> &aNodesWithProperties,
nsIDOMNode **aResult)
{
NS_ASSERTION(!aClone == !aResult,
"aResult must be null when adopting and non-null when "
"cloning");
nsCOMPtr<nsINode> 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.

View File

@ -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<RangeHashTable*>(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<uint32_t>(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<nsIContent*>(aStartN)->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(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<nsINode> 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<nsINode> node = do_QueryInterface(aNode);
nsCOMPtr<nsINode> 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<nsINode> 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;

View File

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)

View File

@ -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<nsIContent> 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;
}

View File

@ -135,7 +135,7 @@ NS_IMETHODIMP nsTreeWalker::ParentNode(nsIDOMNode **_retval)
nsCOMPtr<nsINode> 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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -11,7 +11,6 @@ class nsXMLEventsElement : public nsXMLElement {
public:
nsXMLEventsElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsXMLEventsElement();
NS_FORWARD_NSIDOMNODE(nsXMLElement::)
virtual nsIAtom *GetIDAttributeName() const;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,

View File

@ -25,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::)

View File

@ -51,7 +51,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -28,7 +28,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsHTMLMediaElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsHTMLMediaElement::)

View File

@ -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<nsINode*>(this)->AppendChild(fragment, &rv);
aError = rv;
static_cast<nsINode*>(this)->AppendChild(*fragment, aError);
mb.NodesAdded();
}
}
@ -1403,7 +1401,7 @@ nsGenericHTMLElement::SetInnerHTML(const nsAString& aInnerHTML,
NS_IMETHODIMP
nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
{
nsCOMPtr<nsINode> parent = GetNodeParent();
nsCOMPtr<nsINode> 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<nsINode> context;
@ -1463,8 +1462,9 @@ nsGenericHTMLElement::SetOuterHTML(const nsAString& aOuterHTML)
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINode> 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<nsINode*>(this)->InsertBefore(fragment, GetFirstChild(), &rv);
static_cast<nsINode*>(this)->InsertBefore(*fragment, GetFirstChild(), error);
break;
case eBeforeEnd:
static_cast<nsINode*>(this)->AppendChild(fragment, &rv);
static_cast<nsINode*>(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

View File

@ -35,7 +35,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -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::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -62,7 +62,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -63,7 +63,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -25,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -34,7 +34,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -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;
}

View File

@ -40,7 +40,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)

View File

@ -51,7 +51,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -30,7 +30,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)

View File

@ -24,7 +24,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -69,7 +69,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -32,7 +32,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -46,7 +46,7 @@ public:
nsGenericHTMLElement)
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
/* nsIDOMNode */
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
/* nsIDOMElement */
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -20,7 +20,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -43,7 +43,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -20,7 +20,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -33,7 +33,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -29,7 +29,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -28,7 +28,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -43,7 +43,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -248,7 +248,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

View File

@ -41,7 +41,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -38,7 +38,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -25,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -38,7 +38,7 @@ public:
nsGenericHTMLElement)
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -27,7 +27,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -33,7 +33,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -31,7 +31,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -22,7 +22,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -33,7 +33,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -32,7 +32,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)

View File

@ -71,7 +71,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)

Some files were not shown because too many files have changed in this diff Show More