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

This commit is contained in:
mrbkap%gmail.com 2005-02-01 03:00:38 +00:00
Родитель 9f398856f9
Коммит b4a99b4032
1 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

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