diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 7ec6fe90e8a..48ed10ac6c2 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -423,8 +423,6 @@ AddAttributes(const nsIParserNode& aNode, nsIHTMLContent* aContent, nsIScriptContextOwner* aScriptContextOwner) { - nsIContent* content = (nsIContent*) aContent; - // Add tag attributes to the content attributes nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); @@ -434,12 +432,19 @@ AddAttributes(const nsIParserNode& aNode, k.Truncate(); k.Append(key); k.ToUpperCase(); - - // Get value and remove mandatory quotes - GetAttributeValueAt(aNode, i, v, aScriptContextOwner); - // Add attribute to content - content->SetAttribute(k, v, PR_FALSE); + nsIAtom* keyAtom = NS_NewAtom(k); + nsHTMLValue value; + + if (NS_CONTENT_ATTR_NOT_THERE == + aContent->GetAttribute(keyAtom, value)) { + // Get value and remove mandatory quotes + GetAttributeValueAt(aNode, i, v, aScriptContextOwner); + + // Add attribute to content + aContent->SetAttribute(keyAtom, v, PR_FALSE); + } + NS_RELEASE(keyAtom); } return NS_OK; } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 7ec6fe90e8a..48ed10ac6c2 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -423,8 +423,6 @@ AddAttributes(const nsIParserNode& aNode, nsIHTMLContent* aContent, nsIScriptContextOwner* aScriptContextOwner) { - nsIContent* content = (nsIContent*) aContent; - // Add tag attributes to the content attributes nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); @@ -434,12 +432,19 @@ AddAttributes(const nsIParserNode& aNode, k.Truncate(); k.Append(key); k.ToUpperCase(); - - // Get value and remove mandatory quotes - GetAttributeValueAt(aNode, i, v, aScriptContextOwner); - // Add attribute to content - content->SetAttribute(k, v, PR_FALSE); + nsIAtom* keyAtom = NS_NewAtom(k); + nsHTMLValue value; + + if (NS_CONTENT_ATTR_NOT_THERE == + aContent->GetAttribute(keyAtom, value)) { + // Get value and remove mandatory quotes + GetAttributeValueAt(aNode, i, v, aScriptContextOwner); + + // Add attribute to content + aContent->SetAttribute(keyAtom, v, PR_FALSE); + } + NS_RELEASE(keyAtom); } return NS_OK; }