bug 8354 and fix for th nesting error

git-svn-id: svn://10.0.0.236/trunk@36159 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
1999-06-21 23:46:02 +00:00
parent 70c7469102
commit f10f30929b
4 changed files with 38 additions and 34 deletions

View File

@@ -488,6 +488,9 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
#endif
result = mSink->WillBuildModel();
CStartToken theToken(eHTMLTag_html);
HandleStartToken(&theToken);
mSkipTarget=eHTMLTag_unknown;
mComputedCRC32=0;
mExpectedCRC32=0;
@@ -542,6 +545,8 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
CStartToken theToken(eHTMLTag_body); //open the body container...
result=HandleStartToken(&theToken);
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
result=BuildModel(aParser,mTokenizer,0,aSink);
}
if(aParser){
@@ -2081,24 +2086,21 @@ PRBool CNavDTD::ForwardPropagate(nsEntryStack& aStack,eHTMLTags aParentTag,eHTML
*/
PRBool CNavDTD::BackwardPropagate(nsEntryStack& aStack,eHTMLTags aParentTag,eHTMLTags aChildTag) const {
eHTMLTags theParentTag=aChildTag;
eHTMLTags theParentTag=aParentTag; //just init to get past first condition...
do {
CTagList* theRootTags=gHTMLElements[theParentTag].GetRootTags();
theParentTag=theRootTags->GetTagAt(0);
if(theParentTag!=eHTMLTag_unknown) {
aStack.Push(theParentTag);
CTagList* theRootTags=gHTMLElements[aChildTag].GetRootTags();
if(theRootTags) {
theParentTag=theRootTags->GetTagAt(0);
if(CanContain(theParentTag,aChildTag)) {
//we've found a complete sequence, so push the parent...
aChildTag=theParentTag;
aStack.Push(theParentTag);
}
}
else break;
}
while((theParentTag!=eHTMLTag_unknown) && (theParentTag!=aParentTag));
PRBool theCanContainResult=CanContain(aParentTag,theParentTag);
if(theCanContainResult) {
//we've found a complete sequence, so push the parent...
theParentTag=aParentTag;
aStack.Push(theParentTag);
}
} while((theParentTag!=eHTMLTag_unknown) && (theParentTag!=aParentTag));
return PRBool(aParentTag==theParentTag);
}

View File

@@ -707,7 +707,7 @@ nsHTMLElement gHTMLElements[] = {
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown},
{ /*tag*/ eHTMLTag_label,
/*req-parent excl-parent*/ eHTMLTag_form,eHTMLTag_unknown,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kFormControl, kInlineEntity, kSelf,
@@ -1147,7 +1147,7 @@ nsHTMLElement gHTMLElements[] = {
/*special parents,kids,skip*/ 0,0,eHTMLTag_xmp},
{ /*tag*/ eHTMLTag_text,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*req-parent excl-parent*/ eHTMLTag_body,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,

View File

@@ -488,6 +488,9 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
#endif
result = mSink->WillBuildModel();
CStartToken theToken(eHTMLTag_html);
HandleStartToken(&theToken);
mSkipTarget=eHTMLTag_unknown;
mComputedCRC32=0;
mExpectedCRC32=0;
@@ -542,6 +545,8 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
CStartToken theToken(eHTMLTag_body); //open the body container...
result=HandleStartToken(&theToken);
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
result=BuildModel(aParser,mTokenizer,0,aSink);
}
if(aParser){
@@ -2081,24 +2086,21 @@ PRBool CNavDTD::ForwardPropagate(nsEntryStack& aStack,eHTMLTags aParentTag,eHTML
*/
PRBool CNavDTD::BackwardPropagate(nsEntryStack& aStack,eHTMLTags aParentTag,eHTMLTags aChildTag) const {
eHTMLTags theParentTag=aChildTag;
eHTMLTags theParentTag=aParentTag; //just init to get past first condition...
do {
CTagList* theRootTags=gHTMLElements[theParentTag].GetRootTags();
theParentTag=theRootTags->GetTagAt(0);
if(theParentTag!=eHTMLTag_unknown) {
aStack.Push(theParentTag);
CTagList* theRootTags=gHTMLElements[aChildTag].GetRootTags();
if(theRootTags) {
theParentTag=theRootTags->GetTagAt(0);
if(CanContain(theParentTag,aChildTag)) {
//we've found a complete sequence, so push the parent...
aChildTag=theParentTag;
aStack.Push(theParentTag);
}
}
else break;
}
while((theParentTag!=eHTMLTag_unknown) && (theParentTag!=aParentTag));
PRBool theCanContainResult=CanContain(aParentTag,theParentTag);
if(theCanContainResult) {
//we've found a complete sequence, so push the parent...
theParentTag=aParentTag;
aStack.Push(theParentTag);
}
} while((theParentTag!=eHTMLTag_unknown) && (theParentTag!=aParentTag));
return PRBool(aParentTag==theParentTag);
}

View File

@@ -707,7 +707,7 @@ nsHTMLElement gHTMLElements[] = {
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown},
{ /*tag*/ eHTMLTag_label,
/*req-parent excl-parent*/ eHTMLTag_form,eHTMLTag_unknown,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kFormControl, kInlineEntity, kSelf,
@@ -1147,7 +1147,7 @@ nsHTMLElement gHTMLElements[] = {
/*special parents,kids,skip*/ 0,0,eHTMLTag_xmp},
{ /*tag*/ eHTMLTag_text,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*req-parent excl-parent*/ eHTMLTag_body,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,