fixed bug 40487 and 26347; r=attinasi/harishd

git-svn-id: svn://10.0.0.236/trunk@79226 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com 2000-09-14 23:31:07 +00:00
parent e7953b06dd
commit c80e00b312
6 changed files with 28 additions and 10 deletions

View File

@ -1660,6 +1660,10 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
}
//otherwise its in the close list so skip to next tag...
}
eHTMLTags theTarget=aContext.TagAt(theChildIndex);
if(aCurrentTag!=theTarget) {
aCurrentTag=theTarget; //use the synonym.
}
return aCurrentTag; //if you make it here, we're ungated and found a target!
}//if
else if(theRootTags) {
@ -1786,6 +1790,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
}
else {
eHTMLTags theParentTag=mBodyContext->Last();
if(kNotFound==GetIndexOfChildOrSynonym(*mBodyContext,theChildTag)) {
// Ref: bug 30487

View File

@ -610,7 +610,8 @@ inline PRBool HasOptionalEndTag(eHTMLTags aTag) {
static eHTMLTags gHasOptionalEndTags[]={eHTMLTag_body,eHTMLTag_colgroup,eHTMLTag_dd,eHTMLTag_dt,
eHTMLTag_head,eHTMLTag_li,eHTMLTag_option,
eHTMLTag_p,eHTMLTag_tbody,eHTMLTag_td,eHTMLTag_tfoot,
eHTMLTag_th,eHTMLTag_thead,eHTMLTag_tr,eHTMLTag_unknown};
eHTMLTag_th,eHTMLTag_thead,eHTMLTag_tr,
eHTMLTag_userdefined,eHTMLTag_unknown};
return FindTagInSet(aTag,gHasOptionalEndTags,sizeof(gHasOptionalEndTags)/sizeof(eHTMLTag_body));
}

View File

@ -1898,7 +1898,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
//fixes a derivative of bug 22842...
if(CanContainType(kBlock)) { //INS/DEL can contain blocks.
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
if(HasOptionalEndTag(theTag)) {
continue; //then I can close it.
}
@ -1924,14 +1924,16 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
if(theTag!=mTagID) {
//phrasal elements can close other phrasals, along with fontstyle and special tags...
if(gHTMLElements[theTag].IsSpecialEntity() || gHTMLElements[theTag].IsFontStyleEntity()) {
if((eHTMLTag_userdefined==theTag) ||
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()) {
continue;
}
else {
//fixes bug 22842...
if(CanContainType(kBlock)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
if(HasOptionalEndTag(theTag)) {
continue; //then I can close it.
}
@ -1989,7 +1991,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
// above SELECT. This would cause select to get closed!!!
eHTMLTags thePrevTag=(eHTMLTags)aContext.Last();
if(IsInlineParent(thePrevTag)) {
if(IsInlineParent(thePrevTag) || (eHTMLTag_userdefined==thePrevTag)) {
//we intentionally make 2 passes:
//The first pass tries to exactly match, the 2nd pass matches the group.
@ -2022,6 +2024,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
*/
PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{
if(IsContainer(mTagID)){
if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {

View File

@ -1660,6 +1660,10 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
}
//otherwise its in the close list so skip to next tag...
}
eHTMLTags theTarget=aContext.TagAt(theChildIndex);
if(aCurrentTag!=theTarget) {
aCurrentTag=theTarget; //use the synonym.
}
return aCurrentTag; //if you make it here, we're ungated and found a target!
}//if
else if(theRootTags) {
@ -1786,6 +1790,7 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
}
else {
eHTMLTags theParentTag=mBodyContext->Last();
if(kNotFound==GetIndexOfChildOrSynonym(*mBodyContext,theChildTag)) {
// Ref: bug 30487

View File

@ -610,7 +610,8 @@ inline PRBool HasOptionalEndTag(eHTMLTags aTag) {
static eHTMLTags gHasOptionalEndTags[]={eHTMLTag_body,eHTMLTag_colgroup,eHTMLTag_dd,eHTMLTag_dt,
eHTMLTag_head,eHTMLTag_li,eHTMLTag_option,
eHTMLTag_p,eHTMLTag_tbody,eHTMLTag_td,eHTMLTag_tfoot,
eHTMLTag_th,eHTMLTag_thead,eHTMLTag_tr,eHTMLTag_unknown};
eHTMLTag_th,eHTMLTag_thead,eHTMLTag_tr,
eHTMLTag_userdefined,eHTMLTag_unknown};
return FindTagInSet(aTag,gHasOptionalEndTags,sizeof(gHasOptionalEndTags)/sizeof(eHTMLTag_body));
}

View File

@ -1898,7 +1898,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
//fixes a derivative of bug 22842...
if(CanContainType(kBlock)) { //INS/DEL can contain blocks.
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
if(HasOptionalEndTag(theTag)) {
continue; //then I can close it.
}
@ -1924,14 +1924,16 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
if(theTag!=mTagID) {
//phrasal elements can close other phrasals, along with fontstyle and special tags...
if(gHTMLElements[theTag].IsSpecialEntity() || gHTMLElements[theTag].IsFontStyleEntity()) {
if((eHTMLTag_userdefined==theTag) ||
gHTMLElements[theTag].IsSpecialEntity() ||
gHTMLElements[theTag].IsFontStyleEntity()) {
continue;
}
else {
//fixes bug 22842...
if(CanContainType(kBlock)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity)) {
if(gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kBlockEntity) || gHTMLElements[eHTMLTags(theTag)].IsMemberOf(kFlowEntity)) {
if(HasOptionalEndTag(theTag)) {
continue; //then I can close it.
}
@ -1989,7 +1991,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
// above SELECT. This would cause select to get closed!!!
eHTMLTags thePrevTag=(eHTMLTags)aContext.Last();
if(IsInlineParent(thePrevTag)) {
if(IsInlineParent(thePrevTag) || (eHTMLTag_userdefined==thePrevTag)) {
//we intentionally make 2 passes:
//The first pass tries to exactly match, the 2nd pass matches the group.
@ -2022,6 +2024,7 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
*/
PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{
if(IsContainer(mTagID)){
if(gHTMLElements[aChild].HasSpecialProperty(kLegalOpen)) {