diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h
index 7cf0f950dc9..a9ed5dd8f7a 100644
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -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.
+ *
+ *
+ *
+ * - If the attribute is not set and has no default value, return
+ * NS_CONTENT_ATTR_NOT_THERE.
+ *
+ *
- If the attribute exists, but has no value, return
+ * NS_CONTENT_ATTR_NO_VALUE.
+ *
+ *
- If the attribute has a value, empty or otherwise, set ret to
+ * be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
+ *
+ *
+ *
+ * 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.
diff --git a/content/base/src/nsCommentNode.cpp b/content/base/src/nsCommentNode.cpp
index 1c4fc5d3a8a..865afbb3115 100644
--- a/content/base/src/nsCommentNode.cpp
+++ b/content/base/src/nsCommentNode.cpp
@@ -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);
diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp
index ccd3bd958a6..82255773a3b 100644
--- a/content/base/src/nsDOMAttribute.cpp
+++ b/content/base/src/nsDOMAttribute.cpp
@@ -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
diff --git a/content/base/src/nsDOMAttributeMap.cpp b/content/base/src/nsDOMAttributeMap.cpp
index 16fe5d43c42..f13cf6c44b1 100644
--- a/content/base/src/nsDOMAttributeMap.cpp
+++ b/content/base/src/nsDOMAttributeMap.cpp
@@ -255,13 +255,14 @@ nsresult
nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
PRInt32 nameSpaceID;
- nsCOMPtr nameAtom;
+ nsCOMPtr 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);
diff --git a/content/base/src/nsDocumentFragment.cpp b/content/base/src/nsDocumentFragment.cpp
index b86d43ad6e5..8e39b0f5216 100644
--- a/content/base/src/nsDocumentFragment.cpp
+++ b/content/base/src/nsDocumentFragment.cpp
@@ -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);
}
diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h
index df1383235c2..581f58a5a0c 100644
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -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); \
diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp
index 983741df8ff..b546b6b3109 100644
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2571,6 +2571,16 @@ nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{
+ nsCOMPtr 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) {
diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h
index d835eeabb6d..d2173d8764e 100644
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -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); \
diff --git a/content/html/content/src/nsAttributeContent.cpp b/content/html/content/src/nsAttributeContent.cpp
index 55bc7f0bef3..0ed92723ad9 100644
--- a/content/html/content/src/nsAttributeContent.cpp
+++ b/content/html/content/src/nsAttributeContent.cpp
@@ -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;
}
diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp
index 5c15aa74225..96d73a78678 100644
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -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);
diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h
index 95b47106dee..a7806cca332 100644
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -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,
diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp
index 68d59d4a9c8..567b0465ac8 100644
--- a/content/html/content/src/nsHTMLMapElement.cpp
+++ b/content/html/content/src/nsHTMLMapElement.cpp
@@ -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);
}
diff --git a/content/html/content/src/nsHTMLUnknownElement.cpp b/content/html/content/src/nsHTMLUnknownElement.cpp
index 4cd03c2cf93..79fe4af081c 100644
--- a/content/html/content/src/nsHTMLUnknownElement.cpp
+++ b/content/html/content/src/nsHTMLUnknownElement.cpp
@@ -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);
diff --git a/content/xml/content/src/nsXMLElement.h b/content/xml/content/src/nsXMLElement.h
index 20f9d07b076..d2c2bb2d569 100644
--- a/content/xml/content/src/nsXMLElement.h
+++ b/content/xml/content/src/nsXMLElement.h
@@ -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);
diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp
index 6d8a4f53777..fcbd676ca3a 100644
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2478,8 +2478,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
- nsCOMPtr attr;
- GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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 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 prefix;
PRInt32 nameSpaceID;
- GetAttributeNameAt(i, nameSpaceID, attr);
+ GetAttributeNameAt(i, nameSpaceID, attr, *getter_AddRefs(prefix));
nsAutoString v;
GetAttribute(nameSpaceID, attr, v);
diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h
index 3a6e280421f..5b2afd9346c 100644
--- a/content/xul/content/src/nsXULElement.h
+++ b/content/xul/content/src/nsXULElement.h
@@ -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;
diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp
index b1df4da3d78..b96ae4eb9f9 100644
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -5783,8 +5783,8 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
- nsCOMPtr attr;
- rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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)
diff --git a/content/xul/templates/src/nsXULContentUtils.cpp b/content/xul/templates/src/nsXULContentUtils.cpp
index 2adff8ba9ad..73a19ef9163 100644
--- a/content/xul/templates/src/nsXULContentUtils.cpp
+++ b/content/xul/templates/src/nsXULContentUtils.cpp
@@ -667,8 +667,8 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult)
aResult.AppendWithConversion(' ');
PRInt32 nameSpaceID;
- nsCOMPtr name;
- rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name));
+ nsCOMPtr name, prefix;
+ rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
nsAutoString attr;
diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp
index 54c3a300cda..e6f75e14ae0 100644
--- a/content/xul/templates/src/nsXULTemplateBuilder.cpp
+++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp
@@ -5078,9 +5078,9 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
for (PRInt32 attr = 0; attr < numAttribs; attr++) {
PRInt32 attribNameSpaceID;
- nsCOMPtr attribName;
+ nsCOMPtr 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 attribName;
+ nsCOMPtr 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 attr;
- rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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 attr;
+ nsCOMPtr 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);
diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp
index c1557a66fdb..c6330c7f1cd 100644
--- a/editor/base/nsHTMLEditor.cpp
+++ b/editor/base/nsHTMLEditor.cpp
@@ -1496,12 +1496,13 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
if (!content) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID;
- nsIAtom* attrName;
+ nsCOMPtr attrName, prefix;
content->GetAttributeCount(attrCount);
for (i=0; iGetAttributeNameAt(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 attrName, prefix;
nsresult res, res2;
content1->GetAttributeCount(attrCount);
nsAutoString attrString, tmp, attrVal1, attrVal2;
for (i=0; iGetAttributeNameAt(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; iGetAttributeNameAt(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
diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp
index c1557a66fdb..c6330c7f1cd 100644
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -1496,12 +1496,13 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
if (!content) return PR_FALSE; // ooops
PRInt32 attrCount, i, nameSpaceID;
- nsIAtom* attrName;
+ nsCOMPtr attrName, prefix;
content->GetAttributeCount(attrCount);
for (i=0; iGetAttributeNameAt(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 attrName, prefix;
nsresult res, res2;
content1->GetAttributeCount(attrCount);
nsAutoString attrString, tmp, attrVal1, attrVal2;
for (i=0; iGetAttributeNameAt(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; iGetAttributeNameAt(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
diff --git a/layout/base/public/nsIContent.h b/layout/base/public/nsIContent.h
index 7cf0f950dc9..a9ed5dd8f7a 100644
--- a/layout/base/public/nsIContent.h
+++ b/layout/base/public/nsIContent.h
@@ -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.
+ *
+ *
+ *
+ * - If the attribute is not set and has no default value, return
+ * NS_CONTENT_ATTR_NOT_THERE.
+ *
+ *
- If the attribute exists, but has no value, return
+ * NS_CONTENT_ATTR_NO_VALUE.
+ *
+ *
- If the attribute has a value, empty or otherwise, set ret to
+ * be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
+ *
+ *
+ *
+ * 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.
diff --git a/layout/base/src/nsCommentNode.cpp b/layout/base/src/nsCommentNode.cpp
index 1c4fc5d3a8a..865afbb3115 100644
--- a/layout/base/src/nsCommentNode.cpp
+++ b/layout/base/src/nsCommentNode.cpp
@@ -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);
diff --git a/layout/base/src/nsDOMAttribute.cpp b/layout/base/src/nsDOMAttribute.cpp
index ccd3bd958a6..82255773a3b 100644
--- a/layout/base/src/nsDOMAttribute.cpp
+++ b/layout/base/src/nsDOMAttribute.cpp
@@ -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
diff --git a/layout/base/src/nsDOMAttributeMap.cpp b/layout/base/src/nsDOMAttributeMap.cpp
index 16fe5d43c42..f13cf6c44b1 100644
--- a/layout/base/src/nsDOMAttributeMap.cpp
+++ b/layout/base/src/nsDOMAttributeMap.cpp
@@ -255,13 +255,14 @@ nsresult
nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
PRInt32 nameSpaceID;
- nsCOMPtr nameAtom;
+ nsCOMPtr 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);
diff --git a/layout/base/src/nsDocumentFragment.cpp b/layout/base/src/nsDocumentFragment.cpp
index b86d43ad6e5..8e39b0f5216 100644
--- a/layout/base/src/nsDocumentFragment.cpp
+++ b/layout/base/src/nsDocumentFragment.cpp
@@ -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);
}
diff --git a/layout/base/src/nsGenericDOMDataNode.h b/layout/base/src/nsGenericDOMDataNode.h
index df1383235c2..581f58a5a0c 100644
--- a/layout/base/src/nsGenericDOMDataNode.h
+++ b/layout/base/src/nsGenericDOMDataNode.h
@@ -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); \
diff --git a/layout/base/src/nsGenericElement.cpp b/layout/base/src/nsGenericElement.cpp
index 983741df8ff..b546b6b3109 100644
--- a/layout/base/src/nsGenericElement.cpp
+++ b/layout/base/src/nsGenericElement.cpp
@@ -2571,6 +2571,16 @@ nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
{
+ nsCOMPtr 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) {
diff --git a/layout/base/src/nsGenericElement.h b/layout/base/src/nsGenericElement.h
index d835eeabb6d..d2173d8764e 100644
--- a/layout/base/src/nsGenericElement.h
+++ b/layout/base/src/nsGenericElement.h
@@ -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); \
diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp
index 38046eb187c..847eca41f20 100644
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -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 prefix;
+ iContent->GetAttributeNameAt(index, nameSpaceID, atom,
+ *getter_AddRefs(prefix));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == iContent->GetAttribute(nameSpaceID, atom, value)) {
nsAutoString name;
diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp
index 38046eb187c..847eca41f20 100644
--- a/layout/html/base/src/nsObjectFrame.cpp
+++ b/layout/html/base/src/nsObjectFrame.cpp
@@ -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 prefix;
+ iContent->GetAttributeNameAt(index, nameSpaceID, atom,
+ *getter_AddRefs(prefix));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == iContent->GetAttribute(nameSpaceID, atom, value)) {
nsAutoString name;
diff --git a/layout/html/content/src/nsAttributeContent.cpp b/layout/html/content/src/nsAttributeContent.cpp
index 55bc7f0bef3..0ed92723ad9 100644
--- a/layout/html/content/src/nsAttributeContent.cpp
+++ b/layout/html/content/src/nsAttributeContent.cpp
@@ -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;
}
diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp
index 5c15aa74225..96d73a78678 100644
--- a/layout/html/content/src/nsGenericHTMLElement.cpp
+++ b/layout/html/content/src/nsGenericHTMLElement.cpp
@@ -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);
diff --git a/layout/html/content/src/nsGenericHTMLElement.h b/layout/html/content/src/nsGenericHTMLElement.h
index 95b47106dee..a7806cca332 100644
--- a/layout/html/content/src/nsGenericHTMLElement.h
+++ b/layout/html/content/src/nsGenericHTMLElement.h
@@ -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,
diff --git a/layout/html/content/src/nsHTMLMapElement.cpp b/layout/html/content/src/nsHTMLMapElement.cpp
index 68d59d4a9c8..567b0465ac8 100644
--- a/layout/html/content/src/nsHTMLMapElement.cpp
+++ b/layout/html/content/src/nsHTMLMapElement.cpp
@@ -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);
}
diff --git a/layout/html/content/src/nsHTMLUnknownElement.cpp b/layout/html/content/src/nsHTMLUnknownElement.cpp
index 4cd03c2cf93..79fe4af081c 100644
--- a/layout/html/content/src/nsHTMLUnknownElement.cpp
+++ b/layout/html/content/src/nsHTMLUnknownElement.cpp
@@ -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);
diff --git a/layout/xml/content/src/nsGenericXMLElement.h b/layout/xml/content/src/nsGenericXMLElement.h
index 637c6f3e9ba..2304fcac48e 100644
--- a/layout/xml/content/src/nsGenericXMLElement.h
+++ b/layout/xml/content/src/nsGenericXMLElement.h
@@ -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);
diff --git a/layout/xml/content/src/nsXMLElement.h b/layout/xml/content/src/nsXMLElement.h
index 20f9d07b076..d2c2bb2d569 100644
--- a/layout/xml/content/src/nsXMLElement.h
+++ b/layout/xml/content/src/nsXMLElement.h
@@ -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);
diff --git a/rdf/content/src/nsXULContentUtils.cpp b/rdf/content/src/nsXULContentUtils.cpp
index 2adff8ba9ad..73a19ef9163 100644
--- a/rdf/content/src/nsXULContentUtils.cpp
+++ b/rdf/content/src/nsXULContentUtils.cpp
@@ -667,8 +667,8 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult)
aResult.AppendWithConversion(' ');
PRInt32 nameSpaceID;
- nsCOMPtr name;
- rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name));
+ nsCOMPtr name, prefix;
+ rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name), *getter_AddRefs(prefix));
if (NS_FAILED(rv)) return rv;
nsAutoString attr;
diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp
index b1df4da3d78..b96ae4eb9f9 100644
--- a/rdf/content/src/nsXULDocument.cpp
+++ b/rdf/content/src/nsXULDocument.cpp
@@ -5783,8 +5783,8 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
- nsCOMPtr attr;
- rv = aOverlayNode->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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)
diff --git a/rdf/content/src/nsXULElement.cpp b/rdf/content/src/nsXULElement.cpp
index 6d8a4f53777..fcbd676ca3a 100644
--- a/rdf/content/src/nsXULElement.cpp
+++ b/rdf/content/src/nsXULElement.cpp
@@ -2478,8 +2478,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
for (PRInt32 i = 0; i < count; ++i) {
PRInt32 nameSpaceID;
- nsCOMPtr attr;
- GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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 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 prefix;
PRInt32 nameSpaceID;
- GetAttributeNameAt(i, nameSpaceID, attr);
+ GetAttributeNameAt(i, nameSpaceID, attr, *getter_AddRefs(prefix));
nsAutoString v;
GetAttribute(nameSpaceID, attr, v);
diff --git a/rdf/content/src/nsXULElement.h b/rdf/content/src/nsXULElement.h
index 3a6e280421f..5b2afd9346c 100644
--- a/rdf/content/src/nsXULElement.h
+++ b/rdf/content/src/nsXULElement.h
@@ -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;
diff --git a/rdf/content/src/nsXULTemplateBuilder.cpp b/rdf/content/src/nsXULTemplateBuilder.cpp
index 54c3a300cda..e6f75e14ae0 100644
--- a/rdf/content/src/nsXULTemplateBuilder.cpp
+++ b/rdf/content/src/nsXULTemplateBuilder.cpp
@@ -5078,9 +5078,9 @@ nsXULTemplateBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
for (PRInt32 attr = 0; attr < numAttribs; attr++) {
PRInt32 attribNameSpaceID;
- nsCOMPtr attribName;
+ nsCOMPtr 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 attribName;
+ nsCOMPtr 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 attr;
- rv = aRuleElement->GetAttributeNameAt(i, attrNameSpaceID, *getter_AddRefs(attr));
+ nsCOMPtr 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 attr;
+ nsCOMPtr 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);
diff --git a/rdf/tests/domds/nsRDFDOMDataSource.cpp b/rdf/tests/domds/nsRDFDOMDataSource.cpp
index 518382416ee..46b81a140b5 100644
--- a/rdf/tests/domds/nsRDFDOMDataSource.cpp
+++ b/rdf/tests/domds/nsRDFDOMDataSource.cpp
@@ -352,10 +352,11 @@ nsRDFDOMDataSource::createContentAttributeArcs(nsIContent* content,
// we have touse the viewerObjects
PRInt32 i;
for (i=0; i< attribs; i++) {
- nsCOMPtr nameAtom;
+ nsCOMPtr 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;