bug 30487 ( nsbeta3+ ) - Watch out for barriers before popping off any stylistic

information
bug 37618 ( nsbeta3+ ) - Orpahaned residual tag can close only inline parents.
bug 44085 ( nsbeta3+ ) - Push comment into misplaced list if there are items in
queued in the list.
bug 22886 ( nsbeta3+ ) - Relax refresh header parsing, in the sink, a little bit
so that '.' is accounted for.

r=pollmann
This commit is contained in:
harishd%netscape.com 2000-08-17 20:54:49 +00:00
parent f1ebc3acd0
commit 8b80f333e1
4 changed files with 72 additions and 30 deletions

View File

@ -695,10 +695,10 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
switch(theTag) {
case eHTMLTag_html:
case eHTMLTag_comment:
case eHTMLTag_script:
case eHTMLTag_markupDecl:
break; // simply pass these through to token handler without further ado...
case eHTMLTag_comment:
case eHTMLTag_newline:
case eHTMLTag_whitespace:
if(mMisplacedContent.GetSize()<=0) // fix for bugs 17017,18308,23765, and 24275
@ -1781,7 +1781,17 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
eHTMLTags theParentTag=mBodyContext->Last();
if(kNotFound==GetIndexOfChildOrSynonym(*mBodyContext,theChildTag)) {
PopStyle(theChildTag);
// Ref: bug 30487
// Make sure that we don't cross boundaries, of certain elements,
// to close stylistic information.
// Ex. <font face="helvetica"><table><tr><td></font></td></tr></table> some text...
// In the above ex. the orphaned FONT tag, inside TD, should cross TD boundaryto
// close the FONT tag above TABLE.
static eHTMLTags gBarriers[]={eHTMLTag_td,eHTMLTag_th};
if(!FindTagInSet(theParentTag,gBarriers,sizeof(gBarriers)/sizeof(theParentTag))) {
PopStyle(theChildTag);
}
// If the bit kHandleStrayTag is set then we automatically open up a matching
// start tag ( compatibility ). Currently this bit is set on P tag.

View File

@ -1953,23 +1953,34 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
}
else if(IsResidualStyleTag(mTagID)){
// Ref. bug 37618
// Before finding a close target, for the current tag, make sure
// that the tag above does not gate.
// Ex. <font><select><option></font></select>
// Here the /FONT inside OPTION should not close try to close FONT
// above SELECT. This would cause select to get closed!!!
eHTMLTags thePrevTag=(eHTMLTags)aContext.Last();
if(IsInlineParent(thePrevTag)) {
//we intentionally make 2 passes:
//The first pass tries to exactly match, the 2nd pass matches the group.
PRInt32 theIndexCopy=theIndex;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(theTag==mTagID) {
return theTag;
PRInt32 theIndexCopy=theIndex;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(theTag==mTagID) {
return theTag;
}
}
theIndex=theIndexCopy;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
return theTag;
}
}
}
theIndex=theIndexCopy;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
return theTag;
}
}
}
return result;
}

View File

@ -695,10 +695,10 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
switch(theTag) {
case eHTMLTag_html:
case eHTMLTag_comment:
case eHTMLTag_script:
case eHTMLTag_markupDecl:
break; // simply pass these through to token handler without further ado...
case eHTMLTag_comment:
case eHTMLTag_newline:
case eHTMLTag_whitespace:
if(mMisplacedContent.GetSize()<=0) // fix for bugs 17017,18308,23765, and 24275
@ -1781,7 +1781,17 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
eHTMLTags theParentTag=mBodyContext->Last();
if(kNotFound==GetIndexOfChildOrSynonym(*mBodyContext,theChildTag)) {
PopStyle(theChildTag);
// Ref: bug 30487
// Make sure that we don't cross boundaries, of certain elements,
// to close stylistic information.
// Ex. <font face="helvetica"><table><tr><td></font></td></tr></table> some text...
// In the above ex. the orphaned FONT tag, inside TD, should cross TD boundaryto
// close the FONT tag above TABLE.
static eHTMLTags gBarriers[]={eHTMLTag_td,eHTMLTag_th};
if(!FindTagInSet(theParentTag,gBarriers,sizeof(gBarriers)/sizeof(theParentTag))) {
PopStyle(theChildTag);
}
// If the bit kHandleStrayTag is set then we automatically open up a matching
// start tag ( compatibility ). Currently this bit is set on P tag.

View File

@ -1953,23 +1953,34 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
}
else if(IsResidualStyleTag(mTagID)){
// Ref. bug 37618
// Before finding a close target, for the current tag, make sure
// that the tag above does not gate.
// Ex. <font><select><option></font></select>
// Here the /FONT inside OPTION should not close try to close FONT
// above SELECT. This would cause select to get closed!!!
eHTMLTags thePrevTag=(eHTMLTags)aContext.Last();
if(IsInlineParent(thePrevTag)) {
//we intentionally make 2 passes:
//The first pass tries to exactly match, the 2nd pass matches the group.
PRInt32 theIndexCopy=theIndex;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(theTag==mTagID) {
return theTag;
PRInt32 theIndexCopy=theIndex;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(theTag==mTagID) {
return theTag;
}
}
theIndex=theIndexCopy;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
return theTag;
}
}
}
theIndex=theIndexCopy;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(gHTMLElements[theTag].IsMemberOf(mParentBits)) {
return theTag;
}
}
}
return result;
}