From c5ea63fd549015a4ee19b15c46e23dcbe98c94f5 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Tue, 1 Feb 2005 03:00:38 +0000 Subject: [PATCH] bug 90664: Make sure we perform RS handling when we can, in cases where tags that cannot nest and normally would be closed out cannot, due to block tags between them. r=jst sr=brendan git-svn-id: svn://10.0.0.236/trunk@168608 18797224-902f-48f8-a5cc-f745e15eee43 --- .../parser/htmlparser/src/nsHTMLTokenizer.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp index 98c8bfebd54..9711a8730b6 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp @@ -394,8 +394,26 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) { if(theTagIsBlock || theTagIsInline || eHTMLTag_table == theTag) { switch(theType) { case eToken_start: - theStack.Push(theToken); - ++theStackDepth; + { + if (gHTMLElements[theTag].ShouldVerifyHierarchy()) { + PRInt32 earlyPos = FindLastIndexOfTag(theTag, theStack); + if (earlyPos != kNotFound) { + // Uh-oh, we've found a tag that is not allowed to nest at + // all. Mark the previous one as malformed to increase our + // chances of doing RS handling on it. We want to do this + // for cases such as:
. + // XXX What about , where the second closes + // the ? + CHTMLToken *theMalformedToken = + NS_STATIC_CAST(CHTMLToken*, theStack.ObjectAt(earlyPos)); + + theMalformedToken->SetContainerInfo(eMalformed); + } + } + + theStack.Push(theToken); + ++theStackDepth; + } break; case eToken_end: {