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: {