From cecf1d33ee178e4cc03b5ef4af7c38404a878ab8 Mon Sep 17 00:00:00 2001 From: "harishd%netscape.com" Date: Wed, 19 Sep 2001 00:01:42 +0000 Subject: [PATCH] 98187 - Make sure that the end tag, inline element, does not close tags in the root tag list. r=heikki,sr-vidur git-svn-id: svn://10.0.0.236/trunk@103145 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsElementTable.cpp | 7 +++++-- mozilla/parser/htmlparser/src/nsElementTable.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/nsElementTable.cpp b/mozilla/htmlparser/src/nsElementTable.cpp index 7c61b58b32f..d3deba1ec08 100644 --- a/mozilla/htmlparser/src/nsElementTable.cpp +++ b/mozilla/htmlparser/src/nsElementTable.cpp @@ -2175,19 +2175,22 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 // Note: we intentionally make 2 passes: // The first pass tries to exactly match, the 2nd pass matches the group. + TagList* theRootTags=gHTMLElements[mTagID].GetEndRootTags(); PRInt32 theIndexCopy=theIndex; while(--theIndex>=anIndex){ eHTMLTags theTag=aContext.TagAt(theIndex); if(theTag == mTagID) { return theTag; // we found our target. } - else if (!CanContain(theTag)) { + else if (!CanContain(theTag) || + (theRootTags && FindTagInSet(theTag,theRootTags->mTags,theRootTags->mCount))) { // If you cannot contain this tag then // you cannot close it either. It looks like // the tag trying to close is misplaced. // In the following Exs. notice the misplaced /font: // Ex. -- Ref. bug 37618. + // Ex. -- Ref. bug 37618 + // Ex. -- Ref. bug 98187 return eHTMLTag_unknown; } } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 7c61b58b32f..d3deba1ec08 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -2175,19 +2175,22 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 // Note: we intentionally make 2 passes: // The first pass tries to exactly match, the 2nd pass matches the group. + TagList* theRootTags=gHTMLElements[mTagID].GetEndRootTags(); PRInt32 theIndexCopy=theIndex; while(--theIndex>=anIndex){ eHTMLTags theTag=aContext.TagAt(theIndex); if(theTag == mTagID) { return theTag; // we found our target. } - else if (!CanContain(theTag)) { + else if (!CanContain(theTag) || + (theRootTags && FindTagInSet(theTag,theRootTags->mTags,theRootTags->mCount))) { // If you cannot contain this tag then // you cannot close it either. It looks like // the tag trying to close is misplaced. // In the following Exs. notice the misplaced /font: // Ex.
-- Ref. bug 37618. + // Ex. -- Ref. bug 37618 + // Ex. -- Ref. bug 98187 return eHTMLTag_unknown; } }