Updating nsIContent to allow accessin the attribute prefix and not only the attribute name and value.

This commit is contained in:
jst%netscape.com 2000-05-17 00:21:53 +00:00
Родитель 85f7b83808
Коммит b22cf9671a
44 изменённых файлов: 444 добавлений и 139 удалений

Просмотреть файл

@ -176,6 +176,29 @@ public:
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const = 0;
/**
* Get the current value and prefix of the attribute. This returns a form
* that is suitable for passing back into setAttribute.
*
* <UL>
*
* <LI>If the attribute is not set and has no default value, return
* NS_CONTENT_ATTR_NOT_THERE.
*
* <LI>If the attribute exists, but has no value, return
* NS_CONTENT_ATTR_NO_VALUE.
*
* <LI>If the attribute has a value, empty or otherwise, set ret to
* be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
*
* </UL>
*
* NOTE! aPrefix is an OUT parameter.
*/
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const = 0;
/**
* Remove an attribute so that it is no longer explicitly specified.
*
@ -199,7 +222,8 @@ public:
*/
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const = 0;
nsIAtom*& aName,
nsIAtom*& aPrefix) const = 0;
/**
* Get the number of all specified attributes.

Просмотреть файл

@ -123,6 +123,10 @@ public:
nsString &aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult);
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
const nsString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify);
@ -137,8 +141,9 @@ public:
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -473,8 +473,7 @@ nsDOMAttribute::SetPrefix(const nsString& aPrefix)
NS_IMETHODIMP
nsDOMAttribute::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return GetName(aLocalName);
}
NS_IMETHODIMP

Просмотреть файл

@ -255,13 +255,14 @@ nsresult
nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> nameAtom;
nsCOMPtr<nsIAtom> nameAtom, prefix;
nsresult rv = NS_OK;
if (mContent &&
NS_SUCCEEDED(mContent->GetAttributeNameAt(aIndex,
nameSpaceID,
*getter_AddRefs(nameAtom)))) {
*getter_AddRefs(nameAtom),
*getter_AddRefs(prefix)))) {
nsAutoString value, name;
mContent->GetAttribute(nameSpaceID, nameAtom, value);

Просмотреть файл

@ -176,14 +176,19 @@ public:
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify)
{ return NS_OK; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IMETHOD GetAttributeCount(PRInt32& aCountResult) const
@ -378,30 +383,26 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
NS_IMETHODIMP
nsDocumentFragment::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_DOM_NAMESPACE_ERR;
}
NS_IMETHODIMP
nsDocumentFragment::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return GetNodeName(aLocalName);
}

Просмотреть файл

@ -184,9 +184,15 @@ struct nsGenericDOMDataNode {
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {
return NS_CONTENT_ATTR_NOT_THERE;
}
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {
aPrefix = nsnull;
return NS_CONTENT_ATTR_NOT_THERE;
}
nsresult GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
nsIAtom*& aName, nsIAtom*& aPrefix) const {
aNameSpaceID = kNameSpaceID_None;
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult GetAttributeCount(PRInt32& aResult) const {
@ -492,6 +498,10 @@ struct nsGenericDOMDataNode {
nsString &aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \
nsIAtom*& aPrefix, nsString &aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
const nsString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \
@ -506,8 +516,9 @@ struct nsGenericDOMDataNode {
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \

Просмотреть файл

@ -2571,6 +2571,16 @@ nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{
nsCOMPtr<nsIAtom> prefix;
return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult);
}
nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
{
aPrefix = nsnull;
NS_ASSERTION(nsnull != aName, "must have attribute name");
if (nsnull == aName) {
return NS_ERROR_NULL_POINTER;
@ -2658,8 +2668,11 @@ nsGenericContainerElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericContainerElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aPrefix = nsnull;
if (nsnull != mAttributes) {
nsGenericAttribute* attr = (nsGenericAttribute*)mAttributes->ElementAt(aIndex);
if (nsnull != attr) {

Просмотреть файл

@ -337,11 +337,14 @@ public:
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName,
nsIAtom*& aPrefix) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
nsresult CanContainChildren(PRBool& aResult) const;
@ -622,14 +625,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -744,14 +752,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -866,14 +879,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -986,14 +1004,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -1110,14 +1133,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -1226,14 +1254,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \

Просмотреть файл

@ -136,8 +136,10 @@ public:
PRBool aNotify) { return NS_OK; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName) const {
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const {
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}

Просмотреть файл

@ -1485,6 +1485,15 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
return result;
}
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const
{
aPrefix = nsnull;
return GetAttribute(aNameSpaceID, aAttribute, aResult);
}
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const
@ -1582,9 +1591,11 @@ nsGenericHTMLElement::GetHTMLAttribute(nsIAtom* aAttribute,
nsresult
nsGenericHTMLElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aNameSpaceID = kNameSpaceID_None;
aPrefix = nsnull;
if (nsnull != mAttributes) {
return mAttributes->GetAttributeNameAt(aIndex, aName);
}
@ -1745,8 +1756,11 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const
for (index = 0; index < count; index++) {
// name
nsIAtom* attr = nsnull;
nsIAtom* prefix = nsnull;
PRInt32 nameSpaceID;
GetAttributeNameAt(index, nameSpaceID, attr);
GetAttributeNameAt(index, nameSpaceID, attr, prefix);
NS_IF_RELEASE(prefix);
nsAutoString buffer;
attr->ToString(buffer);

Просмотреть файл

@ -118,10 +118,12 @@ public:
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName,
nsIAtom*& aPrefix) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
nsresult SetParentForFormControls(nsIContent* aParent,

Просмотреть файл

@ -136,15 +136,20 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aAttribute, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);
}

Просмотреть файл

@ -131,14 +131,19 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aAttribute, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -127,13 +127,18 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aName, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -2478,8 +2478,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr), *getter_AddRefs(prefix));
PRBool reset = PR_FALSE;
@ -3094,6 +3094,16 @@ NS_IMETHODIMP
nsXULElement::GetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aName,
nsString& aResult) const
{
nsCOMPtr<nsIAtom> prefix;
return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult);
}
NS_IMETHODIMP
nsXULElement::GetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aName,
nsIAtom*& aPrefix,
nsString& aResult) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
if (nsnull == aName) {
@ -3300,8 +3310,16 @@ nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotif
NS_IMETHODIMP
nsXULElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aPrefix = nsnull;
if (Attributes()) {
nsXULAttribute* attr = NS_REINTERPRET_CAST(nsXULAttribute*, Attributes()->ElementAt(aIndex));
if (nsnull != attr) {
@ -3380,8 +3398,9 @@ nsXULElement::List(FILE* out, PRInt32 aIndent) const
if (NS_SUCCEEDED(rv = GetAttributeCount(nattrs))) {
for (PRInt32 i = 0; i < nattrs; ++i) {
nsIAtom* attr = nsnull;
nsCOMPtr<nsIAtom> prefix;
PRInt32 nameSpaceID;
GetAttributeNameAt(i, nameSpaceID, attr);
GetAttributeNameAt(i, nameSpaceID, attr, *getter_AddRefs(prefix));
nsAutoString v;
GetAttribute(nameSpaceID, attr, v);

Просмотреть файл

@ -398,9 +398,10 @@ public:
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, PRBool aNotify);
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, PRBool aNotify);
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const;
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName, nsIAtom*& aPrefix) const;
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD BeginConvertToXIF(nsIXIFConverter * aConverter) const;

Просмотреть файл

@ -5783,8 +5783,8 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
if (nameSpaceID == kNameSpaceID_None && attr.get() == kIdAtom)

Просмотреть файл

@ -667,8 +667,8 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult)
aResult.AppendWithConversion(' ');
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> name;
rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name));
nsCOMPtr<nsIAtom> name, prefix;
rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
nsAutoString attr;

Просмотреть файл

@ -5078,9 +5078,9 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
for (PRInt32 attr = 0; attr < numAttribs; attr++) {
PRInt32 attribNameSpaceID;
nsCOMPtr<nsIAtom> attribName;
nsCOMPtr<nsIAtom> attribName, prefix;
rv = tmplKid->GetAttributeNameAt(attr, attribNameSpaceID, *getter_AddRefs(attribName));
rv = tmplKid->GetAttributeNameAt(attr, attribNameSpaceID, *getter_AddRefs(attribName), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
if (! IsIgnoreableAttribute(attribNameSpaceID, attribName)) {
@ -5399,10 +5399,11 @@ nsXULTemplateBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
for (PRInt32 aLoop=0; aLoop<numAttribs; aLoop++) {
PRInt32 attribNameSpaceID;
nsCOMPtr<nsIAtom> attribName;
nsCOMPtr<nsIAtom> attribName, prefix;
rv = aTemplateNode->GetAttributeNameAt(aLoop,
attribNameSpaceID,
*getter_AddRefs(attribName));
*getter_AddRefs(attribName),
*getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
// See if it's one of the attributes that we unilaterally
@ -6642,8 +6643,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRuleElement,
// Add constraints for the LHS
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 attrNameSpaceID;
nsCOMPtr<nsIAtom> attr;
rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID,
*getter_AddRefs(attr),
*getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
// Note: some attributes must be skipped on XUL template rule subtree
@ -6812,9 +6815,10 @@ nsXULTemplateBuilder::AddSimpleRuleBindings(Rule* aRule, nsIContent* aElement)
for (i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
nsCOMPtr<nsIAtom> attr, prefix;
element->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
element->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr),
*getter_AddRefs(prefix));
nsAutoString value;
element->GetAttribute(nameSpaceID, attr, value);

Просмотреть файл

@ -1496,12 +1496,13 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
if (!content) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID;
nsIAtom* attrName;
nsCOMPtr<nsIAtom> attrName, prefix;
content->GetAttributeCount(attrCount);
for (i=0; i<attrCount; i++)
{
content->GetAttributeNameAt(i, nameSpaceID, attrName);
content->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
nsAutoString attrString, tmp;
if (!attrName) continue; // ooops
attrName->ToString(attrString);
@ -1529,14 +1530,15 @@ nsHTMLEditor::HasMatchingAttributes(nsIDOMNode *aNode1,
if (!content2) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID, realCount1=0, realCount2=0;
nsIAtom* attrName;
nsCOMPtr<nsIAtom> attrName, prefix;
nsresult res, res2;
content1->GetAttributeCount(attrCount);
nsAutoString attrString, tmp, attrVal1, attrVal2;
for (i=0; i<attrCount; i++)
{
content1->GetAttributeNameAt(i, nameSpaceID, attrName);
content1->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
if (!attrName) continue; // ooops
attrName->ToString(attrString);
// if it's a special _moz... attribute, keep going
@ -1554,7 +1556,8 @@ nsHTMLEditor::HasMatchingAttributes(nsIDOMNode *aNode1,
content2->GetAttributeCount(attrCount);
for (i=0; i<attrCount; i++)
{
content2->GetAttributeNameAt(i, nameSpaceID, attrName);
content2->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
if (!attrName) continue; // ooops
attrName->ToString(attrString);
// if it's a special _moz... attribute, keep going

Просмотреть файл

@ -1496,12 +1496,13 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
if (!content) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID;
nsIAtom* attrName;
nsCOMPtr<nsIAtom> attrName, prefix;
content->GetAttributeCount(attrCount);
for (i=0; i<attrCount; i++)
{
content->GetAttributeNameAt(i, nameSpaceID, attrName);
content->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
nsAutoString attrString, tmp;
if (!attrName) continue; // ooops
attrName->ToString(attrString);
@ -1529,14 +1530,15 @@ nsHTMLEditor::HasMatchingAttributes(nsIDOMNode *aNode1,
if (!content2) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID, realCount1=0, realCount2=0;
nsIAtom* attrName;
nsCOMPtr<nsIAtom> attrName, prefix;
nsresult res, res2;
content1->GetAttributeCount(attrCount);
nsAutoString attrString, tmp, attrVal1, attrVal2;
for (i=0; i<attrCount; i++)
{
content1->GetAttributeNameAt(i, nameSpaceID, attrName);
content1->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
if (!attrName) continue; // ooops
attrName->ToString(attrString);
// if it's a special _moz... attribute, keep going
@ -1554,7 +1556,8 @@ nsHTMLEditor::HasMatchingAttributes(nsIDOMNode *aNode1,
content2->GetAttributeCount(attrCount);
for (i=0; i<attrCount; i++)
{
content2->GetAttributeNameAt(i, nameSpaceID, attrName);
content2->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attrName),
*getter_AddRefs(prefix));
if (!attrName) continue; // ooops
attrName->ToString(attrString);
// if it's a special _moz... attribute, keep going

Просмотреть файл

@ -176,6 +176,29 @@ public:
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const = 0;
/**
* Get the current value and prefix of the attribute. This returns a form
* that is suitable for passing back into setAttribute.
*
* <UL>
*
* <LI>If the attribute is not set and has no default value, return
* NS_CONTENT_ATTR_NOT_THERE.
*
* <LI>If the attribute exists, but has no value, return
* NS_CONTENT_ATTR_NO_VALUE.
*
* <LI>If the attribute has a value, empty or otherwise, set ret to
* be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
*
* </UL>
*
* NOTE! aPrefix is an OUT parameter.
*/
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const = 0;
/**
* Remove an attribute so that it is no longer explicitly specified.
*
@ -199,7 +222,8 @@ public:
*/
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const = 0;
nsIAtom*& aName,
nsIAtom*& aPrefix) const = 0;
/**
* Get the number of all specified attributes.

Просмотреть файл

@ -123,6 +123,10 @@ public:
nsString &aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult);
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
const nsString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify);
@ -137,8 +141,9 @@ public:
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -473,8 +473,7 @@ nsDOMAttribute::SetPrefix(const nsString& aPrefix)
NS_IMETHODIMP
nsDOMAttribute::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return GetName(aLocalName);
}
NS_IMETHODIMP

Просмотреть файл

@ -255,13 +255,14 @@ nsresult
nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> nameAtom;
nsCOMPtr<nsIAtom> nameAtom, prefix;
nsresult rv = NS_OK;
if (mContent &&
NS_SUCCEEDED(mContent->GetAttributeNameAt(aIndex,
nameSpaceID,
*getter_AddRefs(nameAtom)))) {
*getter_AddRefs(nameAtom),
*getter_AddRefs(prefix)))) {
nsAutoString value, name;
mContent->GetAttribute(nameSpaceID, nameAtom, value);

Просмотреть файл

@ -176,14 +176,19 @@ public:
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify)
{ return NS_OK; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IMETHOD GetAttributeCount(PRInt32& aCountResult) const
@ -378,30 +383,26 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
NS_IMETHODIMP
nsDocumentFragment::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_DOM_NAMESPACE_ERR;
}
NS_IMETHODIMP
nsDocumentFragment::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return GetNodeName(aLocalName);
}

Просмотреть файл

@ -184,9 +184,15 @@ struct nsGenericDOMDataNode {
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {
return NS_CONTENT_ATTR_NOT_THERE;
}
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {
aPrefix = nsnull;
return NS_CONTENT_ATTR_NOT_THERE;
}
nsresult GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
nsIAtom*& aName, nsIAtom*& aPrefix) const {
aNameSpaceID = kNameSpaceID_None;
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}
nsresult GetAttributeCount(PRInt32& aResult) const {
@ -492,6 +498,10 @@ struct nsGenericDOMDataNode {
nsString &aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \
nsIAtom*& aPrefix, nsString &aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
const nsString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \
@ -506,8 +516,9 @@ struct nsGenericDOMDataNode {
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \

Просмотреть файл

@ -2571,6 +2571,16 @@ nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{
nsCOMPtr<nsIAtom> prefix;
return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult);
}
nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
{
aPrefix = nsnull;
NS_ASSERTION(nsnull != aName, "must have attribute name");
if (nsnull == aName) {
return NS_ERROR_NULL_POINTER;
@ -2658,8 +2668,11 @@ nsGenericContainerElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericContainerElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aPrefix = nsnull;
if (nsnull != mAttributes) {
nsGenericAttribute* attr = (nsGenericAttribute*)mAttributes->ElementAt(aIndex);
if (nsnull != attr) {

Просмотреть файл

@ -337,11 +337,14 @@ public:
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName,
nsIAtom*& aPrefix) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
nsresult CanContainChildren(PRBool& aResult) const;
@ -622,14 +625,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -744,14 +752,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -866,14 +879,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -986,14 +1004,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -1110,14 +1133,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \
@ -1226,14 +1254,19 @@ public:
nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
PRBool aNotify) { \
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
} \
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
PRInt32& aNameSpaceID, \
nsIAtom*& aName) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
nsIAtom*& aName, \
nsIAtom*& aPrefix) const { \
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix); \
} \
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
return _g.GetAttributeCount(aResult); \

Просмотреть файл

@ -1501,7 +1501,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetAttributes(PRUint16& n,
for (index = 0; index < count; index++) {
PRInt32 nameSpaceID;
nsIAtom* atom;
iContent->GetAttributeNameAt(index, nameSpaceID, atom);
nsCOMPtr<nsIAtom> prefix;
iContent->GetAttributeNameAt(index, nameSpaceID, atom,
*getter_AddRefs(prefix));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == iContent->GetAttribute(nameSpaceID, atom, value)) {
nsAutoString name;

Просмотреть файл

@ -1501,7 +1501,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetAttributes(PRUint16& n,
for (index = 0; index < count; index++) {
PRInt32 nameSpaceID;
nsIAtom* atom;
iContent->GetAttributeNameAt(index, nameSpaceID, atom);
nsCOMPtr<nsIAtom> prefix;
iContent->GetAttributeNameAt(index, nameSpaceID, atom,
*getter_AddRefs(prefix));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == iContent->GetAttribute(nameSpaceID, atom, value)) {
nsAutoString name;

Просмотреть файл

@ -136,8 +136,10 @@ public:
PRBool aNotify) { return NS_OK; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName) const {
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const {
aName = nsnull;
aPrefix = nsnull;
return NS_ERROR_ILLEGAL_VALUE;
}

Просмотреть файл

@ -1485,6 +1485,15 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
return result;
}
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const
{
aPrefix = nsnull;
return GetAttribute(aNameSpaceID, aAttribute, aResult);
}
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const
@ -1582,9 +1591,11 @@ nsGenericHTMLElement::GetHTMLAttribute(nsIAtom* aAttribute,
nsresult
nsGenericHTMLElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aNameSpaceID = kNameSpaceID_None;
aPrefix = nsnull;
if (nsnull != mAttributes) {
return mAttributes->GetAttributeNameAt(aIndex, aName);
}
@ -1745,8 +1756,11 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const
for (index = 0; index < count; index++) {
// name
nsIAtom* attr = nsnull;
nsIAtom* prefix = nsnull;
PRInt32 nameSpaceID;
GetAttributeNameAt(index, nameSpaceID, attr);
GetAttributeNameAt(index, nameSpaceID, attr, prefix);
NS_IF_RELEASE(prefix);
nsAutoString buffer;
attr->ToString(buffer);

Просмотреть файл

@ -118,10 +118,12 @@ public:
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName,
nsIAtom*& aPrefix) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
nsresult SetParentForFormControls(nsIContent* aParent,

Просмотреть файл

@ -136,15 +136,20 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aAttribute, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);
}

Просмотреть файл

@ -131,14 +131,19 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aAttribute, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -74,6 +74,12 @@ public:
return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName,
aResult);
}
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
{
return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName,
aPrefix, aResult);
}
nsresult ParseAttributeString(const nsString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID);

Просмотреть файл

@ -127,13 +127,18 @@ public:
nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) {
return mInner.UnsetAttribute(aNameSpaceID, aName, aNotify);
}
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
nsIAtom*& aName,
nsIAtom*& aPrefix) const {
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
return mInner.GetAttributeCount(aResult);

Просмотреть файл

@ -667,8 +667,8 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult)
aResult.AppendWithConversion(' ');
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> name;
rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name));
nsCOMPtr<nsIAtom> name, prefix;
rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
nsAutoString attr;

Просмотреть файл

@ -5783,8 +5783,8 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
if (nameSpaceID == kNameSpaceID_None && attr.get() == kIdAtom)

Просмотреть файл

@ -2478,8 +2478,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr), *getter_AddRefs(prefix));
PRBool reset = PR_FALSE;
@ -3094,6 +3094,16 @@ NS_IMETHODIMP
nsXULElement::GetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aName,
nsString& aResult) const
{
nsCOMPtr<nsIAtom> prefix;
return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult);
}
NS_IMETHODIMP
nsXULElement::GetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aName,
nsIAtom*& aPrefix,
nsString& aResult) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
if (nsnull == aName) {
@ -3300,8 +3310,16 @@ nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotif
NS_IMETHODIMP
nsXULElement::GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
nsIAtom*& aName) const
nsIAtom*& aName,
nsIAtom*& aPrefix) const
{
aPrefix = nsnull;
if (Attributes()) {
nsXULAttribute* attr = NS_REINTERPRET_CAST(nsXULAttribute*, Attributes()->ElementAt(aIndex));
if (nsnull != attr) {
@ -3380,8 +3398,9 @@ nsXULElement::List(FILE* out, PRInt32 aIndent) const
if (NS_SUCCEEDED(rv = GetAttributeCount(nattrs))) {
for (PRInt32 i = 0; i < nattrs; ++i) {
nsIAtom* attr = nsnull;
nsCOMPtr<nsIAtom> prefix;
PRInt32 nameSpaceID;
GetAttributeNameAt(i, nameSpaceID, attr);
GetAttributeNameAt(i, nameSpaceID, attr, *getter_AddRefs(prefix));
nsAutoString v;
GetAttribute(nameSpaceID, attr, v);

Просмотреть файл

@ -398,9 +398,10 @@ public:
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, PRBool aNotify);
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, PRBool aNotify);
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const;
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
nsIAtom*& aName) const;
nsIAtom*& aName, nsIAtom*& aPrefix) const;
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD BeginConvertToXIF(nsIXIFConverter * aConverter) const;

Просмотреть файл

@ -5078,9 +5078,9 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
for (PRInt32 attr = 0; attr < numAttribs; attr++) {
PRInt32 attribNameSpaceID;
nsCOMPtr<nsIAtom> attribName;
nsCOMPtr<nsIAtom> attribName, prefix;
rv = tmplKid->GetAttributeNameAt(attr, attribNameSpaceID, *getter_AddRefs(attribName));
rv = tmplKid->GetAttributeNameAt(attr, attribNameSpaceID, *getter_AddRefs(attribName), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
if (! IsIgnoreableAttribute(attribNameSpaceID, attribName)) {
@ -5399,10 +5399,11 @@ nsXULTemplateBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
for (PRInt32 aLoop=0; aLoop<numAttribs; aLoop++) {
PRInt32 attribNameSpaceID;
nsCOMPtr<nsIAtom> attribName;
nsCOMPtr<nsIAtom> attribName, prefix;
rv = aTemplateNode->GetAttributeNameAt(aLoop,
attribNameSpaceID,
*getter_AddRefs(attribName));
*getter_AddRefs(attribName),
*getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
// See if it's one of the attributes that we unilaterally
@ -6642,8 +6643,10 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRuleElement,
// Add constraints for the LHS
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 attrNameSpaceID;
nsCOMPtr<nsIAtom> attr;
rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID, *getter_AddRefs(attr));
nsCOMPtr<nsIAtom> attr, prefix;
rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID,
*getter_AddRefs(attr),
*getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
// Note: some attributes must be skipped on XUL template rule subtree
@ -6812,9 +6815,10 @@ nsXULTemplateBuilder::AddSimpleRuleBindings(Rule* aRule, nsIContent* aElement)
for (i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> attr;
nsCOMPtr<nsIAtom> attr, prefix;
element->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
element->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr),
*getter_AddRefs(prefix));
nsAutoString value;
element->GetAttribute(nameSpaceID, attr, value);

Просмотреть файл

@ -352,10 +352,11 @@ nsRDFDOMDataSource::createContentAttributeArcs(nsIContent* content,
// we have touse the viewerObjects
PRInt32 i;
for (i=0; i< attribs; i++) {
nsCOMPtr<nsIAtom> nameAtom;
nsCOMPtr<nsIAtom> nameAtom, prefix;
PRInt32 nameSpace;
content->GetAttributeNameAt(i, nameSpace, *getter_AddRefs(nameAtom));
content->GetAttributeNameAt(i, nameSpace, *getter_AddRefs(nameAtom),
*getter_AddRefs(prefix));
nsString attribValue;
rv = content->GetAttribute(nameSpace, nameAtom, attribValue);
if (NS_FAILED(rv)) continue;