113562 - nsIContent needs HasAttr method, r=jag, sr=jst

git-svn-id: svn://10.0.0.236/trunk@110204 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hewitt%netscape.com
2001-12-11 02:57:52 +00:00
parent daa893108e
commit c5ba8bd720
13 changed files with 130 additions and 32 deletions

View File

@@ -320,6 +320,7 @@ public:
nsHTMLValue& aValue) const;
NS_IMETHOD GetAttribute(nsIAtom* aAttrName,
const nsHTMLValue** aValue) const;
NS_IMETHOD_(PRBool) HasAttribute(nsIAtom* aAttrName) const;
NS_IMETHOD GetAttributeCount(PRInt32& aCount) const;
@@ -626,6 +627,16 @@ nsHTMLMappedAttributes::GetAttribute(nsIAtom* aAttrName,
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLMappedAttributes::HasAttribute(nsIAtom* aAttrName) const
{
if (!aAttrName)
return PR_FALSE;
const HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &mFirst);
return attr != nsnull;
}
NS_IMETHODIMP
nsHTMLMappedAttributes::GetAttributeCount(PRInt32& aCount) const
{
@@ -846,6 +857,8 @@ public:
NS_IMETHOD GetAttribute(nsIAtom* aAttribute,
const nsHTMLValue** aValue) const;
NS_IMETHOD_(PRBool) HasAttribute(nsIAtom* aAttrName) const;
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
nsIAtom*& aName) const;
@@ -1358,6 +1371,18 @@ HTMLAttributesImpl::GetAttribute(nsIAtom* aAttrName,
return result;
}
NS_IMETHODIMP_(PRBool)
HTMLAttributesImpl::HasAttribute(nsIAtom* aAttrName) const
{
if (mMapped)
return mMapped->HasAttribute(aAttrName);
const HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
return attr != nsnull;
}
NS_IMETHODIMP
HTMLAttributesImpl::GetAttributeNameAt(PRInt32 aIndex,
nsIAtom*& aName) const