From 0bdf148e909a729da5bf2c9723aec6cee25a0ec0 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Thu, 13 Jan 2005 03:34:18 +0000 Subject: [PATCH] bug 117738:
within nested in is ignored. r=rbs sr=jst git-svn-id: svn://10.0.0.236/trunk@167654 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/parser/htmlparser/src/CNavDTD.cpp | 3 +- .../parser/htmlparser/src/nsElementTable.cpp | 39 +++++++------------ .../parser/htmlparser/src/nsElementTable.h | 2 +- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index e6a105ee917..301f06347f9 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -1271,7 +1271,8 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsC if(!(theParentContains && theChildAgrees)) { if (!CanPropagate(theParentTag,aChildTag,theParentContains)) { if(theChildIsContainer || (!theParentContains)){ - if(!theChildAgrees && !gHTMLElements[aChildTag].CanAutoCloseTag(*mBodyContext,aChildTag)) { + if(!theChildAgrees && + !gHTMLElements[aChildTag].CanAutoCloseTag(*mBodyContext,theIndex,aChildTag)) { // Closing the tags above might cause non-compatible results. // Ex.
Text
. // In the example above is badly misplaced, but diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 9a1472b4715..a26ca8b49b6 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -2022,35 +2022,26 @@ PRBool nsHTMLElement::CanContainSelf(void) const { * * @update gess 12/20/99 * @param aContext is the tag stack we're testing against + * @param aIndex is the index of the tag we want to close * @param aChildTag is the child we're trying to close - * @param aCount is the number tags we should test * @return TRUE if we can autoclose the start tag; FALSE otherwise */ -PRBool nsHTMLElement::CanAutoCloseTag(nsDTDContext& aContext,eHTMLTags aChildTag) const{ +PRBool nsHTMLElement::CanAutoCloseTag(nsDTDContext& aContext,PRInt32 aIndex, + eHTMLTags aChildTag) const{ - PRInt32 thePos=aContext.GetCount(); - PRBool result=PR_FALSE; - eHTMLTags thePrevTag=eHTMLTag_unknown; + PRInt32 thePos; + PRBool result = PR_TRUE; + eHTMLTags thePrevTag; - for(thePos=aContext.GetCount()-1;thePos>0;thePos--) { - thePrevTag=aContext.TagAt(thePos); - switch(thePrevTag) { - case eHTMLTag_applet: - case eHTMLTag_td: - thePos=0; - result=PR_FALSE; - break; - case eHTMLTag_body: - result=aChildTag!=thePrevTag; - thePos=0; - default: - if(aChildTag==thePrevTag) { - result=PR_TRUE; - thePos=0; - } - break; - } //switch - } //for + for(thePos = aContext.GetCount() - 1; thePos >= aIndex; thePos--) { + thePrevTag = aContext.TagAt(thePos); + + if (thePrevTag == eHTMLTag_applet || + thePrevTag == eHTMLTag_td) { + result = PR_FALSE; + break; + } + } return result; } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h index 4f637c9f8ce..1c5f09a46ce 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.h +++ b/mozilla/parser/htmlparser/src/nsElementTable.h @@ -214,7 +214,7 @@ struct nsHTMLElement { PRBool CanOmitStartTag(eHTMLTags aChild) const; PRBool CanOmitEndTag(void) const; PRBool CanContainSelf(void) const; - PRBool CanAutoCloseTag(nsDTDContext& aContext,eHTMLTags aTag) const; + PRBool CanAutoCloseTag(nsDTDContext& aContext,PRInt32 aIndex,eHTMLTags aTag) const; PRBool HasSpecialProperty(PRInt32 aProperty) const; PRBool IsSpecialParent(eHTMLTags aTag) const; PRBool IsExcludableParent(eHTMLTags aParent) const;