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
This commit is contained in:
mrbkap%gmail.com
2005-02-01 03:00:38 +00:00
parent bd426af5a7
commit c5ea63fd54

View File

@@ -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: <a><div><a></a></div></a>.
// XXX What about <a><span><a>, where the second <a> closes
// the <span>?
CHTMLToken *theMalformedToken =
NS_STATIC_CAST(CHTMLToken*, theStack.ObjectAt(earlyPos));
theMalformedToken->SetContainerInfo(eMalformed);
}
}
theStack.Push(theToken);
++theStackDepth;
}
break;
case eToken_end:
{