зеркало из https://github.com/mozilla/pjs.git
fixes to bugs: 9283, 13210, 13845, 13688, 14265, 14308, 14314
This commit is contained in:
Родитель
e88d99f2af
Коммит
7c150863c7
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче