diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp
index bde247ae091..a3a482d79f0 100644
--- a/htmlparser/src/CNavDTD.cpp
+++ b/htmlparser/src/CNavDTD.cpp
@@ -2733,11 +2733,21 @@ nsresult CNavDTD::AddHeadLeaf(nsIParserNode& aNode){
return result;
}
+ if(eHTMLTag_newline==theTag) //omit newlines from head...
+ return result;
+
if(mSink) {
result=OpenHead(aNode);
if(NS_OK==result) {
if(eHTMLTag_title==theTag) {
- mSink->SetTitle(aNode.GetSkippedContent());
+
+ ///XXX this evil hack is necessary only for beta.
+ //Post beta, lets make the GetSkippedContent() call non-const.
+
+ const nsString& theString=aNode.GetSkippedContent();
+ nsString* theStr=(nsString*)&theString;
+ theStr->CompressWhitespace();
+ mSink->SetTitle(theString);
}
else result=AddLeaf(aNode);
// XXX If the return value tells us to block, go
diff --git a/htmlparser/src/nsElementTable.cpp b/htmlparser/src/nsElementTable.cpp
index 3e1eff99db6..43abefc10a0 100644
--- a/htmlparser/src/nsElementTable.cpp
+++ b/htmlparser/src/nsElementTable.cpp
@@ -158,7 +158,7 @@ static eHTMLTags gHTMLKidList[]={eHTMLTag_body,eHTMLTag_frameset,eHTMLTag_head,e
CTagList gHtmlKids(sizeof(gHTMLKidList)/sizeof(eHTMLTag_unknown),gHTMLKidList);
static eHTMLTags gHeadKidList[]=
- {eHTMLTag_base,eHTMLTag_bgsound,eHTMLTag_link,eHTMLTag_meta,eHTMLTag_script,eHTMLTag_style,eHTMLTag_title,eHTMLTag_noembed,eHTMLTag_noscript};
+ {eHTMLTag_base,eHTMLTag_bgsound,eHTMLTag_link,eHTMLTag_meta,eHTMLTag_script,eHTMLTag_style,eHTMLTag_title,eHTMLTag_noembed,eHTMLTag_noscript,eHTMLTag_newline};
CTagList gHeadKids(sizeof(gHeadKidList)/sizeof(eHTMLTag_unknown),gHeadKidList);
CTagList gLIKids(2,0,eHTMLTag_ol,eHTMLTag_ul);
@@ -285,7 +285,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE|kFlowEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown},
@@ -830,7 +830,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (SPECIALTYPE|kSelf), kNone,
+ /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (kFlowEntity|SPECIALTYPE|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown},
@@ -982,7 +982,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ kBlock, (kInlineEntity|kSelf|kFlowEntity), kNone,
+ /*parent,incl,exclgroups*/ kBlockEntity, (kInlineEntity|kSelf|kFlowEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown},
diff --git a/htmlparser/src/nsViewSourceHTML.cpp b/htmlparser/src/nsViewSourceHTML.cpp
index 98f05bc5f66..20d8a9846f0 100644
--- a/htmlparser/src/nsViewSourceHTML.cpp
+++ b/htmlparser/src/nsViewSourceHTML.cpp
@@ -992,13 +992,29 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
if(eHTMLTag_title == theTag){
nsCParserNode attrNode(theToken,mLineNumber,GetTokenRecycler());
- CToken* theNextToken = mTokenizer->PopToken();
- if(theNextToken) {
- theType=eHTMLTokenTypes(theNextToken->GetTokenType());
- if(eToken_text==theType) {
- attrNode.SetSkippedContent(theNextToken->GetStringValueXXX());
- }
+
+
+ nsAutoString theTempStr;
+ nsAutoString theStr;
+ PRBool done=PR_FALSE;
+ while(!done) {
+ CHTMLToken* theNextToken=(CHTMLToken*)mTokenizer->PeekToken();
+ if(theNextToken) {
+
+ eHTMLTokenTypes theSubType=eHTMLTokenTypes(theNextToken->GetTokenType());
+ if(eToken_end!=theSubType) {
+ theNextToken=(CHTMLToken*)mTokenizer->PopToken();
+ theNextToken->GetSource(theTempStr);
+ theStr+=theTempStr;
+ gTokenRecycler->RecycleToken(theNextToken);
+ }
+ else done=PR_TRUE;
+ }
+ else done=PR_TRUE;
}
+ theStr.CompressWhitespace();
+ attrNode.SetSkippedContent(theStr);
+
result= OpenHead(attrNode);
if(NS_OK==result) {
if(mSink) {
diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp
index bde247ae091..a3a482d79f0 100644
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -2733,11 +2733,21 @@ nsresult CNavDTD::AddHeadLeaf(nsIParserNode& aNode){
return result;
}
+ if(eHTMLTag_newline==theTag) //omit newlines from head...
+ return result;
+
if(mSink) {
result=OpenHead(aNode);
if(NS_OK==result) {
if(eHTMLTag_title==theTag) {
- mSink->SetTitle(aNode.GetSkippedContent());
+
+ ///XXX this evil hack is necessary only for beta.
+ //Post beta, lets make the GetSkippedContent() call non-const.
+
+ const nsString& theString=aNode.GetSkippedContent();
+ nsString* theStr=(nsString*)&theString;
+ theStr->CompressWhitespace();
+ mSink->SetTitle(theString);
}
else result=AddLeaf(aNode);
// XXX If the return value tells us to block, go
diff --git a/parser/htmlparser/src/nsElementTable.cpp b/parser/htmlparser/src/nsElementTable.cpp
index 3e1eff99db6..43abefc10a0 100644
--- a/parser/htmlparser/src/nsElementTable.cpp
+++ b/parser/htmlparser/src/nsElementTable.cpp
@@ -158,7 +158,7 @@ static eHTMLTags gHTMLKidList[]={eHTMLTag_body,eHTMLTag_frameset,eHTMLTag_head,e
CTagList gHtmlKids(sizeof(gHTMLKidList)/sizeof(eHTMLTag_unknown),gHTMLKidList);
static eHTMLTags gHeadKidList[]=
- {eHTMLTag_base,eHTMLTag_bgsound,eHTMLTag_link,eHTMLTag_meta,eHTMLTag_script,eHTMLTag_style,eHTMLTag_title,eHTMLTag_noembed,eHTMLTag_noscript};
+ {eHTMLTag_base,eHTMLTag_bgsound,eHTMLTag_link,eHTMLTag_meta,eHTMLTag_script,eHTMLTag_style,eHTMLTag_title,eHTMLTag_noembed,eHTMLTag_noscript,eHTMLTag_newline};
CTagList gHeadKids(sizeof(gHeadKidList)/sizeof(eHTMLTag_unknown),gHeadKidList);
CTagList gLIKids(2,0,eHTMLTag_ol,eHTMLTag_ul);
@@ -285,7 +285,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE|kFlowEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown},
@@ -830,7 +830,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (SPECIALTYPE|kSelf), kNone,
+ /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (kFlowEntity|SPECIALTYPE|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown},
@@ -982,7 +982,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
- /*parent,incl,exclgroups*/ kBlock, (kInlineEntity|kSelf|kFlowEntity), kNone,
+ /*parent,incl,exclgroups*/ kBlockEntity, (kInlineEntity|kSelf|kFlowEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown},
diff --git a/parser/htmlparser/src/nsViewSourceHTML.cpp b/parser/htmlparser/src/nsViewSourceHTML.cpp
index 98f05bc5f66..20d8a9846f0 100644
--- a/parser/htmlparser/src/nsViewSourceHTML.cpp
+++ b/parser/htmlparser/src/nsViewSourceHTML.cpp
@@ -992,13 +992,29 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
if(eHTMLTag_title == theTag){
nsCParserNode attrNode(theToken,mLineNumber,GetTokenRecycler());
- CToken* theNextToken = mTokenizer->PopToken();
- if(theNextToken) {
- theType=eHTMLTokenTypes(theNextToken->GetTokenType());
- if(eToken_text==theType) {
- attrNode.SetSkippedContent(theNextToken->GetStringValueXXX());
- }
+
+
+ nsAutoString theTempStr;
+ nsAutoString theStr;
+ PRBool done=PR_FALSE;
+ while(!done) {
+ CHTMLToken* theNextToken=(CHTMLToken*)mTokenizer->PeekToken();
+ if(theNextToken) {
+
+ eHTMLTokenTypes theSubType=eHTMLTokenTypes(theNextToken->GetTokenType());
+ if(eToken_end!=theSubType) {
+ theNextToken=(CHTMLToken*)mTokenizer->PopToken();
+ theNextToken->GetSource(theTempStr);
+ theStr+=theTempStr;
+ gTokenRecycler->RecycleToken(theNextToken);
+ }
+ else done=PR_TRUE;
+ }
+ else done=PR_TRUE;
}
+ theStr.CompressWhitespace();
+ attrNode.SetSkippedContent(theStr);
+
result= OpenHead(attrNode);
if(NS_OK==result) {
if(mSink) {