From 674e39ffc742a447c44a4693d49cc37b29e2ccea Mon Sep 17 00:00:00 2001 From: "harishd%netscape.com" Date: Sun, 25 Apr 1999 22:18:49 +0000 Subject: [PATCH] Added an extra parameter(PRBool) - aNotify, to AddAttributes(). This parameter has been defaulted to PR_FALSE. --- .../html/document/src/nsHTMLContentSink.cpp | 34 ++++--------------- .../html/document/src/nsHTMLContentSink.cpp | 34 ++++--------------- 2 files changed, 14 insertions(+), 54 deletions(-) diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 29126bacaef..b64499f1bb0 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -462,7 +462,8 @@ GetAttributeValueAt(const nsIParserNode& aNode, static nsresult AddAttributes(const nsIParserNode& aNode, nsIHTMLContent* aContent, - nsIScriptContextOwner* aScriptContextOwner) + nsIScriptContextOwner* aScriptContextOwner, + PRBool aNotify = PR_FALSE) { // Add tag attributes to the content attributes nsAutoString k, v; @@ -483,7 +484,7 @@ AddAttributes(const nsIParserNode& aNode, GetAttributeValueAt(aNode, i, v, aScriptContextOwner); // Add attribute to content - aContent->SetAttribute(kNameSpaceID_HTML, keyAtom, v, PR_FALSE); + aContent->SetAttribute(kNameSpaceID_HTML, keyAtom, v,aNotify); } NS_RELEASE(keyAtom); } @@ -1756,32 +1757,11 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode) SINK_TRACE_NODE(SINK_TRACE_CALLS, "HTMLContentSink::OpenBody", aNode); - // Check for attributes on the second body and apply them to the - // existing BODY node. + // Add attributes, if any, to the current BODY node if(mBody != nsnull){ - PRInt32 attrCount = aNode.GetAttributeCount(); - if(attrCount){ - nsAutoString k, newValue; - nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner(); - for (PRInt32 index = 0; index < attrCount; index++) { - // Get upper-cased key - const nsString& key = aNode.GetKeyAt(index); - - k.Truncate(); - k.Append(key); - k.ToLowerCase(); - - nsIAtom* keyAtom = NS_NewAtom(k); - nsHTMLValue oldValue; - - // Get value and remove mandatory quotes - GetAttributeValueAt(aNode, index, newValue, sco); - // Add attribute to body - mBody->SetAttribute(kNameSpaceID_HTML, keyAtom, newValue, PR_TRUE); - NS_RELEASE(keyAtom); - } - NS_IF_RELEASE(sco); - } + nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner(); + AddAttributes(aNode,mBody,sco,PR_TRUE); + NS_IF_RELEASE(sco); NS_ADDREF(mBody); mCurrentContext->mStackPos++; return NS_OK; diff --git a/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp index 29126bacaef..b64499f1bb0 100644 --- a/layout/html/document/src/nsHTMLContentSink.cpp +++ b/layout/html/document/src/nsHTMLContentSink.cpp @@ -462,7 +462,8 @@ GetAttributeValueAt(const nsIParserNode& aNode, static nsresult AddAttributes(const nsIParserNode& aNode, nsIHTMLContent* aContent, - nsIScriptContextOwner* aScriptContextOwner) + nsIScriptContextOwner* aScriptContextOwner, + PRBool aNotify = PR_FALSE) { // Add tag attributes to the content attributes nsAutoString k, v; @@ -483,7 +484,7 @@ AddAttributes(const nsIParserNode& aNode, GetAttributeValueAt(aNode, i, v, aScriptContextOwner); // Add attribute to content - aContent->SetAttribute(kNameSpaceID_HTML, keyAtom, v, PR_FALSE); + aContent->SetAttribute(kNameSpaceID_HTML, keyAtom, v,aNotify); } NS_RELEASE(keyAtom); } @@ -1756,32 +1757,11 @@ HTMLContentSink::OpenBody(const nsIParserNode& aNode) SINK_TRACE_NODE(SINK_TRACE_CALLS, "HTMLContentSink::OpenBody", aNode); - // Check for attributes on the second body and apply them to the - // existing BODY node. + // Add attributes, if any, to the current BODY node if(mBody != nsnull){ - PRInt32 attrCount = aNode.GetAttributeCount(); - if(attrCount){ - nsAutoString k, newValue; - nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner(); - for (PRInt32 index = 0; index < attrCount; index++) { - // Get upper-cased key - const nsString& key = aNode.GetKeyAt(index); - - k.Truncate(); - k.Append(key); - k.ToLowerCase(); - - nsIAtom* keyAtom = NS_NewAtom(k); - nsHTMLValue oldValue; - - // Get value and remove mandatory quotes - GetAttributeValueAt(aNode, index, newValue, sco); - // Add attribute to body - mBody->SetAttribute(kNameSpaceID_HTML, keyAtom, newValue, PR_TRUE); - NS_RELEASE(keyAtom); - } - NS_IF_RELEASE(sco); - } + nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner(); + AddAttributes(aNode,mBody,sco,PR_TRUE); + NS_IF_RELEASE(sco); NS_ADDREF(mBody); mCurrentContext->mStackPos++; return NS_OK;