Fix for bugs 13113, and 12631.

git-svn-id: svn://10.0.0.236/trunk@48754 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
harishd%netscape.com
1999-09-22 03:05:25 +00:00
parent 10772ca855
commit 3304eaed01
6 changed files with 316 additions and 246 deletions

View File

@@ -1032,7 +1032,9 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
// compatible we should not attempt to close the tags above it, for
// the contents inside the table might get thrown out of the table.
// The safest thing to do is to discard this tag.
return result;
if(!gHTMLElements[aChildTag].CanAutoCloseTag(theParentTag,eToken_start)) {
return result;
}
}
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
}//if
@@ -1478,14 +1480,15 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
UpdateStyleStackForCloseTag(theChildTag,theChildTag);
}
else {
if(kNotFound==GetIndexOfChildOrSynonym(mBodyContext->mStack,theChildTag)) {
if((kNotFound==GetIndexOfChildOrSynonym(mBodyContext->mStack,theChildTag)) ||
(!gHTMLElements[theChildTag].CanAutoCloseTag(mBodyContext->Last(),eToken_end))) {
UpdateStyleStackForCloseTag(theChildTag,theChildTag);
if(gHTMLElements[theChildTag].IsMemberOf(kBlockEntity)) {
// Oh boy!! we found a "stray" block entity. Nav4.x and IE introduce line break in
// such cases. So, let's simulate that effect for compatibility.
// Ex. <html><body>Hello</P>There</body></html>
CHTMLToken* theToken = (CHTMLToken*)gRecycler->CreateTokenOfType(eToken_start,theChildTag);
result=HandleStartToken(theToken);
result=HandleToken(theToken,mParser);
}
else return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,7 @@ struct nsHTMLElement {
CTagList* GetEndRootTags(void) const {return mEndRootNodes;}
CTagList* GetAutoCloseStartTags(void) const {return mAutocloseStart;}
CTagList* GetAutoCloseEndTags(void) const {return mAutocloseEnd;}
CTagList* GetNonAutoCloseEndTags(void) const {return mDontAutocloseEnd;}
eHTMLTags GetCloseTargetForEndTag(nsEntryStack& aTagStack,PRInt32 anIndex) const;
CTagList* GetSpecialChildren(void) const {return mSpecialKids;}
@@ -98,6 +99,7 @@ struct nsHTMLElement {
PRBool CanOmitStartTag(eHTMLTags aChild) const;
PRBool CanOmitEndTag(void) const;
PRBool CanContainSelf(void) const;
PRBool CanAutoCloseTag(eHTMLTags aTag, eHTMLTokenTypes aType) const;
PRBool HasSpecialProperty(PRInt32 aProperty) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
@@ -122,6 +124,7 @@ struct nsHTMLElement {
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 <Hn>)
CTagList* mDontAutocloseEnd; //these are the end tags that you cannot automatically close with this END tag
int mParentBits; //defines groups that can contain this element
int mInclusionBits; //defines parental and containment rules
int mExclusionBits; //defines things you CANNOT contain

View File

@@ -1032,7 +1032,9 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
// compatible we should not attempt to close the tags above it, for
// the contents inside the table might get thrown out of the table.
// The safest thing to do is to discard this tag.
return result;
if(!gHTMLElements[aChildTag].CanAutoCloseTag(theParentTag,eToken_start)) {
return result;
}
}
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
}//if
@@ -1478,14 +1480,15 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
UpdateStyleStackForCloseTag(theChildTag,theChildTag);
}
else {
if(kNotFound==GetIndexOfChildOrSynonym(mBodyContext->mStack,theChildTag)) {
if((kNotFound==GetIndexOfChildOrSynonym(mBodyContext->mStack,theChildTag)) ||
(!gHTMLElements[theChildTag].CanAutoCloseTag(mBodyContext->Last(),eToken_end))) {
UpdateStyleStackForCloseTag(theChildTag,theChildTag);
if(gHTMLElements[theChildTag].IsMemberOf(kBlockEntity)) {
// Oh boy!! we found a "stray" block entity. Nav4.x and IE introduce line break in
// such cases. So, let's simulate that effect for compatibility.
// Ex. <html><body>Hello</P>There</body></html>
CHTMLToken* theToken = (CHTMLToken*)gRecycler->CreateTokenOfType(eToken_start,theChildTag);
result=HandleStartToken(theToken);
result=HandleToken(theToken,mParser);
}
else return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,7 @@ struct nsHTMLElement {
CTagList* GetEndRootTags(void) const {return mEndRootNodes;}
CTagList* GetAutoCloseStartTags(void) const {return mAutocloseStart;}
CTagList* GetAutoCloseEndTags(void) const {return mAutocloseEnd;}
CTagList* GetNonAutoCloseEndTags(void) const {return mDontAutocloseEnd;}
eHTMLTags GetCloseTargetForEndTag(nsEntryStack& aTagStack,PRInt32 anIndex) const;
CTagList* GetSpecialChildren(void) const {return mSpecialKids;}
@@ -98,6 +99,7 @@ struct nsHTMLElement {
PRBool CanOmitStartTag(eHTMLTags aChild) const;
PRBool CanOmitEndTag(void) const;
PRBool CanContainSelf(void) const;
PRBool CanAutoCloseTag(eHTMLTags aTag, eHTMLTokenTypes aType) const;
PRBool HasSpecialProperty(PRInt32 aProperty) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
@@ -122,6 +124,7 @@ struct nsHTMLElement {
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 <Hn>)
CTagList* mDontAutocloseEnd; //these are the end tags that you cannot automatically close with this END tag
int mParentBits; //defines groups that can contain this element
int mInclusionBits; //defines parental and containment rules
int mExclusionBits; //defines things you CANNOT contain