mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-06 22:53:08 +00:00
Fix for bug#s 3737, 12062, 9059.
This commit is contained in:
parent
4b3a77da70
commit
ef7db2ac2d
@ -689,7 +689,10 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
---------------------------------------------------------------------------------
|
||||
*/
|
||||
if(!execSkipContent) {
|
||||
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
|
||||
static eHTMLTags passThru[]= {
|
||||
eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,
|
||||
eHTMLTag_whitespace,eHTMLTag_script,eHTMLTag_noscript,
|
||||
eHTMLTag_userdefined};
|
||||
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
||||
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
||||
if((!mHadBody) && (!mHadFrameset)){
|
||||
@ -1012,7 +1015,16 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
|
||||
|
||||
if(!(theCanContainResult && theChildAgrees)) {
|
||||
if (!CanPropagate(theParentTag,aChildTag)) {
|
||||
if(nsHTMLElement::IsContainer(aChildTag)){
|
||||
if(nsHTMLElement::IsContainer(aChildTag)){
|
||||
if(gHTMLElements[aChildTag].HasSpecialProperty(kDiscardMisplaced)) {
|
||||
// Closing the tags above might cause non-compatible results.
|
||||
// Ex. <TABLE><TR><TD><TBODY>Text</TD></TR></TABLE>.
|
||||
// In the example above <TBODY> is badly misplaced. To be backwards
|
||||
// compatible we should not attempt to close the tags above it, for
|
||||
// the contents inside the table might get thrown out of the table.
|
||||
// The safest thing to do is to discard this tag.
|
||||
return result;
|
||||
}
|
||||
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
|
||||
}//if
|
||||
else break;
|
||||
|
@ -1039,7 +1039,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable, &gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, (kSelf|kInlineEntity),
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kDefaultPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTBodyKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_td,
|
||||
@ -1063,7 +1063,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable, &gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kSelf,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kNoPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_th,
|
||||
@ -1079,7 +1079,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable,&gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kSelf,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kNoPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_title,
|
||||
|
@ -137,16 +137,17 @@ extern CTagList gFramesetKids;
|
||||
extern CTagList gHeadingTags;
|
||||
|
||||
//special property bits...
|
||||
static const int kDiscardTag = 0x0001; //tells us to toss this tag
|
||||
static const int kOmitEndTag = 0x0002; //safely ignore end tag
|
||||
static const int kLegalOpen = 0x0004; //Lets BODY, TITLE, SCRIPT to reopen
|
||||
static const int kOmitWS = 0x0008; //If set, the tag can omit all ws and newlines
|
||||
static const int kNoPropagate = 0x0010; //If set, this tag won't propagate as a child
|
||||
static const int kBadContentWatch = 0x0020;
|
||||
static const int kNoStyleLeaksIn = 0x0040;
|
||||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kDiscardTag = 0x0001; //tells us to toss this tag
|
||||
static const int kOmitEndTag = 0x0002; //safely ignore end tag
|
||||
static const int kLegalOpen = 0x0004; //Lets BODY, TITLE, SCRIPT to reopen
|
||||
static const int kOmitWS = 0x0008; //If set, the tag can omit all ws and newlines
|
||||
static const int kNoPropagate = 0x0010; //If set, this tag won't propagate as a child
|
||||
static const int kBadContentWatch = 0x0020;
|
||||
static const int kNoStyleLeaksIn = 0x0040;
|
||||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kDiscardMisplaced = 0x0400; //If set, then the tag, if misplaced, will be ignored.
|
||||
|
||||
//*********************************************************************************************
|
||||
// The following ints define the standard groups of HTML elements...
|
||||
|
@ -689,7 +689,10 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||
---------------------------------------------------------------------------------
|
||||
*/
|
||||
if(!execSkipContent) {
|
||||
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
|
||||
static eHTMLTags passThru[]= {
|
||||
eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,
|
||||
eHTMLTag_whitespace,eHTMLTag_script,eHTMLTag_noscript,
|
||||
eHTMLTag_userdefined};
|
||||
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
||||
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
||||
if((!mHadBody) && (!mHadFrameset)){
|
||||
@ -1012,7 +1015,16 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
|
||||
|
||||
if(!(theCanContainResult && theChildAgrees)) {
|
||||
if (!CanPropagate(theParentTag,aChildTag)) {
|
||||
if(nsHTMLElement::IsContainer(aChildTag)){
|
||||
if(nsHTMLElement::IsContainer(aChildTag)){
|
||||
if(gHTMLElements[aChildTag].HasSpecialProperty(kDiscardMisplaced)) {
|
||||
// Closing the tags above might cause non-compatible results.
|
||||
// Ex. <TABLE><TR><TD><TBODY>Text</TD></TR></TABLE>.
|
||||
// In the example above <TBODY> is badly misplaced. To be backwards
|
||||
// compatible we should not attempt to close the tags above it, for
|
||||
// the contents inside the table might get thrown out of the table.
|
||||
// The safest thing to do is to discard this tag.
|
||||
return result;
|
||||
}
|
||||
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
|
||||
}//if
|
||||
else break;
|
||||
|
@ -1039,7 +1039,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable, &gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, (kSelf|kInlineEntity),
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kDefaultPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTBodyKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_td,
|
||||
@ -1063,7 +1063,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable, &gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kSelf,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kNoPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_th,
|
||||
@ -1079,7 +1079,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gInTable,&gInTable,
|
||||
/*autoclose starttags and endtags*/ &gTBodyAutoClose,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kSelf,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn), kNoPropRange,
|
||||
/*special props, prop-range*/ (kNoPropagate|kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kDiscardMisplaced), kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown},
|
||||
|
||||
{ /*tag*/ eHTMLTag_title,
|
||||
|
@ -137,16 +137,17 @@ extern CTagList gFramesetKids;
|
||||
extern CTagList gHeadingTags;
|
||||
|
||||
//special property bits...
|
||||
static const int kDiscardTag = 0x0001; //tells us to toss this tag
|
||||
static const int kOmitEndTag = 0x0002; //safely ignore end tag
|
||||
static const int kLegalOpen = 0x0004; //Lets BODY, TITLE, SCRIPT to reopen
|
||||
static const int kOmitWS = 0x0008; //If set, the tag can omit all ws and newlines
|
||||
static const int kNoPropagate = 0x0010; //If set, this tag won't propagate as a child
|
||||
static const int kBadContentWatch = 0x0020;
|
||||
static const int kNoStyleLeaksIn = 0x0040;
|
||||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kDiscardTag = 0x0001; //tells us to toss this tag
|
||||
static const int kOmitEndTag = 0x0002; //safely ignore end tag
|
||||
static const int kLegalOpen = 0x0004; //Lets BODY, TITLE, SCRIPT to reopen
|
||||
static const int kOmitWS = 0x0008; //If set, the tag can omit all ws and newlines
|
||||
static const int kNoPropagate = 0x0010; //If set, this tag won't propagate as a child
|
||||
static const int kBadContentWatch = 0x0020;
|
||||
static const int kNoStyleLeaksIn = 0x0040;
|
||||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kDiscardMisplaced = 0x0400; //If set, then the tag, if misplaced, will be ignored.
|
||||
|
||||
//*********************************************************************************************
|
||||
// The following ints define the standard groups of HTML elements...
|
||||
|
Loading…
x
Reference in New Issue
Block a user