diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index 24133b263d0..8317cb13ff8 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -1118,7 +1118,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode CParserContext* pc=mParser->PeekContext(); void* theDocID=(pc)? pc->mKey:0; - result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser); + result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser); } } @@ -1369,6 +1369,10 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { aToken->SetTypeID(theChildTag=eHTMLTag_img); break; + case eHTMLTag_noscript: + isTokenHandled=PR_TRUE; // XXX - Throwing NOSCRIPT to the floor...yet another time.. + break; + case eHTMLTag_script: theHeadIsParent=((!mHasOpenBody) || mRequestedHead); mHasOpenScript=PR_TRUE; @@ -1380,17 +1384,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { if(!isTokenHandled) { if(theHeadIsParent || (mHasOpenHead && ((eHTMLTag_newline==theChildTag) || (eHTMLTag_whitespace==theChildTag)))) { - //Ref. Bug 21008 -- Creating model for NOSCRIPT content - static eHTMLTags gNoXTags[]={eHTMLTag_noembed,eHTMLTag_noframes,eHTMLTag_nolayer,eHTMLTag_noscript}; - if(FindTagInSet(theChildTag,gNoXTags,sizeof(gNoXTags)/sizeof(theChildTag))) { - result=OpenContainer(theNode,theChildTag,PR_TRUE); - } - else if(HasOpenContainer(gNoXTags,sizeof(gNoXTags)/sizeof(eHTMLTag_unknown))) { - result=AddLeaf(theNode); - } - else { result=AddHeadLeaf(theNode); - } } else result=HandleDefaultStartToken(aToken,theChildTag,theNode); } @@ -3307,7 +3301,15 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode *aNode){ nsresult CNavDTD::AddHeadLeaf(nsIParserNode *aNode){ nsresult result=NS_OK; + static eHTMLTags gNoXTags[]={eHTMLTag_noembed,eHTMLTag_noframes,eHTMLTag_nolayer,eHTMLTag_noscript}; + eHTMLTags theTag=(eHTMLTags)aNode->GetNodeType(); + + if(eHTMLTag_meta==theTag) { + if(HasOpenContainer(gNoXTags,sizeof(gNoXTags)/sizeof(eHTMLTag_unknown))) { + return result; + } + } if(mSink) { result=OpenHead(aNode); diff --git a/htmlparser/src/nsElementTable.cpp b/htmlparser/src/nsElementTable.cpp index 95b33ee69f3..d4026ac8e00 100644 --- a/htmlparser/src/nsElementTable.cpp +++ b/htmlparser/src/nsElementTable.cpp @@ -861,7 +861,7 @@ void InitializeElementTable(void) { /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlowEntity|kSelf, kNone, /*special props, prop-range*/ 0, kNoPropRange, - /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); + /*special parents,kids,skip*/ 0,0,eHTMLTag_noscript); Initialize( /*tag*/ eHTMLTag_object, diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 24133b263d0..8317cb13ff8 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -1118,7 +1118,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode CParserContext* pc=mParser->PeekContext(); void* theDocID=(pc)? pc->mKey:0; - result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser); + result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser); } } @@ -1369,6 +1369,10 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { aToken->SetTypeID(theChildTag=eHTMLTag_img); break; + case eHTMLTag_noscript: + isTokenHandled=PR_TRUE; // XXX - Throwing NOSCRIPT to the floor...yet another time.. + break; + case eHTMLTag_script: theHeadIsParent=((!mHasOpenBody) || mRequestedHead); mHasOpenScript=PR_TRUE; @@ -1380,17 +1384,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { if(!isTokenHandled) { if(theHeadIsParent || (mHasOpenHead && ((eHTMLTag_newline==theChildTag) || (eHTMLTag_whitespace==theChildTag)))) { - //Ref. Bug 21008 -- Creating model for NOSCRIPT content - static eHTMLTags gNoXTags[]={eHTMLTag_noembed,eHTMLTag_noframes,eHTMLTag_nolayer,eHTMLTag_noscript}; - if(FindTagInSet(theChildTag,gNoXTags,sizeof(gNoXTags)/sizeof(theChildTag))) { - result=OpenContainer(theNode,theChildTag,PR_TRUE); - } - else if(HasOpenContainer(gNoXTags,sizeof(gNoXTags)/sizeof(eHTMLTag_unknown))) { - result=AddLeaf(theNode); - } - else { result=AddHeadLeaf(theNode); - } } else result=HandleDefaultStartToken(aToken,theChildTag,theNode); } @@ -3307,7 +3301,15 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode *aNode){ nsresult CNavDTD::AddHeadLeaf(nsIParserNode *aNode){ nsresult result=NS_OK; + static eHTMLTags gNoXTags[]={eHTMLTag_noembed,eHTMLTag_noframes,eHTMLTag_nolayer,eHTMLTag_noscript}; + eHTMLTags theTag=(eHTMLTags)aNode->GetNodeType(); + + if(eHTMLTag_meta==theTag) { + if(HasOpenContainer(gNoXTags,sizeof(gNoXTags)/sizeof(eHTMLTag_unknown))) { + return result; + } + } if(mSink) { result=OpenHead(aNode); diff --git a/parser/htmlparser/src/nsElementTable.cpp b/parser/htmlparser/src/nsElementTable.cpp index 95b33ee69f3..d4026ac8e00 100644 --- a/parser/htmlparser/src/nsElementTable.cpp +++ b/parser/htmlparser/src/nsElementTable.cpp @@ -861,7 +861,7 @@ void InitializeElementTable(void) { /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlowEntity|kSelf, kNone, /*special props, prop-range*/ 0, kNoPropRange, - /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); + /*special parents,kids,skip*/ 0,0,eHTMLTag_noscript); Initialize( /*tag*/ eHTMLTag_object,