diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index e9386168bf8..6076756640e 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -2544,15 +2544,6 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const } #endif - if(!result) { - // Bug 42429 - Preserve whitespace inside TABLE,TR,TBODY,TFOOT,etc., - if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) { - if(nsHTMLElement::IsWhitespaceTag((eHTMLTags)aChild)) { - result=PR_TRUE; - } - } - } - if(eHTMLTag_nobr==aChild) { if(IsInlineElement(aParent,aParent)){ if(HasOpenContainer((eHTMLTags)aChild)) { @@ -2723,12 +2714,6 @@ PRBool CNavDTD::CanOmit(eHTMLTags aParent,eHTMLTags aChild,PRBool& aParentContai } - if(gHTMLElements[aParent].HasSpecialProperty(kOmitWS)) { - if(nsHTMLElement::IsWhitespaceTag(aChild)) { - return PR_TRUE; - } - } - if(gHTMLElements[aParent].CanExclude(aChild)){ return PR_TRUE; } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 75e6b4d7083..6a998448e2a 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -227,7 +227,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*special props, prop-range*/ kOmitWS|kNonContainer, 10, + /*special props, prop-range*/ kNonContainer, 10, /*special parents,kids,skip*/ 0,&gUnknownKids,eHTMLTag_unknown); /************************************************* @@ -431,7 +431,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gColParents,&gColParents, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*special props, prop-range*/ kNoPropagate|kOmitWS|kNonContainer,kDefaultPropRange, + /*special props, prop-range*/ kNoPropagate|kNonContainer,kDefaultPropRange, /*special parents,kids,skip*/ &gColParents,0,eHTMLTag_unknown); Initialize( @@ -440,7 +440,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gInTable,&gInTable, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*special props, prop-range*/ kOmitWS|kNoPropagate,kDefaultPropRange, + /*special props, prop-range*/ kNoPropagate,kDefaultPropRange, /*special parents,kids,skip*/ &gInTable,&gColgroupKids,eHTMLTag_unknown); Initialize( @@ -584,7 +584,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gFramesetParents,&gInHTML, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kHTMLContent, kSelf, kAllTags, - /*special props, prop-range*/ kOmitWS|kNoPropagate|kNoStyleLeaksIn, kNoPropRange, + /*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn, kNoPropRange, /*special parents,kids,skip*/ &gInHTML,&gFramesetKids,eHTMLTag_unknown); @@ -803,7 +803,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kSpecial, kInlineEntity|kBlockEntity, kNone, - /*special props, prop-range*/ kOmitWS, kDefaultPropRange, + /*special props, prop-range*/ 0, kDefaultPropRange, /*special parents,kids,skip*/ 0,&gMapKids,eHTMLTag_unknown); Initialize( @@ -902,7 +902,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*special props, prop-range*/ kOmitWS,kDefaultPropRange, + /*special props, prop-range*/ 0,kDefaultPropRange, /*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown); Initialize( @@ -1001,7 +1001,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gInForm,&gInForm, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kFormControl, kNone, kFlowEntity|kDLChild, - /*special props, prop-range*/ kNoPropagate|kOmitWS|kNoStyleLeaksIn, kDefaultPropRange, + /*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn, kDefaultPropRange, /*special parents,kids,skip*/ &gInForm,&gContainsOpts,eHTMLTag_unknown); Initialize( @@ -1182,7 +1182,7 @@ void InitializeElementTable(void) { /*rootnodes,endrootnodes*/ &gInHead,&gInHead, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kHeadMisc,kPCDATA, kNone, - /*special props, prop-range*/ kOmitWS|kNoStyleLeaksIn, kNoPropRange, + /*special props, prop-range*/ kNoStyleLeaksIn, kNoPropRange, /*special parents,kids,skip*/ &gInHead,&gContainsText,eHTMLTag_title); Initialize( @@ -1262,8 +1262,8 @@ void InitializeElementTable(void) { /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*rootnodes,endrootnodes*/ &gInBody,&gInBody, /*autoclose starttags and endtags*/ 0,0,0,0, - /*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone, - /*special props, prop-range*/ kNonContainer,kNoPropRange, + /*parent,incl,exclgroups*/ kFlowEntity|kHeadMisc, kNone, kNone, + /*special props, prop-range*/ kNonContainer|kLegalOpen,kNoPropRange, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); Initialize( @@ -1271,8 +1271,8 @@ void InitializeElementTable(void) { /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*rootnodes,endrootnodes*/ &gInBody,&gInBody, /*autoclose starttags and endtags*/ 0,0,0,0, - /*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone, - /*special props, prop-range*/ kNonContainer, kNoPropRange, + /*parent,incl,exclgroups*/ kFlowEntity|kHeadMisc, kNone, kNone, + /*special props, prop-range*/ kNonContainer|kLegalOpen, kNoPropRange, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown); Initialize( @@ -1731,7 +1731,7 @@ PRBool nsHTMLElement::IsSectionTag(eHTMLTags aTag){ */ PRBool nsHTMLElement::CanContain(eHTMLTags aParent,eHTMLTags aChild,nsDTDMode aMode){ PRBool result=PR_FALSE; - if((aParent>=eHTMLTag_unknown) & (aParent<=eHTMLTag_userdefined)){ + if((aParent>=eHTMLTag_unknown) && (aParent<=eHTMLTag_userdefined)){ result=gHTMLElements[aParent].CanContain(aChild,aMode); } return result; @@ -1746,14 +1746,19 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aParent,eHTMLTags aChild,nsDTDMode aM PRBool nsHTMLElement::CanExclude(eHTMLTags aChild) const{ PRBool result=PR_FALSE; - //Note that special kids takes precedence over exclusions... + if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) { + // Some tags could be opened anywhere, in the document, as they please. + return PR_FALSE; + } + + //Note that special kids takes precedence over exclusions... if(mSpecialKids) { if(FindTagInSet(aChild,mSpecialKids->mTags,mSpecialKids->mCount)) { return PR_FALSE; } } - if(eHTMLTag_unknown!=mExclusionBits){ + if(mExclusionBits){ if(gHTMLElements[aChild].IsMemberOf(mExclusionBits)) { result=PR_TRUE; } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h index 3a27816650c..4f637c9f8ce 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.h +++ b/mozilla/parser/htmlparser/src/nsElementTable.h @@ -261,18 +261,17 @@ extern nsHTMLElement* gHTMLElements; 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 kNoPropagate = 0x0008; //If set, this tag won't propagate as a child +static const int kBadContentWatch = 0x0010; -static const int kNoStyleLeaksIn = 0x0040; -static const int kNoStyleLeaksOut = 0x0080; +static const int kNoStyleLeaksIn = 0x0020; +static const int kNoStyleLeaksOut = 0x0040; -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 kNonContainer = 0x0400; //If set, then this tag is not a container. -static const int kHandleStrayTag = 0x0800; //If set, we automatically open a start tag -static const int kRequiresBody = 0x1000; //If set, then in case of no BODY one will be opened up immediately. -static const int kVerifyHierarchy = 0x2000; //If set, check to see if the tag is a child or a sibling.. +static const int kMustCloseSelf = 0x0080; +static const int kSaveMisplaced = 0x0100; //If set, then children this tag can't contain are pushed onto the misplaced stack +static const int kNonContainer = 0x0200; //If set, then this tag is not a container. +static const int kHandleStrayTag = 0x0400; //If set, we automatically open a start tag +static const int kRequiresBody = 0x0800; //If set, then in case of no BODY one will be opened up immediately. +static const int kVerifyHierarchy = 0x1000; //If set, check to see if the tag is a child or a sibling.. #endif