Bug 284950: DeCOMTaminate nsIContent::GetAttrNameAt

r/sr=bz


git-svn-id: svn://10.0.0.236/trunk@186678 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cvshook%sicking.cc
2005-12-28 21:52:39 +00:00
parent dd63e82e49
commit cf43ff4e7d
34 changed files with 224 additions and 373 deletions

View File

@@ -56,6 +56,7 @@
#include "nsCRT.h"
#include "nsContentUtils.h"
#include "nsLayoutAtoms.h"
#include "nsAttrName.h"
typedef struct {
nsString mPrefix;
@@ -580,21 +581,17 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
aElement->GetLocalName(tagLocalName);
aElement->GetNamespaceURI(tagNamespaceURI);
PRInt32 namespaceID;
PRUint32 index, count;
nsAutoString nameStr, prefixStr, uriStr, valueStr;
nsCOMPtr<nsIAtom> attrName, attrPrefix;
count = content->GetAttrCount();
// First scan for namespace declarations, pushing each on the stack
for (index = 0; index < count; index++) {
content->GetAttrNameAt(index,
&namespaceID,
getter_AddRefs(attrName),
getter_AddRefs(attrPrefix));
const nsAttrName* name = content->GetAttrNameAt(index);
PRInt32 namespaceID = name->NamespaceID();
nsIAtom *attrName = name->LocalName();
if (namespaceID == kNameSpaceID_XMLNS ||
// Also push on the stack attrs named "xmlns" in the null
@@ -606,7 +603,7 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
attrName == nsLayoutAtoms::xmlnsNameSpace)) {
content->GetAttr(namespaceID, attrName, uriStr);
if (!attrPrefix) {
if (!name->GetPrefix()) {
// Default NS attribute does not have prefix (and the name is "xmlns")
PushNameSpaceDecl(EmptyString(), uriStr, aElement);
} else {
@@ -646,10 +643,10 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
// XXX Unfortunately we need a namespace manager to get
// attribute URIs.
for (index = 0; index < count; index++) {
content->GetAttrNameAt(index,
&namespaceID,
getter_AddRefs(attrName),
getter_AddRefs(attrPrefix));
const nsAttrName* name = content->GetAttrNameAt(index);
PRInt32 namespaceID = name->NamespaceID();
nsIAtom* attrName = name->LocalName();
nsIAtom* attrPrefix = name->GetPrefix();
if (attrPrefix) {
attrPrefix->ToString(prefixStr);