diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 1070a981227..0fa2e55fb39 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1268,7 +1268,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx, str.Append('\n'); } - result = mParser->Parse(str, PR_TRUE,PR_FALSE,PR_FALSE); + result = mParser->Parse(str, PR_TRUE,PR_FALSE,PR_TRUE); if (NS_OK != result) { return result; } diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index ccfb21c6385..f6bee548bfa 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -696,23 +696,31 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsTagStack& aTagStack) { */ eHTMLTags FindAutoCloseTargetForStartTag(eHTMLTags aCurrentTag,nsTagStack& aTagStack) { int theTopIndex=aTagStack.mCount; - eHTMLTags aPrevTag=aTagStack.mTags[theTopIndex-1]; + eHTMLTags thePrevTag=aTagStack.Last(); if(nsHTMLElement::IsContainer(aCurrentTag)){ - if(aPrevTag==aCurrentTag) { + if(thePrevTag==aCurrentTag) { return (gHTMLElements[aCurrentTag].CanContainSelf()) ? eHTMLTag_unknown: aCurrentTag; } if(nsHTMLElement::IsBlockCloser(aCurrentTag)) { + PRInt32 theRootIndex=kNotFound; CTagList* theRootTags=gHTMLElements[aCurrentTag].GetRootTags(); if(theRootTags) { - PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); + theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); CTagList* theStartTags=gHTMLElements[aCurrentTag].GetAutoCloseStartTags(); PRInt32 thePeerIndex=kNotFound; if(theStartTags){ thePeerIndex=theStartTags->GetBottommostIndexOf(aTagStack,theRootIndex+1); } - else thePeerIndex=GetTopmostIndexOf(aCurrentTag,aTagStack); + else { + //this extra check is need to handle case like this:

+ //the new div can close the P,but doesn't close the top DIV. + thePeerIndex=GetTopmostIndexOf(aCurrentTag,aTagStack); + if(gHTMLElements[aCurrentTag].CanContainSelf()) { + thePeerIndex++; + } + } if(theRootIndex

<- + while((theRootIndex<--theTopIndex) && (!gHTMLElements[aTagStack.mTags[theTopIndex]].CanContain(aCurrentTag))) { + } + return aTagStack.mTags[theTopIndex+1]; + //return aTagStack.mTags[theRootIndex+1]; + } } //if - else if(nsHTMLElement::IsInlineElement(aCurrentTag)) { - }//if } //if return eHTMLTag_unknown; } @@ -748,6 +761,24 @@ eHTMLTags FindAutoCloseTargetForStartTag(eHTMLTags aCurrentTag,nsTagStack& aTagS */ PRBool CanBeContained(eHTMLTags aChildTag,nsTagStack& aTagStack) { PRBool result=PR_TRUE; + + CTagList* theRootTags=gHTMLElements[aChildTag].GetRootTags(); + if(theRootTags) { + PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); + PRInt32 theChildIndex=aTagStack.GetTopmostIndexOf(aChildTag); + if(kNotFound==theChildIndex) { + CTagList* theSynTags=gHTMLElements[aChildTag].GetSynonymousTags(); //get the list of tags that THIS tag can close + if(theSynTags) { + theChildIndex=theSynTags->GetTopmostIndexOf(aTagStack); + } + } + if(theRootIndexGetTopmostIndexOf(aTagStack); + } + else { + theChildIndex=aTagStack.GetTopmostIndexOf(aTag); + } + return PRBool(theRootIndexGetTopmostIndexOf(aTagStack); + } + } + return theChildIndex; +} + +/** + * This method is called to determine whether or not an END tag + * can be autoclosed. This means that based on the current + * context, the stack should be closed to the nearest matching + * tag. + * + * @param aTag -- tag enum of child to be tested + * @return PR_TRUE if autoclosure should occur + */ +eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsTagStack& aTagStack) { + int theTopIndex=aTagStack.mCount; + eHTMLTags thePrevTag=aTagStack.Last(); + + if(nsHTMLElement::IsContainer(aCurrentTag)){ + PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aTagStack,aCurrentTag); + + if(kNotFoundContains(theNextTag)) { + if(PR_TRUE==theRootTags->Contains(theNextTag)) { + return eHTMLTag_unknown; //we encountered a tag in root list so fail (because we're gated). + } + //otherwise presume it's something we can simply ignore and continue search... + } + //otherwise its in the close list so skip to next tag... + } + return aCurrentTag; //if you make it here, we're ungated and found a target! + }//if + else if(theRootTags) { + //since we didn't find any close tags, see if there is an instance of aCurrentTag + //above the stack from the roottag. + if(HasCloseablePeerAboveRoot(*theRootTags,aTagStack,aCurrentTag)) + return aCurrentTag; + else return eHTMLTag_unknown; + } + } //if + }//if + } //if + return eHTMLTag_unknown; +} /** * This method gets called when an end token has been @@ -995,23 +1134,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { NS_PRECONDITION(0!=aToken,kNullToken); nsresult result=NS_OK; - CEndToken* et = (CEndToken*)(aToken); - eHTMLTags theChildTag=(eHTMLTags)et->GetTypeID(); - - // Here's the hacky part: - // Because we're trying to be backward compatible with Nav4/5, - // we have to handle explicit styles the way it does. That means - // that we keep an internal style stack.When an EndToken occurs, - // we should see if it is an explicit style tag. If so, we can - // close the explicit style tag (goofy, huh?) - - - //now check to see if this token should be omitted, or - //if it's gated from closing by the presence of another tag. - if(PR_TRUE==CanOmitEndTag(mBodyContext->Last(),theChildTag)) { - UpdateStyleStackForCloseTag(theChildTag,theChildTag); - return result; - } + eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); nsCParserNode theNode((CHTMLToken*)aToken,mLineNumber); switch(theChildTag) { @@ -1029,26 +1152,20 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { result=CloseContainer(theNode,theChildTag,PR_FALSE); break; - case eHTMLTag_td: - case eHTMLTag_th: - //result=CloseContainersTo(theChildTag,PR_TRUE); - // Empty the transient style stack (we just closed any extra - // ones off so it's safe to do it now) because they don't carry - // forward across table cell boundaries. - //mBodyContext->mStyles->mCount=0; - //break; - default: - if(IsContainer(theChildTag)){ - CTagList* theCloseTags=gHTMLElements[theChildTag].GetAutoCloseEndTags(); - - if(theCloseTags){ - PRInt32 thePeerIndex=theCloseTags->GetTopmostIndexOf(mBodyContext->mTags); - theChildTag=(kNotFoundmTags[thePeerIndex] : theChildTag; + { + //now check to see if this token should be omitted, or + //if it's gated from closing by the presence of another tag. + if(PR_TRUE==CanOmitEndTag(mBodyContext->Last(),theChildTag)) { + UpdateStyleStackForCloseTag(theChildTag,theChildTag); + } + else { + eHTMLTags theTarget=FindAutoCloseTargetForEndTag(theChildTag,mBodyContext->mTags); + if(eHTMLTag_unknown!=theTarget) { + result=CloseContainersTo(theTarget,PR_TRUE); + } } - result=CloseContainersTo(theChildTag,PR_TRUE); } - // break; } return result; @@ -1145,11 +1262,6 @@ nsresult CNavDTD::HandleScriptToken(nsCParserNode& aNode) { PRInt32 attrCount=aNode.GetAttributeCount(PR_TRUE); nsresult result=AddLeaf(aNode); - CParserContext* theContext=mParser->PeekContext(); - if(theContext && theContext->mPrevContext && (CParserContext::eCTString==theContext->mContextType)) { - mParser->PopContext(); - delete theContext; - } return result; } @@ -1337,28 +1449,6 @@ PRBool CNavDTD::CanPropagate(eHTMLTags aParentTag,eHTMLTags aChildTag) const { return result; } -/** - * Call this to see if you have a closeable peer on the stack that - * is ABOVE one of its root tags. - * - * @update gess 3/25/98 - * @param aRootTagList -- list of root tags for aTag - * @param aTag -- tag to test for containership - * @return PR_TRUE if given tag can contain other tags - */ -PRBool HasCloseablePeerAboveRoot(CTagList& aRootTagList,nsTagStack& aTagStack,eHTMLTags aTag) { - PRInt32 theRootIndex=aRootTagList.GetTopmostIndexOf(aTagStack); - CTagList* theCloseTags=gHTMLElements[aTag].GetAutoCloseStartTags(); - PRInt32 theChildIndex=-1; - PRBool result=PR_FALSE; - if(theCloseTags) { - theChildIndex=theCloseTags->GetTopmostIndexOf(aTagStack); - } - else { - theChildIndex=aTagStack.GetTopmostIndexOf(aTag); - } - return PRBool(theRootIndexContains(theNextTag)) { - if(PR_TRUE==theRootTags->Contains(theNextTag)) { - return eHTMLTag_unknown; //we encountered a tag in root list so fail (because we're gated). - } - //otherwise presume it's something we can simply ignore and continue search... - } - //otherwise its in the close list so skip to next tag... - } - return aCurrentTag; //if you make it here, we're ungated and found a target! - }//if - else if(theRootTags) { - //since we didn't find any close tags, see if there is an instance of aCurrentTag - //above the stack from the roottag. - if(HasCloseablePeerAboveRoot(*theRootTags,aTagStack,aCurrentTag)) - return aCurrentTag; - else return eHTMLTag_unknown; - } - } //if - } //if - return eHTMLTag_unknown; -} /** * This method gets called to determine whether a given @@ -1613,62 +1649,34 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsTagStack& aTagSta PRBool CNavDTD::CanOmitEndTag(eHTMLTags aParent,eHTMLTags aChild) const { PRBool result=PR_FALSE; - //begin with some simple (and obvious) cases... - switch((eHTMLTags)aChild) { + if(gHTMLElements[aChild].CanOmitEndTag(aParent)) { + return PR_TRUE; + } - case eHTMLTag_userdefined: - case eHTMLTag_comment: - result=PR_TRUE; - break; - - case eHTMLTag_a: - result=!HasOpenContainer(aChild); - break; - - case eHTMLTag_html: - case eHTMLTag_body: - result=PR_TRUE; - break; - - case eHTMLTag_newline: - case eHTMLTag_whitespace: - - switch(aParent) { - case eHTMLTag_html: case eHTMLTag_head: - case eHTMLTag_title: case eHTMLTag_map: - case eHTMLTag_tr: case eHTMLTag_table: - case eHTMLTag_thead: case eHTMLTag_tfoot: - case eHTMLTag_tbody: case eHTMLTag_col: - case eHTMLTag_colgroup: case eHTMLTag_unknown: - result=PR_TRUE; - default: - break; - } //switch - break; - - //It turns out that a can be closed by any other - //This code makes them all seem compatible. - case eHTMLTag_h1: case eHTMLTag_h2: - case eHTMLTag_h3: case eHTMLTag_h4: - case eHTMLTag_h5: case eHTMLTag_h6: - if(FindTagInSet(aParent,gHeadingTags,sizeof(gHeadingTags)/sizeof(eHTMLTag_unknown))) { - result=PR_FALSE; - break; +/* + CTagList* theRootTags=gHTMLElements[aChild].GetRootTags(); + if(theRootTags) { + PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(mBodyContext->mTags); + PRInt32 theChildIndex=GetTopmostIndexOf(aChild); + if(kNotFound==theChildIndex) { + CTagList* theSynTags=gHTMLElements[aChild].GetSynonymousTags(); //get the list of tags that THIS tag can close + if(theSynTags) { + theChildIndex=theSynTags->GetTopmostIndexOf(mBodyContext->mTags); } - //Otherwise, IT's OK TO FALL THROUGH HERE... + } + result=!PRBool(theRootIndexGetTopmostIndexOf(mBodyContext->mTags); + } + } + result=PRBool(kNotFound==theChildIndex); - default: - { - PRInt32 theTagPos=GetTopmostIndexOf(aChild); - if(kNotFound!=theTagPos) { - eHTMLTags theTarget=FindAutoCloseTargetForEndTag(aChild,mBodyContext->mTags,theTagPos); - result=PRBool(eHTMLTag_unknown==theTarget); - } - else result=PR_TRUE; - } - break; - } //switch return result; } diff --git a/mozilla/htmlparser/src/nsElementTable.cpp b/mozilla/htmlparser/src/nsElementTable.cpp index 01e5fafcbca..e3a7f36258e 100644 --- a/mozilla/htmlparser/src/nsElementTable.cpp +++ b/mozilla/htmlparser/src/nsElementTable.cpp @@ -32,7 +32,7 @@ * @param * @return */ -PRBool CTagList::Contains(eHTMLTags aTag){ +inline PRBool CTagList::Contains(eHTMLTags aTag){ PRBool result=PR_FALSE; if(mTagList) { result=FindTagInSet(aTag,mTagList,mCount); @@ -51,7 +51,7 @@ PRInt32 CTagList::GetTopmostIndexOf(nsTagStack& aTagStack){ int max=aTagStack.mCount; int index; for(index=max-1;index>0;index--){ - if(FindTagInSet(aTagStack.mTags[index],mTags,mCount)) { + if(Contains(aTagStack.mTags[index])) { return index; } } @@ -68,7 +68,7 @@ PRInt32 CTagList::GetBottommostIndexOf(nsTagStack& aTagStack,PRInt32 aStartOffse int max=aTagStack.mCount; int index; for(index=aStartOffset;index*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_area, - /*rootnodes*/ &gAreaParent, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gAreaParent,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gAreaParent,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_b, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_base, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_basefont, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ (kSpecial|kPreExclusion), kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_bdo, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_bgsound, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_big, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kFontStyle|kPreformatted), (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_blink, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kFontStyle|kPreformatted), (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_blockquote, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_body, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ &gBodyAutoClose,0, + /*rootnodes,endrootnodes*/ &gInHTML, &gInHTML, + /*autoclose starttags and endtags*/ &gBodyAutoClose,0,0, /*parent,incl,exclgroups*/ kHTMLContent, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_br, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_button, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kFlow, kFormControl, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gButtonKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_caption, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gCaptionAutoClose,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gCaptionAutoClose,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_center, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, (kInline|kSelf|kFlow), kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_cite, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kInline|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_code, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_col, - /*rootnodes*/ &gColParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gColParents,&gColParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gColParents,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_colgroup, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gColgroupKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dd, - /*rootnodes*/ &gInDL, - /*autoclose starttags and endtags*/ &gDTCloseTags,0, + /*rootnodes,endrootnodes*/ &gInDL, &gInDL, + /*autoclose starttags and endtags*/ &gDTCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInDL,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_del, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dfn, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dir, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_div, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dl, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kBlock, kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, kSpecial, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dt, - /*rootnodes*/ &gInDL, - /*autoclose starttags and endtags*/ &gDTCloseTags,0, + /*rootnodes,endrootnodes*/ &gInDL,&gInDL, + /*autoclose starttags and endtags*/ &gDTCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents, kids
*/ &gInDL,&gDTKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_em, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_embed, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_fieldset, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFieldsetKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_font, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFontKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_form, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFormKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_frame, - /*rootnodes*/ &gInFrameset, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInFrameset,&gInFrameset, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInFrameset,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_frameset, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHTML,&gInHTML, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kSelf, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHTML,&gFramesetKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h1, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h2, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h3, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h4, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h5, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h6, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_head, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHTML, &gInHTML, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kHeadContent|kHeadMisc), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHTML,&gHeadKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_hr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_html, - /*rootnodes*/ &gHTMLRootTags, - /*autoclose starttags and endtags*/ &gAutoClose,0, + /*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags, + /*autoclose starttags and endtags*/ &gAutoClose,0,0, /*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_i, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_iframe, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ilayer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_img, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_input, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ins, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kSelf|kNone), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_isindex, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kBlock|kHeadContent), kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_kbd, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_keygen, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_label, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_layer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_legend, - /*rootnodes*/ &gInFieldset, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInFieldset,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_li, - /*rootnodes*/ &gLIRootTags, - /*autoclose starttags and endtags*/ &gLIAutoClose,0, + /*rootnodes,endrootnodes*/ &gLIRootTags,&gLIRootTags, + /*autoclose starttags and endtags*/ &gLIAutoClose,0,0, /*parent,incl,exclgroups*/ kList, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gLIKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_link, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead,&gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_listing, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_map, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kBlock, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gMapKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_menu, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kList, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_meta, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_multicol, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_nobr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_noembed, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_noembed}, { /*tag*/ eHTMLTag_noframes, - /*rootnodes*/ &gNoframeRoot, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gNoframeRoot,&gNoframeRoot, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ &gNoframeRoot,&gNoframesKids,eHTMLTag_noframes}, { /*tag*/ eHTMLTag_nolayer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_nolayer}, { /*tag*/ eHTMLTag_noscript, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_noscript}, { /*tag*/ eHTMLTag_object, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ol, - /*rootnodes*/ &gOLRootTags, - /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags, + /*rootnodes,endrootnodes*/ &gOLRootTags,&gOLRootTags, + /*autoclose starttags and endtags*/ &gOLAutoClose, &gULCloseTags, 0, /*parent,incl,exclgroups*/ kBlock, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_optgroup, - /*rootnodes*/ &gOptgroupParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_option, - /*rootnodes*/ &gOptgroupParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gOptgroupParents,&gContainsText,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_p, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, - /*special parents,kids,skip*/ 0,&gInAddress,eHTMLTag_unknown}, + /*special properties*/ 0, + /*special parents,kids,skip*/ 0,&gInP,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_param, - /*rootnodes*/ &gParamParents, - /*autoclose starttags and endtags*/ &gPAutoClose,0, + /*rootnodes,endrootnodes*/ &gParamParents, &gParamParents, + /*autoclose starttags and endtags*/ &gPAutoClose,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gParamParents,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_plaintext, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_html}, { /*tag*/ eHTMLTag_pre, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPreformatted, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gPreKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_q, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_s, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_samp, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_script, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kSpecial|kHeadMisc), kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsText,eHTMLTag_script}, { /*tag*/ eHTMLTag_select, - /*rootnodes*/ &gInForm, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInForm,&gInForm, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInForm,&gContainsOpts,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_server, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_small, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_sound, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_spacer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_span, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_strike, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_strong, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kPhrase|kFontStyle), (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsText,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_style, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_style}, { /*tag*/ eHTMLTag_sub, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_sup, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_table, - /*rootnodes*/ &gInBody, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gInBody, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gTableKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_tbody, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable, &gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTBodyKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_td, - /*rootnodes*/ &gTDRootTags, - /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags, + /*rootnodes,endrootnodes*/ &gTDRootTags,&gTDRootTags, + /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0, /*parent,incl,exclgroups*/ kNone, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTDRootTags,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_textarea, - /*rootnodes*/ &gInForm, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInForm, &gInForm, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInForm,&gContainsText,eHTMLTag_textarea}, { /*tag*/ eHTMLTag_tfoot, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable, &gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_th, - /*rootnodes*/ &gTDRootTags, - /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags, + /*rootnodes,endrootnodes*/ &gTDRootTags,&gTDRootTags, + /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0, /*parent,incl,exclgroups*/ kNone, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTDRootTags,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_thead, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable,&gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_title, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead,&gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kHeadMisc|kPCDATA), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,&gContainsText,eHTMLTag_title}, { /*tag*/ eHTMLTag_tr, - /*rootnodes*/ &gTRParents, - /*autoclose starttags and endtags*/ &gTRCloseTags,0, + /*rootnodes,endrootnodes*/ &gTRParents,&gTRParents, + /*autoclose starttags and endtags*/ &gTRCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTRParents,&gTRKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_tt, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_u, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ul, - /*rootnodes*/ &gOLRootTags, - /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags, + /*rootnodes,endrootnodes*/ &gOLRootTags,&gOLRootTags, + /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags,0, /*parent,incl,exclgroups*/ kBlock, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_var, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_wbr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_xmp, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_xmp}, { /*tag*/ eHTMLTag_text, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_whitespace, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_newline, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_comment, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_entity, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_userdefined, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, }; @@ -1098,7 +1099,8 @@ PRBool nsHTMLElement::IsContainer(eHTMLTags aChild) { * @return */ inline PRBool TestBits(int aBitset,int aTest) { - return PRBool(aBitset & aTest); + PRInt32 result=aBitset & aTest; + return PRBool(result==aTest); } /** @@ -1116,6 +1118,7 @@ PRBool nsHTMLElement::IsContainerType(eHTMLTags aTag,int aType) { return result; } + /** * * @update gess 01/04/99 @@ -1142,7 +1145,8 @@ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ - result=IsFlowElement(aTag); +// result=IsFlowElement(aTag); + result=gHTMLElements[aTag].IsMemberOf(kFlow); if(!result) { static eHTMLTags gClosers[]={ eHTMLTag_table,eHTMLTag_caption,eHTMLTag_dd,eHTMLTag_dt, @@ -1247,8 +1251,8 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aParent,eHTMLTags aChild){ * @param * @return */ -PRBool nsHTMLElement::CanOmitEndTag(eHTMLTags aChild) const{ - PRBool result=PR_FALSE; +PRBool nsHTMLElement::CanOmitEndTag(eHTMLTags aParent) const{ + PRBool result=TestBits(mSpecialProperties,kOmitEndTag); return result; } @@ -1285,6 +1289,29 @@ PRBool nsHTMLElement::IsStyleTag(eHTMLTags aChild) { return result; } + +/** + * + * @update gess12/13/98 + * @param + * @return + */ +PRBool nsHTMLElement::CanContainType(PRInt32 aType) const{ + PRBool result=(aType && TestBits(mInclusionBits,aType)); + return result; +} + +/** + * + * @update gess12/13/98 + * @param + * @return + */ +PRBool nsHTMLElement::IsMemberOf(PRInt32 aSet) const{ + PRBool result=(aSet && TestBits(aSet,mParentBits)); + return result; +} + /** * * @update gess12/13/98 @@ -1322,6 +1349,7 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{ return PR_FALSE; } + if(nsHTMLElement::IsInlineElement(aChild)){ if(nsHTMLElement::IsInlineParent(mTagID)){ return PR_TRUE; @@ -1346,6 +1374,10 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{ } } + if(CanContainType(gHTMLElements[aChild].mParentBits)) { + return PR_TRUE; + } + if(mSpecialKids) { if(mSpecialKids->Contains(aChild)) { return PR_TRUE; diff --git a/mozilla/htmlparser/src/nsElementTable.h b/mozilla/htmlparser/src/nsElementTable.h index 6948c6f7354..ac92ffedf92 100644 --- a/mozilla/htmlparser/src/nsElementTable.h +++ b/mozilla/htmlparser/src/nsElementTable.h @@ -48,7 +48,7 @@ public: PRInt32 GetTopmostIndexOf(nsTagStack& aTagStack); PRInt32 GetBottommostIndexOf(nsTagStack& aTagStack,PRInt32 aStartOffset); - PRBool Contains(eHTMLTags aTag); + inline PRBool Contains(eHTMLTags aTag); eHTMLTags mTags[5]; eHTMLTags* mTagList; @@ -76,8 +76,10 @@ struct nsHTMLElement { static PRBool IsBlockCloser(eHTMLTags aTag); CTagList* GetRootTags(void) const {return mRootNodes;} + CTagList* GetEndRootTags(void) const {return mEndRootNodes;} CTagList* GetAutoCloseStartTags(void) const {return mAutocloseStart;} CTagList* GetAutoCloseEndTags(void) const {return mAutocloseEnd;} + CTagList* GetSynonymousTags(void) const {return mSynonymousTags;} static PRBool IsBlockParent(eHTMLTags aTag); static PRBool IsInlineParent(eHTMLTags aTag); @@ -85,11 +87,14 @@ struct nsHTMLElement { CTagList* GetSpecialChildren(void) const {return mSpecialKids;} CTagList* GetSpecialParents(void) const {return mSpecialParents;} - + + PRBool IsMemberOf(PRInt32 aType) const; + PRBool CanContainType(PRInt32 aType) const; + eHTMLTags GetTag(void) const {return mTagID;} PRBool CanContain(eHTMLTags aChild) const; PRBool CanOmitStartTag(eHTMLTags aChild) const; - PRBool CanOmitEndTag(eHTMLTags aChild) const; + PRBool CanOmitEndTag(eHTMLTags aParent) const; PRBool CanContainSelf() const; PRBool HasSpecialProperty(PRInt32 aProperty) const; @@ -101,9 +106,11 @@ struct nsHTMLElement { static PRBool IsTextTag(eHTMLTags aTag); eHTMLTags mTagID; - CTagList* mRootNodes; //These are the tags above which you many not autoclose + CTagList* mRootNodes; //These are the tags above which you many not autoclose a START tag + CTagList* mEndRootNodes; //These are the tags above which you many not autoclose an END tag CTagList* mAutocloseStart; //these are the start tags that you can automatically close with this START tag CTagList* mAutocloseEnd; //these are the start tags that you can automatically close with this END tag + CTagList* mSynonymousTags; //These are morally equivalent; an end tag for one can close a start tag for another (like ) int mParentBits; //defines groups that can contain this element int mInclusionBits; //defines parental and containment rules int mExclusionBits; //defines things you CANNOT contain @@ -118,6 +125,7 @@ extern nsHTMLElement gHTMLElements[]; //special property bits... static const int kDiscardTag = 0x0001; //tells us to toss this tag +static const int kOmitEndTag = 0x0002; //safely ignore end tag #endif \ No newline at end of file diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp index 615eb7318c3..9f4cb3563ef 100644 --- a/mozilla/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp @@ -580,7 +580,7 @@ nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) { /* - * default constructor + * Default constructor * * @update gess 3/25/98 * @param aName -- string to init token name with @@ -591,7 +591,7 @@ CCommentToken::CCommentToken() : CHTMLToken(eHTMLTag_comment) { /* - * Default constructor + * Copy constructor * * @update gess 3/25/98 * @param @@ -601,47 +601,140 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) { mTypeID=eHTMLTag_comment; } +/* + * This method consumes a comment using the (CORRECT) comment parsing + * algorithm supplied by W3C. + * + * @update gess 01/04/99 + * @param + * @param + * @return + */ +nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { + static nsAutoString gMinus("-"); + nsresult result=NS_OK; + + /********************************************************* + NOTE: This algorithm does a fine job of handling comments + when they're formatted per spec, but if they're not + we don't handle them well. For example, we gack + on the following: + + + *********************************************************/ + + aString=" + aString+=aChar; + result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---' + if(NS_OK==result) { + PRInt32 findpos=-1; + nsAutoString temp(""); + //Read to the first ending sequence '--' + while((kNotFound==findpos) && (NS_OK==result)) { + result=aScanner.ReadUntil(temp,kMinus,PR_TRUE); + findpos=temp.RFind("--"); + } + aString+=temp; + if(NS_OK==result) { + result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---' + if(NS_OK==result) { + temp="->"; + result=aScanner.ReadUntil(aString,temp,PR_FALSE,PR_FALSE); + } + } + } + } // + else break; //go find '>' + } + }//if + else if(kGreaterThan==aChar) { + return result; + } + else break; //go find '>' + }//if + }//while + if(NS_OK==result) { + //if you're here, we're consuming a "short-form" comment + result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE); + } + return result; +} + +/* + * This method consumes a comment using common (actually non-standard) + * algorithm that seems to work against the content on the web. + * + * @update gess 01/04/99 + * @param + * @param + * @return + */ +nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { + static nsAutoString gMinus("-"); + nsresult result=NS_OK; + + /********************************************************* + NOTE: This algorithm does a fine job of handling comments + commonly used, but it doesn't really consume them + per spec (But then, neither does IE or Nav). + *********************************************************/ + + aString=" + aString+=aChar; + nsAutoString temp(""); + PRBool done=PR_FALSE; + PRInt32 findpos=kNotFound; + result=aScanner.ReadWhile(temp,gMinus,PR_TRUE,PR_TRUE); //get all available '---' + while((kNotFound==findpos) && (NS_OK==result)) { + result=aScanner.ReadUntil(temp,kMinus,PR_TRUE); + if(NS_OK==result) { + result=aScanner.ReadWhile(temp,gMinus,PR_TRUE,PR_TRUE); //get all available '---' + } + findpos=temp.RFind("->"); + aString+=temp; + temp=""; + } //while + return result; + } //if + }//if + }//if + }//if + if(NS_OK==result) { + //Read up to the closing '>' + result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE); + } + return result; +} + /* * Consume the identifier portion of the comment. * Note that we've already eaten the " - mTextValue+="-"; - PRInt32 findpos=-1; - while((findpos<3) && (NS_OK==result)) { - result=aScanner.ReadUntil(mTextValue,kMinus,PR_TRUE); - findpos=mTextValue.RFind("--"); - } - if(NS_OK==result) { - result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); //now skip to '>' - } - return result; - } - } - } - } - if(NS_OK==result) { - //if you're here, we're consuming a "short-form" comment - mTextValue+=aChar; - result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); - } + PRBool theStrictForm=PR_FALSE; + nsresult result=(theStrictForm) ? ConsumeStrictComment(aChar,aScanner,mTextValue) : ConsumeComment(aChar,aScanner,mTextValue); return result; } @@ -842,7 +935,7 @@ void CAttributeToken::DebugDumpToken(ostream& out) { mTextValue.ToCString(buffer,sizeof(buffer)-1); out << buffer << ": " << mTypeID << endl; } - + /* * This general purpose method is used when you want to @@ -872,6 +965,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann PRUnichar ch=aString.Last(); if(ch!=aChar) aString+=aChar; + aString.StripChars("\r\n"); return result; } diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index 770eb67ecfd..19ededf38b8 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -141,7 +141,7 @@ CSharedParserObjects gSharedParserObjects; * @param * @return */ -nsParser::nsParser(nsITokenObserver* anObserver) : mCommand("") { +nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput("") { NS_INIT_REFCNT(); mParserFilter = 0; mObserver = 0; @@ -519,7 +519,21 @@ CParserContext* nsParser::PopContext() { * and tokenize input (TRUE), or whether it just caches input to be * parsed later (FALSE). * - * @update vidur 12/11/98 + * @update gess 1/29/99 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ +void nsParser::SetUnusedInput(nsString& aBuffer) { + mUnusedInput=aBuffer; +} + + +/** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 1/29/99 * @param aState determines whether we parse/tokenize or just cache. * @return current state */ @@ -629,32 +643,36 @@ nsresult nsParser::Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEna //NOTE: Make sure that updates to this method don't cause // bug #2361 to break again! - mDTDVerification=aEnableVerify; nsresult result=NS_OK; - CParserContext* pc=0; + if(aSourceBuffer.Length() || mUnusedInput.Length()) { + mDTDVerification=aEnableVerify; + CParserContext* pc=0; - if((!mParserContext) || (mParserContext->mKey!=&aSourceBuffer)) { - //only make a new context if we dont have one, OR if we do, but has a different context key... - pc=new CParserContext(new nsScanner(aSourceBuffer),&aSourceBuffer,0); - if(pc) { - PushContext(*pc); - pc->mStreamListenerState=eOnStart; - pc->mContextType=CParserContext::eCTString; - if(PR_TRUE==anHTMLString) - pc->mSourceType="text/html"; - } - else return NS_ERROR_OUT_OF_MEMORY; - } - else { - pc=mParserContext; + if((!mParserContext) || (mParserContext->mKey!=&aSourceBuffer)) { + //only make a new context if we dont have one, OR if we do, but has a different context key... + pc=new CParserContext(new nsScanner(mUnusedInput),&aSourceBuffer,0); + if(pc) { + PushContext(*pc); + pc->mStreamListenerState=eOnStart; + pc->mContextType=CParserContext::eCTString; + if(PR_TRUE==anHTMLString) + pc->mSourceType="text/html"; + } + else return NS_ERROR_OUT_OF_MEMORY; + } + else { + pc=mParserContext; + pc->mScanner->Append(mUnusedInput); + } pc->mScanner->Append(aSourceBuffer); - } - pc->mMultipart=!aLastCall; - result=ResumeParse(); - if(aLastCall) { - pc=PopContext(); - delete pc; - } + pc->mMultipart=!aLastCall; + result=ResumeParse(); + if(aLastCall) { + pc->mScanner->CopyUnusedData(mUnusedInput); + pc=PopContext(); + delete pc; + }//if + }//if return result; } diff --git a/mozilla/htmlparser/src/nsParser.h b/mozilla/htmlparser/src/nsParser.h index 5bd4188ead3..21fce007d16 100644 --- a/mozilla/htmlparser/src/nsParser.h +++ b/mozilla/htmlparser/src/nsParser.h @@ -177,6 +177,19 @@ friend class CTokenHandler; */ virtual PRBool EnableParser(PRBool aState); + + /** + * This rather arcane method (hack) is used as a signal between the + * DTD and the parser. It allows the DTD to tell the parser that content + * that comes through (parser::parser(string)) but not consumed should + * propagate into the next string based parse call. + * + * @update gess 9/1/98 + * @param aState determines whether we propagate unused string content. + * @return current state + */ + void SetUnusedInput(nsString& aBuffer); + /** * This method gets called (automatically) during incremental parsing * @update gess5/11/98 @@ -304,6 +317,7 @@ protected: nsString mCommand; PRInt32 mStreamStatus; nsITokenObserver* mTokenObserver; + nsString mUnusedInput; }; diff --git a/mozilla/htmlparser/src/nsScanner.cpp b/mozilla/htmlparser/src/nsScanner.cpp index 49f6df5269e..0287ae5faaa 100644 --- a/mozilla/htmlparser/src/nsScanner.cpp +++ b/mozilla/htmlparser/src/nsScanner.cpp @@ -520,6 +520,21 @@ nsString& nsScanner::GetBuffer(void) { return mBuffer; } +/** + * Call this to copy bytes out of the scanner that have not yet been consumed + * by the tokenization process. + * + * @update gess 5/12/98 + * @param aCopyBuffer is where the scanner buffer will be copied to + * @return nada + */ +void nsScanner::CopyUnusedData(nsString& aCopyBuffer) { + PRInt32 theLen=mBuffer.Length(); + if(0Parse(str, PR_TRUE,PR_FALSE,PR_FALSE); + result = mParser->Parse(str, PR_TRUE,PR_FALSE,PR_TRUE); if (NS_OK != result) { return result; } diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index ccfb21c6385..f6bee548bfa 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -696,23 +696,31 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsTagStack& aTagStack) { */ eHTMLTags FindAutoCloseTargetForStartTag(eHTMLTags aCurrentTag,nsTagStack& aTagStack) { int theTopIndex=aTagStack.mCount; - eHTMLTags aPrevTag=aTagStack.mTags[theTopIndex-1]; + eHTMLTags thePrevTag=aTagStack.Last(); if(nsHTMLElement::IsContainer(aCurrentTag)){ - if(aPrevTag==aCurrentTag) { + if(thePrevTag==aCurrentTag) { return (gHTMLElements[aCurrentTag].CanContainSelf()) ? eHTMLTag_unknown: aCurrentTag; } if(nsHTMLElement::IsBlockCloser(aCurrentTag)) { + PRInt32 theRootIndex=kNotFound; CTagList* theRootTags=gHTMLElements[aCurrentTag].GetRootTags(); if(theRootTags) { - PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); + theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); CTagList* theStartTags=gHTMLElements[aCurrentTag].GetAutoCloseStartTags(); PRInt32 thePeerIndex=kNotFound; if(theStartTags){ thePeerIndex=theStartTags->GetBottommostIndexOf(aTagStack,theRootIndex+1); } - else thePeerIndex=GetTopmostIndexOf(aCurrentTag,aTagStack); + else { + //this extra check is need to handle case like this:

+ //the new div can close the P,but doesn't close the top DIV. + thePeerIndex=GetTopmostIndexOf(aCurrentTag,aTagStack); + if(gHTMLElements[aCurrentTag].CanContainSelf()) { + thePeerIndex++; + } + } if(theRootIndex

<-

+ while((theRootIndex<--theTopIndex) && (!gHTMLElements[aTagStack.mTags[theTopIndex]].CanContain(aCurrentTag))) { + } + return aTagStack.mTags[theTopIndex+1]; + //return aTagStack.mTags[theRootIndex+1]; + } } //if - else if(nsHTMLElement::IsInlineElement(aCurrentTag)) { - }//if } //if return eHTMLTag_unknown; } @@ -748,6 +761,24 @@ eHTMLTags FindAutoCloseTargetForStartTag(eHTMLTags aCurrentTag,nsTagStack& aTagS */ PRBool CanBeContained(eHTMLTags aChildTag,nsTagStack& aTagStack) { PRBool result=PR_TRUE; + + CTagList* theRootTags=gHTMLElements[aChildTag].GetRootTags(); + if(theRootTags) { + PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(aTagStack); + PRInt32 theChildIndex=aTagStack.GetTopmostIndexOf(aChildTag); + if(kNotFound==theChildIndex) { + CTagList* theSynTags=gHTMLElements[aChildTag].GetSynonymousTags(); //get the list of tags that THIS tag can close + if(theSynTags) { + theChildIndex=theSynTags->GetTopmostIndexOf(aTagStack); + } + } + if(theRootIndexGetTopmostIndexOf(aTagStack); + } + else { + theChildIndex=aTagStack.GetTopmostIndexOf(aTag); + } + return PRBool(theRootIndexGetTopmostIndexOf(aTagStack); + } + } + return theChildIndex; +} + +/** + * This method is called to determine whether or not an END tag + * can be autoclosed. This means that based on the current + * context, the stack should be closed to the nearest matching + * tag. + * + * @param aTag -- tag enum of child to be tested + * @return PR_TRUE if autoclosure should occur + */ +eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsTagStack& aTagStack) { + int theTopIndex=aTagStack.mCount; + eHTMLTags thePrevTag=aTagStack.Last(); + + if(nsHTMLElement::IsContainer(aCurrentTag)){ + PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aTagStack,aCurrentTag); + + if(kNotFoundContains(theNextTag)) { + if(PR_TRUE==theRootTags->Contains(theNextTag)) { + return eHTMLTag_unknown; //we encountered a tag in root list so fail (because we're gated). + } + //otherwise presume it's something we can simply ignore and continue search... + } + //otherwise its in the close list so skip to next tag... + } + return aCurrentTag; //if you make it here, we're ungated and found a target! + }//if + else if(theRootTags) { + //since we didn't find any close tags, see if there is an instance of aCurrentTag + //above the stack from the roottag. + if(HasCloseablePeerAboveRoot(*theRootTags,aTagStack,aCurrentTag)) + return aCurrentTag; + else return eHTMLTag_unknown; + } + } //if + }//if + } //if + return eHTMLTag_unknown; +} /** * This method gets called when an end token has been @@ -995,23 +1134,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { NS_PRECONDITION(0!=aToken,kNullToken); nsresult result=NS_OK; - CEndToken* et = (CEndToken*)(aToken); - eHTMLTags theChildTag=(eHTMLTags)et->GetTypeID(); - - // Here's the hacky part: - // Because we're trying to be backward compatible with Nav4/5, - // we have to handle explicit styles the way it does. That means - // that we keep an internal style stack.When an EndToken occurs, - // we should see if it is an explicit style tag. If so, we can - // close the explicit style tag (goofy, huh?) - - - //now check to see if this token should be omitted, or - //if it's gated from closing by the presence of another tag. - if(PR_TRUE==CanOmitEndTag(mBodyContext->Last(),theChildTag)) { - UpdateStyleStackForCloseTag(theChildTag,theChildTag); - return result; - } + eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); nsCParserNode theNode((CHTMLToken*)aToken,mLineNumber); switch(theChildTag) { @@ -1029,26 +1152,20 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { result=CloseContainer(theNode,theChildTag,PR_FALSE); break; - case eHTMLTag_td: - case eHTMLTag_th: - //result=CloseContainersTo(theChildTag,PR_TRUE); - // Empty the transient style stack (we just closed any extra - // ones off so it's safe to do it now) because they don't carry - // forward across table cell boundaries. - //mBodyContext->mStyles->mCount=0; - //break; - default: - if(IsContainer(theChildTag)){ - CTagList* theCloseTags=gHTMLElements[theChildTag].GetAutoCloseEndTags(); - - if(theCloseTags){ - PRInt32 thePeerIndex=theCloseTags->GetTopmostIndexOf(mBodyContext->mTags); - theChildTag=(kNotFoundmTags[thePeerIndex] : theChildTag; + { + //now check to see if this token should be omitted, or + //if it's gated from closing by the presence of another tag. + if(PR_TRUE==CanOmitEndTag(mBodyContext->Last(),theChildTag)) { + UpdateStyleStackForCloseTag(theChildTag,theChildTag); + } + else { + eHTMLTags theTarget=FindAutoCloseTargetForEndTag(theChildTag,mBodyContext->mTags); + if(eHTMLTag_unknown!=theTarget) { + result=CloseContainersTo(theTarget,PR_TRUE); + } } - result=CloseContainersTo(theChildTag,PR_TRUE); } - // break; } return result; @@ -1145,11 +1262,6 @@ nsresult CNavDTD::HandleScriptToken(nsCParserNode& aNode) { PRInt32 attrCount=aNode.GetAttributeCount(PR_TRUE); nsresult result=AddLeaf(aNode); - CParserContext* theContext=mParser->PeekContext(); - if(theContext && theContext->mPrevContext && (CParserContext::eCTString==theContext->mContextType)) { - mParser->PopContext(); - delete theContext; - } return result; } @@ -1337,28 +1449,6 @@ PRBool CNavDTD::CanPropagate(eHTMLTags aParentTag,eHTMLTags aChildTag) const { return result; } -/** - * Call this to see if you have a closeable peer on the stack that - * is ABOVE one of its root tags. - * - * @update gess 3/25/98 - * @param aRootTagList -- list of root tags for aTag - * @param aTag -- tag to test for containership - * @return PR_TRUE if given tag can contain other tags - */ -PRBool HasCloseablePeerAboveRoot(CTagList& aRootTagList,nsTagStack& aTagStack,eHTMLTags aTag) { - PRInt32 theRootIndex=aRootTagList.GetTopmostIndexOf(aTagStack); - CTagList* theCloseTags=gHTMLElements[aTag].GetAutoCloseStartTags(); - PRInt32 theChildIndex=-1; - PRBool result=PR_FALSE; - if(theCloseTags) { - theChildIndex=theCloseTags->GetTopmostIndexOf(aTagStack); - } - else { - theChildIndex=aTagStack.GetTopmostIndexOf(aTag); - } - return PRBool(theRootIndexContains(theNextTag)) { - if(PR_TRUE==theRootTags->Contains(theNextTag)) { - return eHTMLTag_unknown; //we encountered a tag in root list so fail (because we're gated). - } - //otherwise presume it's something we can simply ignore and continue search... - } - //otherwise its in the close list so skip to next tag... - } - return aCurrentTag; //if you make it here, we're ungated and found a target! - }//if - else if(theRootTags) { - //since we didn't find any close tags, see if there is an instance of aCurrentTag - //above the stack from the roottag. - if(HasCloseablePeerAboveRoot(*theRootTags,aTagStack,aCurrentTag)) - return aCurrentTag; - else return eHTMLTag_unknown; - } - } //if - } //if - return eHTMLTag_unknown; -} /** * This method gets called to determine whether a given @@ -1613,62 +1649,34 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsTagStack& aTagSta PRBool CNavDTD::CanOmitEndTag(eHTMLTags aParent,eHTMLTags aChild) const { PRBool result=PR_FALSE; - //begin with some simple (and obvious) cases... - switch((eHTMLTags)aChild) { + if(gHTMLElements[aChild].CanOmitEndTag(aParent)) { + return PR_TRUE; + } - case eHTMLTag_userdefined: - case eHTMLTag_comment: - result=PR_TRUE; - break; - - case eHTMLTag_a: - result=!HasOpenContainer(aChild); - break; - - case eHTMLTag_html: - case eHTMLTag_body: - result=PR_TRUE; - break; - - case eHTMLTag_newline: - case eHTMLTag_whitespace: - - switch(aParent) { - case eHTMLTag_html: case eHTMLTag_head: - case eHTMLTag_title: case eHTMLTag_map: - case eHTMLTag_tr: case eHTMLTag_table: - case eHTMLTag_thead: case eHTMLTag_tfoot: - case eHTMLTag_tbody: case eHTMLTag_col: - case eHTMLTag_colgroup: case eHTMLTag_unknown: - result=PR_TRUE; - default: - break; - } //switch - break; - - //It turns out that a can be closed by any other - //This code makes them all seem compatible. - case eHTMLTag_h1: case eHTMLTag_h2: - case eHTMLTag_h3: case eHTMLTag_h4: - case eHTMLTag_h5: case eHTMLTag_h6: - if(FindTagInSet(aParent,gHeadingTags,sizeof(gHeadingTags)/sizeof(eHTMLTag_unknown))) { - result=PR_FALSE; - break; +/* + CTagList* theRootTags=gHTMLElements[aChild].GetRootTags(); + if(theRootTags) { + PRInt32 theRootIndex=theRootTags->GetTopmostIndexOf(mBodyContext->mTags); + PRInt32 theChildIndex=GetTopmostIndexOf(aChild); + if(kNotFound==theChildIndex) { + CTagList* theSynTags=gHTMLElements[aChild].GetSynonymousTags(); //get the list of tags that THIS tag can close + if(theSynTags) { + theChildIndex=theSynTags->GetTopmostIndexOf(mBodyContext->mTags); } - //Otherwise, IT's OK TO FALL THROUGH HERE... + } + result=!PRBool(theRootIndexGetTopmostIndexOf(mBodyContext->mTags); + } + } + result=PRBool(kNotFound==theChildIndex); - default: - { - PRInt32 theTagPos=GetTopmostIndexOf(aChild); - if(kNotFound!=theTagPos) { - eHTMLTags theTarget=FindAutoCloseTargetForEndTag(aChild,mBodyContext->mTags,theTagPos); - result=PRBool(eHTMLTag_unknown==theTarget); - } - else result=PR_TRUE; - } - break; - } //switch return result; } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 01e5fafcbca..e3a7f36258e 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -32,7 +32,7 @@ * @param * @return */ -PRBool CTagList::Contains(eHTMLTags aTag){ +inline PRBool CTagList::Contains(eHTMLTags aTag){ PRBool result=PR_FALSE; if(mTagList) { result=FindTagInSet(aTag,mTagList,mCount); @@ -51,7 +51,7 @@ PRInt32 CTagList::GetTopmostIndexOf(nsTagStack& aTagStack){ int max=aTagStack.mCount; int index; for(index=max-1;index>0;index--){ - if(FindTagInSet(aTagStack.mTags[index],mTags,mCount)) { + if(Contains(aTagStack.mTags[index])) { return index; } } @@ -68,7 +68,7 @@ PRInt32 CTagList::GetBottommostIndexOf(nsTagStack& aTagStack,PRInt32 aStartOffse int max=aTagStack.mCount; int index; for(index=aStartOffset;index*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_area, - /*rootnodes*/ &gAreaParent, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gAreaParent,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gAreaParent,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_b, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_base, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_basefont, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ (kSpecial|kPreExclusion), kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_bdo, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_bgsound, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_big, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kFontStyle|kPreformatted), (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_blink, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kFontStyle|kPreformatted), (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_blockquote, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_body, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ &gBodyAutoClose,0, + /*rootnodes,endrootnodes*/ &gInHTML, &gInHTML, + /*autoclose starttags and endtags*/ &gBodyAutoClose,0,0, /*parent,incl,exclgroups*/ kHTMLContent, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_br, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_button, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kFlow, kFormControl, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gButtonKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_caption, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gCaptionAutoClose,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gCaptionAutoClose,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_center, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, (kInline|kSelf|kFlow), kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_cite, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kInline|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_code, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_col, - /*rootnodes*/ &gColParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gColParents,&gColParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gColParents,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_colgroup, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gColgroupKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dd, - /*rootnodes*/ &gInDL, - /*autoclose starttags and endtags*/ &gDTCloseTags,0, + /*rootnodes,endrootnodes*/ &gInDL, &gInDL, + /*autoclose starttags and endtags*/ &gDTCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInDL,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_del, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dfn, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dir, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_div, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dl, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kBlock, kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, kSpecial, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_dt, - /*rootnodes*/ &gInDL, - /*autoclose starttags and endtags*/ &gDTCloseTags,0, + /*rootnodes,endrootnodes*/ &gInDL,&gInDL, + /*autoclose starttags and endtags*/ &gDTCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents, kids
*/ &gInDL,&gDTKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_em, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_embed, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_fieldset, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFieldsetKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_font, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFontKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_form, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gFormKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_frame, - /*rootnodes*/ &gInFrameset, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInFrameset,&gInFrameset, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInFrameset,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_frameset, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHTML,&gInHTML, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kSelf, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHTML,&gFramesetKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h1, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h2, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h3, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h4, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h5, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_h6, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, - /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ &gHxAutoClose, &gHxAutoClose, &gHxAutoClose, + /*parent,incl,exclgroups*/ kBlock, kBlock, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_head, - /*rootnodes*/ &gInHTML, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHTML, &gInHTML, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kHeadContent|kHeadMisc), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHTML,&gHeadKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_hr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_html, - /*rootnodes*/ &gHTMLRootTags, - /*autoclose starttags and endtags*/ &gAutoClose,0, + /*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags, + /*autoclose starttags and endtags*/ &gAutoClose,0,0, /*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_i, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_iframe, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ilayer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, - /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, + /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_img, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_input, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ins, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kSelf|kNone), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_isindex, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kBlock|kHeadContent), kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_kbd, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_keygen, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_label, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kInline, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_layer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_legend, - /*rootnodes*/ &gInFieldset, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInFieldset,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_li, - /*rootnodes*/ &gLIRootTags, - /*autoclose starttags and endtags*/ &gLIAutoClose,0, + /*rootnodes,endrootnodes*/ &gLIRootTags,&gLIRootTags, + /*autoclose starttags and endtags*/ &gLIAutoClose,0,0, /*parent,incl,exclgroups*/ kList, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gLIKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_link, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead,&gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_listing, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_map, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, kBlock, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gMapKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_menu, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kList, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_meta, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_multicol, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_nobr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_noembed, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_noembed}, { /*tag*/ eHTMLTag_noframes, - /*rootnodes*/ &gNoframeRoot, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gNoframeRoot,&gNoframeRoot, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ &gNoframeRoot,&gNoframesKids,eHTMLTag_noframes}, { /*tag*/ eHTMLTag_nolayer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_nolayer}, { /*tag*/ eHTMLTag_noscript, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kFlow, kNone, - /*control bits*/ kDiscardTag, + /*special properties*/ kDiscardTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_noscript}, { /*tag*/ eHTMLTag_object, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ol, - /*rootnodes*/ &gOLRootTags, - /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags, + /*rootnodes,endrootnodes*/ &gOLRootTags,&gOLRootTags, + /*autoclose starttags and endtags*/ &gOLAutoClose, &gULCloseTags, 0, /*parent,incl,exclgroups*/ kBlock, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_optgroup, - /*rootnodes*/ &gOptgroupParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_option, - /*rootnodes*/ &gOptgroupParents, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gOptgroupParents,&gContainsText,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_p, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kInline, kNone, - /*control bits*/ 0, - /*special parents,kids,skip*/ 0,&gInAddress,eHTMLTag_unknown}, + /*special properties*/ 0, + /*special parents,kids,skip*/ 0,&gInP,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_param, - /*rootnodes*/ &gParamParents, - /*autoclose starttags and endtags*/ &gPAutoClose,0, + /*rootnodes,endrootnodes*/ &gParamParents, &gParamParents, + /*autoclose starttags and endtags*/ &gPAutoClose,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gParamParents,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_plaintext, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kFlow, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_html}, { /*tag*/ eHTMLTag_pre, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPreformatted, kInline, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gPreKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_q, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_s, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_samp, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_script, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kSpecial|kHeadMisc), kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsText,eHTMLTag_script}, { /*tag*/ eHTMLTag_select, - /*rootnodes*/ &gInForm, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInForm,&gInForm, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInForm,&gContainsOpts,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_server, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_small, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_sound, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_spacer, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_span, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_strike, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_strong, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ (kPhrase|kFontStyle), (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gContainsText,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_style, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead, &gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kHeadMisc, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_style}, { /*tag*/ eHTMLTag_sub, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_sup, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_table, - /*rootnodes*/ &gInBody, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gInBody, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kBlock, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gTableKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_tbody, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable, &gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTBodyKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_td, - /*rootnodes*/ &gTDRootTags, - /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags, + /*rootnodes,endrootnodes*/ &gTDRootTags,&gTDRootTags, + /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0, /*parent,incl,exclgroups*/ kNone, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTDRootTags,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_textarea, - /*rootnodes*/ &gInForm, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInForm, &gInForm, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFormControl, kPCDATA, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInForm,&gContainsText,eHTMLTag_textarea}, { /*tag*/ eHTMLTag_tfoot, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable, &gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_th, - /*rootnodes*/ &gTDRootTags, - /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags, + /*rootnodes,endrootnodes*/ &gTDRootTags,&gTDRootTags, + /*autoclose starttags and endtags*/ &gTDCloseTags,&gTDCloseTags,0, /*parent,incl,exclgroups*/ kNone, kFlow, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTDRootTags,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_thead, - /*rootnodes*/ &gInTable, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInTable,&gInTable, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kSelf, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInTable,&gTableElemKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_title, - /*rootnodes*/ &gInHead, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gInHead,&gInHead, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, (kHeadMisc|kPCDATA), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gInHead,&gContainsText,eHTMLTag_title}, { /*tag*/ eHTMLTag_tr, - /*rootnodes*/ &gTRParents, - /*autoclose starttags and endtags*/ &gTRCloseTags,0, + /*rootnodes,endrootnodes*/ &gTRParents,&gTRParents, + /*autoclose starttags and endtags*/ &gTRCloseTags,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ &gTRParents,&gTRKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_tt, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_u, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kFlow), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_ul, - /*rootnodes*/ &gOLRootTags, - /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags, + /*rootnodes,endrootnodes*/ &gOLRootTags,&gOLRootTags, + /*autoclose starttags and endtags*/ &gOLAutoClose,&gULCloseTags,0, /*parent,incl,exclgroups*/ kBlock, (kFlow|kSelf), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,&gULKids,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_var, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kPhrase, (kSelf|kInline), kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_wbr, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_xmp, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_xmp}, { /*tag*/ eHTMLTag_text, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_whitespace, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_newline, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_comment, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_entity, - /*rootnodes*/ &gTextRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gTextRootTags,&gTextRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kFlow, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ 0, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, { /*tag*/ eHTMLTag_userdefined, - /*rootnodes*/ &gRootTags, - /*autoclose starttags and endtags*/ 0,0, + /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, + /*autoclose starttags and endtags*/ 0,0,0, /*parent,incl,exclgroups*/ kNone, kNone, kNone, - /*control bits*/ 0, + /*special properties*/ kOmitEndTag, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown}, }; @@ -1098,7 +1099,8 @@ PRBool nsHTMLElement::IsContainer(eHTMLTags aChild) { * @return */ inline PRBool TestBits(int aBitset,int aTest) { - return PRBool(aBitset & aTest); + PRInt32 result=aBitset & aTest; + return PRBool(result==aTest); } /** @@ -1116,6 +1118,7 @@ PRBool nsHTMLElement::IsContainerType(eHTMLTags aTag,int aType) { return result; } + /** * * @update gess 01/04/99 @@ -1142,7 +1145,8 @@ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ - result=IsFlowElement(aTag); +// result=IsFlowElement(aTag); + result=gHTMLElements[aTag].IsMemberOf(kFlow); if(!result) { static eHTMLTags gClosers[]={ eHTMLTag_table,eHTMLTag_caption,eHTMLTag_dd,eHTMLTag_dt, @@ -1247,8 +1251,8 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aParent,eHTMLTags aChild){ * @param * @return */ -PRBool nsHTMLElement::CanOmitEndTag(eHTMLTags aChild) const{ - PRBool result=PR_FALSE; +PRBool nsHTMLElement::CanOmitEndTag(eHTMLTags aParent) const{ + PRBool result=TestBits(mSpecialProperties,kOmitEndTag); return result; } @@ -1285,6 +1289,29 @@ PRBool nsHTMLElement::IsStyleTag(eHTMLTags aChild) { return result; } + +/** + * + * @update gess12/13/98 + * @param + * @return + */ +PRBool nsHTMLElement::CanContainType(PRInt32 aType) const{ + PRBool result=(aType && TestBits(mInclusionBits,aType)); + return result; +} + +/** + * + * @update gess12/13/98 + * @param + * @return + */ +PRBool nsHTMLElement::IsMemberOf(PRInt32 aSet) const{ + PRBool result=(aSet && TestBits(aSet,mParentBits)); + return result; +} + /** * * @update gess12/13/98 @@ -1322,6 +1349,7 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{ return PR_FALSE; } + if(nsHTMLElement::IsInlineElement(aChild)){ if(nsHTMLElement::IsInlineParent(mTagID)){ return PR_TRUE; @@ -1346,6 +1374,10 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{ } } + if(CanContainType(gHTMLElements[aChild].mParentBits)) { + return PR_TRUE; + } + if(mSpecialKids) { if(mSpecialKids->Contains(aChild)) { return PR_TRUE; diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h index 6948c6f7354..ac92ffedf92 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.h +++ b/mozilla/parser/htmlparser/src/nsElementTable.h @@ -48,7 +48,7 @@ public: PRInt32 GetTopmostIndexOf(nsTagStack& aTagStack); PRInt32 GetBottommostIndexOf(nsTagStack& aTagStack,PRInt32 aStartOffset); - PRBool Contains(eHTMLTags aTag); + inline PRBool Contains(eHTMLTags aTag); eHTMLTags mTags[5]; eHTMLTags* mTagList; @@ -76,8 +76,10 @@ struct nsHTMLElement { static PRBool IsBlockCloser(eHTMLTags aTag); CTagList* GetRootTags(void) const {return mRootNodes;} + CTagList* GetEndRootTags(void) const {return mEndRootNodes;} CTagList* GetAutoCloseStartTags(void) const {return mAutocloseStart;} CTagList* GetAutoCloseEndTags(void) const {return mAutocloseEnd;} + CTagList* GetSynonymousTags(void) const {return mSynonymousTags;} static PRBool IsBlockParent(eHTMLTags aTag); static PRBool IsInlineParent(eHTMLTags aTag); @@ -85,11 +87,14 @@ struct nsHTMLElement { CTagList* GetSpecialChildren(void) const {return mSpecialKids;} CTagList* GetSpecialParents(void) const {return mSpecialParents;} - + + PRBool IsMemberOf(PRInt32 aType) const; + PRBool CanContainType(PRInt32 aType) const; + eHTMLTags GetTag(void) const {return mTagID;} PRBool CanContain(eHTMLTags aChild) const; PRBool CanOmitStartTag(eHTMLTags aChild) const; - PRBool CanOmitEndTag(eHTMLTags aChild) const; + PRBool CanOmitEndTag(eHTMLTags aParent) const; PRBool CanContainSelf() const; PRBool HasSpecialProperty(PRInt32 aProperty) const; @@ -101,9 +106,11 @@ struct nsHTMLElement { static PRBool IsTextTag(eHTMLTags aTag); eHTMLTags mTagID; - CTagList* mRootNodes; //These are the tags above which you many not autoclose + CTagList* mRootNodes; //These are the tags above which you many not autoclose a START tag + CTagList* mEndRootNodes; //These are the tags above which you many not autoclose an END tag CTagList* mAutocloseStart; //these are the start tags that you can automatically close with this START tag CTagList* mAutocloseEnd; //these are the start tags that you can automatically close with this END tag + CTagList* mSynonymousTags; //These are morally equivalent; an end tag for one can close a start tag for another (like ) int mParentBits; //defines groups that can contain this element int mInclusionBits; //defines parental and containment rules int mExclusionBits; //defines things you CANNOT contain @@ -118,6 +125,7 @@ extern nsHTMLElement gHTMLElements[]; //special property bits... static const int kDiscardTag = 0x0001; //tells us to toss this tag +static const int kOmitEndTag = 0x0002; //safely ignore end tag #endif \ No newline at end of file diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp index 615eb7318c3..9f4cb3563ef 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp @@ -580,7 +580,7 @@ nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) { /* - * default constructor + * Default constructor * * @update gess 3/25/98 * @param aName -- string to init token name with @@ -591,7 +591,7 @@ CCommentToken::CCommentToken() : CHTMLToken(eHTMLTag_comment) { /* - * Default constructor + * Copy constructor * * @update gess 3/25/98 * @param @@ -601,47 +601,140 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) { mTypeID=eHTMLTag_comment; } +/* + * This method consumes a comment using the (CORRECT) comment parsing + * algorithm supplied by W3C. + * + * @update gess 01/04/99 + * @param + * @param + * @return + */ +nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { + static nsAutoString gMinus("-"); + nsresult result=NS_OK; + + /********************************************************* + NOTE: This algorithm does a fine job of handling comments + when they're formatted per spec, but if they're not + we don't handle them well. For example, we gack + on the following: + + + *********************************************************/ + + aString=" + aString+=aChar; + result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---' + if(NS_OK==result) { + PRInt32 findpos=-1; + nsAutoString temp(""); + //Read to the first ending sequence '--' + while((kNotFound==findpos) && (NS_OK==result)) { + result=aScanner.ReadUntil(temp,kMinus,PR_TRUE); + findpos=temp.RFind("--"); + } + aString+=temp; + if(NS_OK==result) { + result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---' + if(NS_OK==result) { + temp="->"; + result=aScanner.ReadUntil(aString,temp,PR_FALSE,PR_FALSE); + } + } + } + } // + else break; //go find '>' + } + }//if + else if(kGreaterThan==aChar) { + return result; + } + else break; //go find '>' + }//if + }//while + if(NS_OK==result) { + //if you're here, we're consuming a "short-form" comment + result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE); + } + return result; +} + +/* + * This method consumes a comment using common (actually non-standard) + * algorithm that seems to work against the content on the web. + * + * @update gess 01/04/99 + * @param + * @param + * @return + */ +nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { + static nsAutoString gMinus("-"); + nsresult result=NS_OK; + + /********************************************************* + NOTE: This algorithm does a fine job of handling comments + commonly used, but it doesn't really consume them + per spec (But then, neither does IE or Nav). + *********************************************************/ + + aString=" + aString+=aChar; + nsAutoString temp(""); + PRBool done=PR_FALSE; + PRInt32 findpos=kNotFound; + result=aScanner.ReadWhile(temp,gMinus,PR_TRUE,PR_TRUE); //get all available '---' + while((kNotFound==findpos) && (NS_OK==result)) { + result=aScanner.ReadUntil(temp,kMinus,PR_TRUE); + if(NS_OK==result) { + result=aScanner.ReadWhile(temp,gMinus,PR_TRUE,PR_TRUE); //get all available '---' + } + findpos=temp.RFind("->"); + aString+=temp; + temp=""; + } //while + return result; + } //if + }//if + }//if + }//if + if(NS_OK==result) { + //Read up to the closing '>' + result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE); + } + return result; +} + /* * Consume the identifier portion of the comment. * Note that we've already eaten the " - mTextValue+="-"; - PRInt32 findpos=-1; - while((findpos<3) && (NS_OK==result)) { - result=aScanner.ReadUntil(mTextValue,kMinus,PR_TRUE); - findpos=mTextValue.RFind("--"); - } - if(NS_OK==result) { - result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); //now skip to '>' - } - return result; - } - } - } - } - if(NS_OK==result) { - //if you're here, we're consuming a "short-form" comment - mTextValue+=aChar; - result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); - } + PRBool theStrictForm=PR_FALSE; + nsresult result=(theStrictForm) ? ConsumeStrictComment(aChar,aScanner,mTextValue) : ConsumeComment(aChar,aScanner,mTextValue); return result; } @@ -842,7 +935,7 @@ void CAttributeToken::DebugDumpToken(ostream& out) { mTextValue.ToCString(buffer,sizeof(buffer)-1); out << buffer << ": " << mTypeID << endl; } - + /* * This general purpose method is used when you want to @@ -872,6 +965,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann PRUnichar ch=aString.Last(); if(ch!=aChar) aString+=aChar; + aString.StripChars("\r\n"); return result; } diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index 770eb67ecfd..19ededf38b8 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -141,7 +141,7 @@ CSharedParserObjects gSharedParserObjects; * @param * @return */ -nsParser::nsParser(nsITokenObserver* anObserver) : mCommand("") { +nsParser::nsParser(nsITokenObserver* anObserver) : mCommand(""), mUnusedInput("") { NS_INIT_REFCNT(); mParserFilter = 0; mObserver = 0; @@ -519,7 +519,21 @@ CParserContext* nsParser::PopContext() { * and tokenize input (TRUE), or whether it just caches input to be * parsed later (FALSE). * - * @update vidur 12/11/98 + * @update gess 1/29/99 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ +void nsParser::SetUnusedInput(nsString& aBuffer) { + mUnusedInput=aBuffer; +} + + +/** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 1/29/99 * @param aState determines whether we parse/tokenize or just cache. * @return current state */ @@ -629,32 +643,36 @@ nsresult nsParser::Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEna //NOTE: Make sure that updates to this method don't cause // bug #2361 to break again! - mDTDVerification=aEnableVerify; nsresult result=NS_OK; - CParserContext* pc=0; + if(aSourceBuffer.Length() || mUnusedInput.Length()) { + mDTDVerification=aEnableVerify; + CParserContext* pc=0; - if((!mParserContext) || (mParserContext->mKey!=&aSourceBuffer)) { - //only make a new context if we dont have one, OR if we do, but has a different context key... - pc=new CParserContext(new nsScanner(aSourceBuffer),&aSourceBuffer,0); - if(pc) { - PushContext(*pc); - pc->mStreamListenerState=eOnStart; - pc->mContextType=CParserContext::eCTString; - if(PR_TRUE==anHTMLString) - pc->mSourceType="text/html"; - } - else return NS_ERROR_OUT_OF_MEMORY; - } - else { - pc=mParserContext; + if((!mParserContext) || (mParserContext->mKey!=&aSourceBuffer)) { + //only make a new context if we dont have one, OR if we do, but has a different context key... + pc=new CParserContext(new nsScanner(mUnusedInput),&aSourceBuffer,0); + if(pc) { + PushContext(*pc); + pc->mStreamListenerState=eOnStart; + pc->mContextType=CParserContext::eCTString; + if(PR_TRUE==anHTMLString) + pc->mSourceType="text/html"; + } + else return NS_ERROR_OUT_OF_MEMORY; + } + else { + pc=mParserContext; + pc->mScanner->Append(mUnusedInput); + } pc->mScanner->Append(aSourceBuffer); - } - pc->mMultipart=!aLastCall; - result=ResumeParse(); - if(aLastCall) { - pc=PopContext(); - delete pc; - } + pc->mMultipart=!aLastCall; + result=ResumeParse(); + if(aLastCall) { + pc->mScanner->CopyUnusedData(mUnusedInput); + pc=PopContext(); + delete pc; + }//if + }//if return result; } diff --git a/mozilla/parser/htmlparser/src/nsParser.h b/mozilla/parser/htmlparser/src/nsParser.h index 5bd4188ead3..21fce007d16 100644 --- a/mozilla/parser/htmlparser/src/nsParser.h +++ b/mozilla/parser/htmlparser/src/nsParser.h @@ -177,6 +177,19 @@ friend class CTokenHandler; */ virtual PRBool EnableParser(PRBool aState); + + /** + * This rather arcane method (hack) is used as a signal between the + * DTD and the parser. It allows the DTD to tell the parser that content + * that comes through (parser::parser(string)) but not consumed should + * propagate into the next string based parse call. + * + * @update gess 9/1/98 + * @param aState determines whether we propagate unused string content. + * @return current state + */ + void SetUnusedInput(nsString& aBuffer); + /** * This method gets called (automatically) during incremental parsing * @update gess5/11/98 @@ -304,6 +317,7 @@ protected: nsString mCommand; PRInt32 mStreamStatus; nsITokenObserver* mTokenObserver; + nsString mUnusedInput; }; diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp index 49f6df5269e..0287ae5faaa 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.cpp +++ b/mozilla/parser/htmlparser/src/nsScanner.cpp @@ -520,6 +520,21 @@ nsString& nsScanner::GetBuffer(void) { return mBuffer; } +/** + * Call this to copy bytes out of the scanner that have not yet been consumed + * by the tokenization process. + * + * @update gess 5/12/98 + * @param aCopyBuffer is where the scanner buffer will be copied to + * @return nada + */ +void nsScanner::CopyUnusedData(nsString& aCopyBuffer) { + PRInt32 theLen=mBuffer.Length(); + if(0