mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
56501 - Serializer changes in dealing with NOSCRIPT ( checkin for jst )
r=me sr=scc
This commit is contained in:
parent
74ec5fa330
commit
91cb27bcff
@ -62,7 +62,7 @@ nsHTMLContentSerializer::nsHTMLContentSerializer()
|
||||
mColPos = 0;
|
||||
mIndent = 0;
|
||||
mInBody = PR_FALSE;
|
||||
mInScriptOrStyle = PR_FALSE;
|
||||
mInCDATA = PR_FALSE;
|
||||
}
|
||||
|
||||
nsHTMLContentSerializer::~nsHTMLContentSerializer()
|
||||
@ -269,8 +269,9 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
||||
}
|
||||
|
||||
if ((name.get() == nsHTMLAtoms::script) ||
|
||||
(name.get() == nsHTMLAtoms::style)) {
|
||||
mInScriptOrStyle = PR_TRUE;
|
||||
(name.get() == nsHTMLAtoms::style) ||
|
||||
(name.get() == nsHTMLAtoms::noscript)) {
|
||||
mInCDATA = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -302,10 +303,7 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
||||
nsCOMPtr<nsIParserService> parserService;
|
||||
GetParserService(getter_AddRefs(parserService));
|
||||
|
||||
if ((name.get() == nsHTMLAtoms::script) ||
|
||||
(name.get() == nsHTMLAtoms::style)) {
|
||||
mInScriptOrStyle = PR_FALSE;
|
||||
} else if (parserService) {
|
||||
if (parserService && (name.get() != nsHTMLAtoms::style)) {
|
||||
nsAutoString nameStr(sharedName);
|
||||
PRBool isContainer;
|
||||
PRInt32 id;
|
||||
@ -331,6 +329,8 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
||||
mColPos = 0;
|
||||
}
|
||||
|
||||
mInCDATA = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ nsHTMLContentSerializer::AppendToString(const nsAReadableString& aStr,
|
||||
mColPos += aStr.Length();
|
||||
}
|
||||
|
||||
if (aTranslateEntities && !mInScriptOrStyle) {
|
||||
if (aTranslateEntities && !mInCDATA) {
|
||||
if (mFlags & nsIDocumentEncoder::OutputEncodeEntities) {
|
||||
nsCOMPtr<nsIParserService> parserService;
|
||||
GetParserService(getter_AddRefs(parserService));
|
||||
|
@ -89,7 +89,17 @@ class nsHTMLContentSerializer : public nsXMLContentSerializer {
|
||||
PRBool mDoHeader;
|
||||
PRBool mBodyOnly;
|
||||
PRInt32 mPreLevel;
|
||||
PRBool mInScriptOrStyle;
|
||||
|
||||
/*
|
||||
* mInCDATA is set to PR_TRUE while the serializer is serializing
|
||||
* the content of a element whose content is considerd CDATA by the
|
||||
* serializer (such elements are 'script', 'style', 'noscript' and
|
||||
* possibly others) This doesn't have anything to do with if the
|
||||
* element is defined as CDATA in the DTD, it simply means we'll
|
||||
* output the content of the element without doing any entity encoding
|
||||
* what so ever.
|
||||
*/
|
||||
PRBool mInCDATA;
|
||||
|
||||
PRInt32 mMaxColumn;
|
||||
|
||||
|
@ -197,6 +197,7 @@ HTML_ATOM(multiple, "multiple")
|
||||
HTML_ATOM(name, "name")
|
||||
HTML_ATOM(nohref, "nohref")
|
||||
HTML_ATOM(noresize, "noresize")
|
||||
HTML_ATOM(noscript, "noscript")
|
||||
HTML_ATOM(noshade, "noshade")
|
||||
HTML_ATOM(nowrap, "nowrap")
|
||||
HTML_ATOM(object, "object")
|
||||
|
@ -197,6 +197,7 @@ HTML_ATOM(multiple, "multiple")
|
||||
HTML_ATOM(name, "name")
|
||||
HTML_ATOM(nohref, "nohref")
|
||||
HTML_ATOM(noresize, "noresize")
|
||||
HTML_ATOM(noscript, "noscript")
|
||||
HTML_ATOM(noshade, "noshade")
|
||||
HTML_ATOM(nowrap, "nowrap")
|
||||
HTML_ATOM(object, "object")
|
||||
|
@ -62,7 +62,7 @@ nsHTMLContentSerializer::nsHTMLContentSerializer()
|
||||
mColPos = 0;
|
||||
mIndent = 0;
|
||||
mInBody = PR_FALSE;
|
||||
mInScriptOrStyle = PR_FALSE;
|
||||
mInCDATA = PR_FALSE;
|
||||
}
|
||||
|
||||
nsHTMLContentSerializer::~nsHTMLContentSerializer()
|
||||
@ -269,8 +269,9 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
||||
}
|
||||
|
||||
if ((name.get() == nsHTMLAtoms::script) ||
|
||||
(name.get() == nsHTMLAtoms::style)) {
|
||||
mInScriptOrStyle = PR_TRUE;
|
||||
(name.get() == nsHTMLAtoms::style) ||
|
||||
(name.get() == nsHTMLAtoms::noscript)) {
|
||||
mInCDATA = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -302,10 +303,7 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
||||
nsCOMPtr<nsIParserService> parserService;
|
||||
GetParserService(getter_AddRefs(parserService));
|
||||
|
||||
if ((name.get() == nsHTMLAtoms::script) ||
|
||||
(name.get() == nsHTMLAtoms::style)) {
|
||||
mInScriptOrStyle = PR_FALSE;
|
||||
} else if (parserService) {
|
||||
if (parserService && (name.get() != nsHTMLAtoms::style)) {
|
||||
nsAutoString nameStr(sharedName);
|
||||
PRBool isContainer;
|
||||
PRInt32 id;
|
||||
@ -331,6 +329,8 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
||||
mColPos = 0;
|
||||
}
|
||||
|
||||
mInCDATA = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ nsHTMLContentSerializer::AppendToString(const nsAReadableString& aStr,
|
||||
mColPos += aStr.Length();
|
||||
}
|
||||
|
||||
if (aTranslateEntities && !mInScriptOrStyle) {
|
||||
if (aTranslateEntities && !mInCDATA) {
|
||||
if (mFlags & nsIDocumentEncoder::OutputEncodeEntities) {
|
||||
nsCOMPtr<nsIParserService> parserService;
|
||||
GetParserService(getter_AddRefs(parserService));
|
||||
|
@ -89,7 +89,17 @@ class nsHTMLContentSerializer : public nsXMLContentSerializer {
|
||||
PRBool mDoHeader;
|
||||
PRBool mBodyOnly;
|
||||
PRInt32 mPreLevel;
|
||||
PRBool mInScriptOrStyle;
|
||||
|
||||
/*
|
||||
* mInCDATA is set to PR_TRUE while the serializer is serializing
|
||||
* the content of a element whose content is considerd CDATA by the
|
||||
* serializer (such elements are 'script', 'style', 'noscript' and
|
||||
* possibly others) This doesn't have anything to do with if the
|
||||
* element is defined as CDATA in the DTD, it simply means we'll
|
||||
* output the content of the element without doing any entity encoding
|
||||
* what so ever.
|
||||
*/
|
||||
PRBool mInCDATA;
|
||||
|
||||
PRInt32 mMaxColumn;
|
||||
|
||||
|
@ -197,6 +197,7 @@ HTML_ATOM(multiple, "multiple")
|
||||
HTML_ATOM(name, "name")
|
||||
HTML_ATOM(nohref, "nohref")
|
||||
HTML_ATOM(noresize, "noresize")
|
||||
HTML_ATOM(noscript, "noscript")
|
||||
HTML_ATOM(noshade, "noshade")
|
||||
HTML_ATOM(nowrap, "nowrap")
|
||||
HTML_ATOM(object, "object")
|
||||
|
Loading…
Reference in New Issue
Block a user