From 600f8acfd4ab8399782f5e54e7b93335638b4649 Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Fri, 5 Mar 2004 23:13:50 +0000 Subject: [PATCH] Bug 236612: Kill nsGenericContainerElement. r/sr=jst git-svn-id: svn://10.0.0.236/trunk@153595 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/base/src/nsDocumentFragment.cpp | 45 +++++---- mozilla/content/base/src/nsGenericElement.cpp | 80 +++++++--------- mozilla/content/base/src/nsGenericElement.h | 94 ++++++++----------- .../html/content/src/nsGenericHTMLElement.cpp | 17 ++-- .../html/content/src/nsGenericHTMLElement.h | 6 +- .../content/svg/content/src/nsSVGElement.cpp | 24 ----- .../content/svg/content/src/nsSVGElement.h | 4 - .../content/xml/content/src/nsXMLElement.cpp | 45 ++++----- .../content/xml/content/src/nsXMLElement.h | 6 +- 9 files changed, 126 insertions(+), 195 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentFragment.cpp b/mozilla/content/base/src/nsDocumentFragment.cpp index 0e0e3e57f0c..8d9b6579838 100644 --- a/mozilla/content/base/src/nsDocumentFragment.cpp +++ b/mozilla/content/base/src/nsDocumentFragment.cpp @@ -50,7 +50,7 @@ #include "nsLayoutAtoms.h" -class nsDocumentFragment : public nsGenericContainerElement, +class nsDocumentFragment : public nsGenericElement, public nsIDocumentFragment, public nsIDOM3Node { @@ -68,24 +68,24 @@ public: // interface nsIDOMDocumentFragment NS_IMETHOD GetNodeName(nsAString& aNodeName) - { return nsGenericContainerElement::GetNodeName(aNodeName); } + { return nsGenericElement::GetNodeName(aNodeName); } NS_IMETHOD GetNodeValue(nsAString& aNodeValue) - { return nsGenericContainerElement::GetNodeValue(aNodeValue); } + { return nsGenericElement::GetNodeValue(aNodeValue); } NS_IMETHOD SetNodeValue(const nsAString& aNodeValue) - { return nsGenericContainerElement::SetNodeValue(aNodeValue); } + { return nsGenericElement::SetNodeValue(aNodeValue); } NS_IMETHOD GetNodeType(PRUint16* aNodeType); NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) - { return nsGenericContainerElement::GetParentNode(aParentNode); } + { return nsGenericElement::GetParentNode(aParentNode); } NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) - { return nsGenericContainerElement::GetChildNodes(aChildNodes); } + { return nsGenericElement::GetChildNodes(aChildNodes); } NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) - { return nsGenericContainerElement::GetFirstChild(aFirstChild); } + { return nsGenericElement::GetFirstChild(aFirstChild); } NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) - { return nsGenericContainerElement::GetLastChild(aLastChild); } + { return nsGenericElement::GetLastChild(aLastChild); } NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) - { return nsGenericContainerElement::GetPreviousSibling(aPreviousSibling); } + { return nsGenericElement::GetPreviousSibling(aPreviousSibling); } NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) - { return nsGenericContainerElement::GetNextSibling(aNextSibling); } + { return nsGenericElement::GetNextSibling(aNextSibling); } NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { *aAttributes = nsnull; @@ -94,35 +94,32 @@ public: NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument); NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) - { return nsGenericContainerElement::InsertBefore(aNewChild, aRefChild, - aReturn); } + { return nsGenericElement::InsertBefore(aNewChild, aRefChild, aReturn); } NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) - { return nsGenericContainerElement::ReplaceChild(aNewChild, aOldChild, - aReturn); } + { return nsGenericElement::ReplaceChild(aNewChild, aOldChild, aReturn); } NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) - { return nsGenericContainerElement::RemoveChild(aOldChild, aReturn); } + { return nsGenericElement::RemoveChild(aOldChild, aReturn); } NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) - { return nsGenericContainerElement::AppendChild(aNewChild, aReturn); } + { return nsGenericElement::AppendChild(aNewChild, aReturn); } NS_IMETHOD HasChildNodes(PRBool* aReturn) - { return nsGenericContainerElement::HasChildNodes(aReturn); } + { return nsGenericElement::HasChildNodes(aReturn); } NS_IMETHOD HasAttributes(PRBool* aReturn) - { return nsGenericContainerElement::HasAttributes(aReturn); } + { return nsGenericElement::HasAttributes(aReturn); } NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); NS_IMETHOD GetPrefix(nsAString& aPrefix) - { return nsGenericContainerElement::GetPrefix(aPrefix); } + { return nsGenericElement::GetPrefix(aPrefix); } NS_IMETHOD SetPrefix(const nsAString& aPrefix); NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) - { return nsGenericContainerElement::GetNamespaceURI(aNamespaceURI); } + { return nsGenericElement::GetNamespaceURI(aNamespaceURI); } NS_IMETHOD GetLocalName(nsAString& aLocalName) - { return nsGenericContainerElement::GetLocalName(aLocalName); } + { return nsGenericElement::GetLocalName(aLocalName); } NS_IMETHOD Normalize() - { return nsGenericContainerElement::Normalize(); } + { return nsGenericElement::Normalize(); } NS_IMETHOD IsSupported(const nsAString& aFeature, const nsAString& aVersion, PRBool* aReturn) - { return nsGenericContainerElement::IsSupported(aFeature, aVersion, - aReturn); } + { return nsGenericElement::IsSupported(aFeature, aVersion, aReturn); } // nsIDOM3Node NS_DECL_NSIDOM3NODE diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 5f23715bbc1..fa9f59bdbfd 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -3218,15 +3218,14 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute, //---------------------------------------------------------------------- const nsAttrName* -nsGenericContainerElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const +nsGenericElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const { return mAttrsAndChildren.GetExistingAttrNameFromQName( NS_ConvertUTF16toUTF8(aStr)); } nsresult -nsGenericContainerElement::CopyInnerTo(nsGenericContainerElement* aDst, - PRBool aDeep) +nsGenericElement::CopyInnerTo(nsGenericElement* aDst, PRBool aDeep) { nsresult rv; PRUint32 i, count = mAttrsAndChildren.AttrCount(); @@ -3312,9 +3311,9 @@ nsGenericElement::HasMutationListeners(nsIContent* aContent, PRUint32 aType) } nsresult -nsGenericContainerElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify) +nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, + nsIAtom* aPrefix, const nsAString& aValue, + PRBool aNotify) { NS_ENSURE_ARG_POINTER(aName); NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown, @@ -3411,8 +3410,8 @@ nsGenericContainerElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, } nsresult -nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const +nsGenericElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, @@ -3435,7 +3434,7 @@ nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, } PRBool -nsGenericContainerElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const +nsGenericElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, @@ -3445,8 +3444,8 @@ nsGenericContainerElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const } nsresult -nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID, - nsIAtom* aName, PRBool aNotify) +nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify) { NS_ASSERTION(nsnull != aName, "must have attribute name"); @@ -3506,10 +3505,8 @@ nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID, } nsresult -nsGenericContainerElement::GetAttrNameAt(PRUint32 aIndex, - PRInt32* aNameSpaceID, - nsIAtom** aName, - nsIAtom** aPrefix) const +nsGenericElement::GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const { const nsAttrName* name = mAttrsAndChildren.GetSafeAttrNameAt(aIndex); if (name) { @@ -3528,18 +3525,28 @@ nsGenericContainerElement::GetAttrNameAt(PRUint32 aIndex, } PRUint32 -nsGenericContainerElement::GetAttrCount() const +nsGenericElement::GetAttrCount() const { return mAttrsAndChildren.AttrCount(); } #ifdef DEBUG void -nsGenericContainerElement::ListAttributes(FILE* out) const +nsGenericElement::List(FILE* out, PRInt32 aIndent) const { - PRUint32 index, count = mAttrsAndChildren.AttrCount(); + NS_PRECONDITION(nsnull != mDocument, "bad content"); - for (index = 0; index < count; index++) { + PRInt32 index; + for (index = aIndent; --index >= 0; ) fputs(" ", out); + + nsAutoString buf; + mNodeInfo->GetQualifiedName(buf); + fputs(NS_LossyConvertUCS2toASCII(buf).get(), out); + + fprintf(out, "@%p", this); + + PRUint32 attrcount = mAttrsAndChildren.AttrCount(); + for (index = 0; index < attrcount; index++) { nsAutoString buffer; // name @@ -3554,23 +3561,6 @@ nsGenericContainerElement::ListAttributes(FILE* out) const fputs(" ", out); fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); } -} - -void -nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const -{ - NS_PRECONDITION(nsnull != mDocument, "bad content"); - - PRInt32 index; - for (index = aIndent; --index >= 0; ) fputs(" ", out); - - nsAutoString buf; - mNodeInfo->GetQualifiedName(buf); - fputs(NS_LossyConvertUCS2toASCII(buf).get(), out); - - fprintf(out, "@%p", this); - - ListAttributes(out); fprintf(out, " refcount=%d<", mRefCnt.get()); @@ -3591,7 +3581,7 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const nsIBindingManager* bindingManager = mDocument->GetBindingManager(); if (bindingManager) { nsCOMPtr anonymousChildren; - bindingManager->GetAnonymousNodesFor(NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsGenericContainerElement*, this)), + bindingManager->GetAnonymousNodesFor(NS_CONST_CAST(nsGenericElement*, this), getter_AddRefs(anonymousChildren)); if (anonymousChildren) { @@ -3614,12 +3604,12 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const } PRBool hasContentList; - bindingManager->HasContentListFor(NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsGenericContainerElement*, this)), + bindingManager->HasContentListFor(NS_CONST_CAST(nsGenericElement*, this), &hasContentList); if (hasContentList) { nsCOMPtr contentList; - bindingManager->GetContentListFor(NS_STATIC_CAST(nsIContent*, NS_CONST_CAST(nsGenericContainerElement*, this)), + bindingManager->GetContentListFor(NS_CONST_CAST(nsGenericElement*, this), getter_AddRefs(contentList)); NS_ASSERTION(contentList != nsnull, "oops, binding manager lied"); @@ -3646,32 +3636,32 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const } void -nsGenericContainerElement::DumpContent(FILE* out, PRInt32 aIndent, - PRBool aDumpAll) const +nsGenericElement::DumpContent(FILE* out, PRInt32 aIndent, + PRBool aDumpAll) const { } #endif PRBool -nsGenericContainerElement::CanContainChildren() const +nsGenericElement::CanContainChildren() const { return PR_TRUE; } PRUint32 -nsGenericContainerElement::GetChildCount() const +nsGenericElement::GetChildCount() const { return mAttrsAndChildren.ChildCount(); } nsIContent * -nsGenericContainerElement::GetChildAt(PRUint32 aIndex) const +nsGenericElement::GetChildAt(PRUint32 aIndex) const { return mAttrsAndChildren.GetSafeChildAt(aIndex); } PRInt32 -nsGenericContainerElement::IndexOf(nsIContent* aPossibleChild) const +nsGenericElement::IndexOf(nsIContent* aPossibleChild) const { NS_PRECONDITION(nsnull != aPossibleChild, "null ptr"); diff --git a/mozilla/content/base/src/nsGenericElement.h b/mozilla/content/base/src/nsGenericElement.h index 0e19b696eec..a61d292d12d 100644 --- a/mozilla/content/base/src/nsGenericElement.h +++ b/mozilla/content/base/src/nsGenericElement.h @@ -371,9 +371,35 @@ public: virtual void GetNameSpaceID(PRInt32* aNameSpaceID) const; virtual nsIAtom *Tag() const; virtual nsINodeInfo *GetNodeInfo() const; + virtual PRBool CanContainChildren() const; + virtual PRUint32 GetChildCount() const; + virtual nsIContent *GetChildAt(PRUint32 aIndex) const; + virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; + virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, + PRBool aNotify, PRBool aDeepSetDocument); + virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); virtual nsIAtom *GetIDAttributeName() const; virtual nsIAtom *GetClassAttributeName() const; virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) + { + return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify); + } + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix, + const nsAString& aValue, PRBool aNotify); + virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAString& aResult) const; + virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, + nsIAtom** aName, nsIAtom** aPrefix) const; + virtual PRUint32 GetAttrCount() const; virtual nsresult RangeAdd(nsIDOMRange* aRange); virtual void RangeRemove(nsIDOMRange* aRange); virtual const nsVoidArray *GetRangeList() const; @@ -390,14 +416,10 @@ public: virtual PRBool IsContentOfType(PRUint32 aFlags) const; virtual nsresult GetListenerManager(nsIEventListenerManager** aResult); virtual already_AddRefed GetBaseURI() const; - - virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument); - virtual nsresult ReplaceChildAt(nsIContent* aKid, PRUint32 aIndex, - PRBool aNotify, PRBool aDeepSetDocument); - virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, - PRBool aDeepSetDocument); - virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); +#ifdef DEBUG + virtual void List(FILE* out, PRInt32 aIndent) const; + virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; +#endif // nsIStyledContent interface methods NS_IMETHOD GetID(nsIAtom** aResult) const; @@ -619,10 +641,17 @@ public: static PLDHashTable sRangeListsHash; protected: + /** + * Copy attributes and children from another content object + * @param aSrcContent the object to copy from + * @param aDeep whether to copy children + */ + nsresult CopyInnerTo(nsGenericElement* aDest, PRBool aDeep); + /** * Internal hook for converting an attribute name-string to an atomized name */ - virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const = 0; + virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const; PRBool HasDOMSlots() const { @@ -743,53 +772,6 @@ protected: nsAttrAndChildArray mAttrsAndChildren; }; -/** - * A generic element that contains children - */ -class nsGenericContainerElement : public nsGenericElement { -public: - - /** - * Copy attributes and children from another content object - * @param aSrcContent the object to copy from - * @param aDest the destination object - * @param aDeep whether to copy children - */ - nsresult CopyInnerTo(nsGenericContainerElement* aDest, PRBool aDeep); - - // Remainder of nsIContent - nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsAString& aValue, PRBool aNotify) - { - return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify); - } - virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix, - const nsAString& aValue, PRBool aNotify); - virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsAString& aResult) const; - virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; - virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRBool aNotify); - virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID, - nsIAtom** aName, nsIAtom** aPrefix) const; - virtual PRUint32 GetAttrCount() const; -#ifdef DEBUG - virtual void List(FILE* out, PRInt32 aIndent) const; - virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; -#endif - virtual PRBool CanContainChildren() const; - virtual PRUint32 GetChildCount() const; - virtual nsIContent *GetChildAt(PRUint32 aIndex) const; - virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; - - virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const; - -#ifdef DEBUG - void ListAttributes(FILE* out) const; -#endif -}; - - // Internal non-public interface // IID for the nsIDocumentFragment interface diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 582c926550f..af6ea4b9858 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -186,7 +186,7 @@ nsGenericHTMLElement::Init(nsINodeInfo *aNodeInfo) { GEUS_ElementCreated(aNodeInfo); - return nsGenericContainerElement::Init(aNodeInfo); + return nsGenericElement::Init(aNodeInfo); } #endif @@ -230,7 +230,7 @@ static NS_DEFINE_CID(kCSSOMFactoryCID, NS_CSSOMFACTORY_CID); NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement) NS_INTERFACE_MAP_ENTRY(nsIHTMLContent) -NS_INTERFACE_MAP_END_INHERITING(nsGenericContainerElement) +NS_INTERFACE_MAP_END_INHERITING(nsGenericElement) nsresult @@ -271,8 +271,7 @@ nsGenericHTMLElement::Shutdown() } nsresult -nsGenericHTMLElement::CopyInnerTo(nsGenericContainerElement* aDst, - PRBool aDeep) +nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst, PRBool aDeep) { nsresult rv = NS_OK; PRInt32 i, count = GetAttrCount(); @@ -418,7 +417,7 @@ nsGenericHTMLElement::GetElementsByTagName(const nsAString& aTagname, if (mNodeInfo && mNodeInfo->NamespaceEquals(kNameSpaceID_None)) ToLowerCase(tagName); - return nsGenericContainerElement::GetElementsByTagName(tagName, aReturn); + return nsGenericElement::GetElementsByTagName(tagName, aReturn); } // Implementation for nsIDOMHTMLElement @@ -1275,8 +1274,7 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, { PRBool doNothing = aDocument == mDocument; // short circuit useless work - nsGenericContainerElement::SetDocument(aDocument, aDeep, - aCompileEventHandlers); + nsGenericElement::SetDocument(aDocument, aDeep, aCompileEventHandlers); ReparseStyleAttribute(); if (!doNothing && mDocument) { @@ -1742,8 +1740,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, } } - return nsGenericContainerElement::UnsetAttr(aNameSpaceID, aAttribute, - aNotify); + return nsGenericElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); } nsresult @@ -1983,7 +1980,7 @@ nsGenericHTMLElement::GetBaseURI() const return nsnull; } - return nsGenericContainerElement::GetBaseURI(); + return nsGenericElement::GetBaseURI(); } void diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index ce4c6e68013..9dac831b44a 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -73,7 +73,7 @@ struct nsSize; /** * A common superclass for HTML elements */ -class nsGenericHTMLElement : public nsGenericContainerElement +class nsGenericHTMLElement : public nsGenericElement { public: #ifdef GATHER_ELEMENT_USEAGE_STATISTICS @@ -97,8 +97,8 @@ public: nsresult DOMQueryInterface(nsIDOMHTMLElement *aElement, REFNSIID aIID, void **aInstancePtr); - // From nsGenericContainerElement - nsresult CopyInnerTo(nsGenericContainerElement* aDest, PRBool aDeep); + // From nsGenericElement + nsresult CopyInnerTo(nsGenericElement* aDest, PRBool aDeep); // Implementation for nsIDOMNode NS_METHOD GetNodeName(nsAString& aNodeName); diff --git a/mozilla/content/svg/content/src/nsSVGElement.cpp b/mozilla/content/svg/content/src/nsSVGElement.cpp index 26be5f78539..557ae7e20b1 100644 --- a/mozilla/content/svg/content/src/nsSVGElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGElement.cpp @@ -123,30 +123,6 @@ nsSVGElement::SetParent(nsIContent* aParent) ParentChainChanged(); } -PRBool -nsSVGElement::CanContainChildren() const -{ - return PR_TRUE; -} - -PRUint32 -nsSVGElement::GetChildCount() const -{ - return mAttrsAndChildren.ChildCount(); -} - -nsIContent * -nsSVGElement::GetChildAt(PRUint32 aIndex) const -{ - return mAttrsAndChildren.GetSafeChildAt(aIndex); -} - -PRInt32 -nsSVGElement::IndexOf(nsIContent* aPossibleChild) const -{ - return mAttrsAndChildren.IndexOfChild(aPossibleChild); -} - nsIAtom * nsSVGElement::GetIDAttributeName() const { diff --git a/mozilla/content/svg/content/src/nsSVGElement.h b/mozilla/content/svg/content/src/nsSVGElement.h index 53365a42e01..801a2ff75d6 100644 --- a/mozilla/content/svg/content/src/nsSVGElement.h +++ b/mozilla/content/svg/content/src/nsSVGElement.h @@ -74,10 +74,6 @@ public: // nsIContent interface methods virtual void SetParent(nsIContent* aParent); - virtual PRBool CanContainChildren() const; - virtual PRUint32 GetChildCount() const; - virtual nsIContent *GetChildAt(PRUint32 aIndex) const; - virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const; virtual nsIAtom *GetIDAttributeName() const; nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString& aValue, PRBool aNotify) diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index 61a7d2046d9..3c8506bd639 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -112,7 +112,7 @@ nsXMLElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ENSURE_ARG_POINTER(aInstancePtr); *aInstancePtr = nsnull; - nsresult rv = nsGenericContainerElement::QueryInterface(aIID, aInstancePtr); + nsresult rv = nsGenericElement::QueryInterface(aIID, aInstancePtr); if (NS_SUCCEEDED(rv)) return rv; @@ -159,8 +159,8 @@ nsXMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix, // We will check for actuate="onLoad" in MaybeTriggerAutoLink } - return nsGenericContainerElement::SetAttr(aNameSpaceID, aName, aPrefix, - aValue, aNotify); + return nsGenericElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue, + aNotify); } static nsresult @@ -210,9 +210,8 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) do { // actuate="onLoad" ? nsAutoString value; - rv = nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsLayoutAtoms::actuate, - value); + rv = nsGenericElement::GetAttr(kNameSpaceID_XLink, + nsLayoutAtoms::actuate, value); if (rv == NS_CONTENT_ATTR_HAS_VALUE && value.Equals(onloadString)) { @@ -234,8 +233,8 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) // show= ? nsLinkVerb verb = eLinkVerb_Undefined; // basically means same as replace - rv = nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsLayoutAtoms::show, value); + rv = nsGenericElement::GetAttr(kNameSpaceID_XLink, + nsLayoutAtoms::show, value); if (NS_FAILED(rv)) break; @@ -276,9 +275,8 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) break; // href= ? - rv = nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsHTMLAtoms::href, - value); + rv = nsGenericElement::GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, + value); if (rv == NS_CONTENT_ATTR_HAS_VALUE && !value.IsEmpty()) { nsCOMPtr uri; rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), @@ -312,11 +310,9 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, { NS_ENSURE_ARG_POINTER(aEventStatus); // Try script event handlers first - nsresult ret = nsGenericContainerElement::HandleDOMEvent(aPresContext, - aEvent, - aDOMEvent, - aFlags, - aEventStatus); + nsresult ret = nsGenericElement::HandleDOMEvent(aPresContext, aEvent, + aDOMEvent, aFlags, + aEventStatus); if (mIsLink && (NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) && !(aFlags & NS_EVENT_FLAG_CAPTURE) && !(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT)) { @@ -340,17 +336,15 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, } nsAutoString show, href; nsLinkVerb verb = eLinkVerb_Undefined; // basically means same as replace - nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsHTMLAtoms::href, - href); + nsGenericElement::GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, + href); if (href.IsEmpty()) { *aEventStatus = nsEventStatus_eConsumeDoDefault; break; } - nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsLayoutAtoms::show, - show); + nsGenericElement::GetAttr(kNameSpaceID_XLink, nsLayoutAtoms::show, + show); // XXX Should probably do this using atoms if (show.Equals(NS_LITERAL_STRING("new"))) { @@ -421,9 +415,8 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext, case NS_MOUSE_ENTER_SYNTH: { nsAutoString href; - nsGenericContainerElement::GetAttr(kNameSpaceID_XLink, - nsHTMLAtoms::href, - href); + nsGenericElement::GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, + href); if (href.IsEmpty()) { *aEventStatus = nsEventStatus_eConsumeDoDefault; break; @@ -501,7 +494,7 @@ nsXMLElement::GetID(nsIAtom** aResult) const nsresult rv = NS_OK; if (atom) { nsAutoString value; - rv = nsGenericContainerElement::GetAttr(kNameSpaceID_None, atom, value); + rv = nsGenericElement::GetAttr(kNameSpaceID_None, atom, value); if (NS_SUCCEEDED(rv)) { *aResult = NS_NewAtom(value); } diff --git a/mozilla/content/xml/content/src/nsXMLElement.h b/mozilla/content/xml/content/src/nsXMLElement.h index b5483450991..2c11fb63100 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.h +++ b/mozilla/content/xml/content/src/nsXMLElement.h @@ -51,7 +51,7 @@ class nsIEventListenerManager; class nsIURI; class nsIDocShell; -class nsXMLElement : public nsGenericContainerElement, +class nsXMLElement : public nsGenericElement, public nsIDOMElement { public: @@ -62,10 +62,10 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericContainerElement::) + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericElement::) // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericContainerElement::) + NS_FORWARD_NSIDOMELEMENT(nsGenericElement::) // nsIXMLContent NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);