From fdc899aa10e95541d007c0a8774438d3092c79d7 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Sun, 29 Oct 2000 01:28:45 +0000 Subject: [PATCH] RTM+Limbo bugs: 55980, 57378. r=harishd, sr=buster, a=pdt. git-svn-id: svn://10.0.0.236/trunk@81972 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/CNavDTD.cpp | 19 ++++++++++++++-- mozilla/htmlparser/src/nsElementTable.cpp | 14 ++++++++++++ mozilla/htmlparser/src/nsElementTable.h | 22 +++++++++++++++++++ mozilla/parser/htmlparser/src/CNavDTD.cpp | 19 ++++++++++++++-- .../parser/htmlparser/src/nsElementTable.cpp | 14 ++++++++++++ .../parser/htmlparser/src/nsElementTable.h | 22 +++++++++++++++++++ 6 files changed, 106 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 28409508a84..15ca7ced182 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -1245,11 +1245,17 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode * * Now a little code to deal with bug #49687 (crash when layout stack gets too deep) * I've also opened this up to any container (not just inlines): re bug 55095 + * Improved to handle bug 55980 (infinite loop caused when DEPTH is exceeded and + *

is encountered by itself (

) is continuously produced. * **************************************************************************************/ - + if(MAX_REFLOW_DEPTHGetCount()) { - return kHierarchyTooDeep; + if(nsHTMLElement::IsContainer(aTag)) { + if(!gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) { + return kHierarchyTooDeep; //drop the container on the floor. + } + } } STOP_TIMER() @@ -2369,6 +2375,7 @@ nsresult CNavDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount) { * @return PR_TRUE if parent can contain child */ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const { + PRBool result=gHTMLElements[aParent].CanContain((eHTMLTags)aChild); #ifdef ALLOW_TR_AS_CHILD_OF_TABLE @@ -2390,6 +2397,14 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const { } } + if(eHTMLTag_nobr==aChild) { + if(IsInlineElement(aParent,aParent)){ + if(HasOpenContainer((eHTMLTags)aChild)) { + return PR_FALSE; + } + } + } + return result; } diff --git a/mozilla/htmlparser/src/nsElementTable.cpp b/mozilla/htmlparser/src/nsElementTable.cpp index 98d9d92fc63..f9d081bf74f 100644 --- a/mozilla/htmlparser/src/nsElementTable.cpp +++ b/mozilla/htmlparser/src/nsElementTable.cpp @@ -2025,6 +2025,20 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 } } + + else if(gHTMLElements[mTagID].IsTableElement()) { + + //This fixes 57378... + //example: which didn't close the + + PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table); + PRInt32 theLastOfMe=aContext.LastOf(mTagID); + if(theLastTable is encountered by itself (

) is continuously produced. * **************************************************************************************/ - + if(MAX_REFLOW_DEPTHGetCount()) { - return kHierarchyTooDeep; + if(nsHTMLElement::IsContainer(aTag)) { + if(!gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) { + return kHierarchyTooDeep; //drop the container on the floor. + } + } } STOP_TIMER() @@ -2369,6 +2375,7 @@ nsresult CNavDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount) { * @return PR_TRUE if parent can contain child */ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const { + PRBool result=gHTMLElements[aParent].CanContain((eHTMLTags)aChild); #ifdef ALLOW_TR_AS_CHILD_OF_TABLE @@ -2390,6 +2397,14 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const { } } + if(eHTMLTag_nobr==aChild) { + if(IsInlineElement(aParent,aParent)){ + if(HasOpenContainer((eHTMLTags)aChild)) { + return PR_FALSE; + } + } + } + return result; } diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index 98d9d92fc63..f9d081bf74f 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -2025,6 +2025,20 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 } } + + else if(gHTMLElements[mTagID].IsTableElement()) { + + //This fixes 57378... + //example:

which didn't close the + + PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table); + PRInt32 theLastOfMe=aContext.LastOf(mTagID); + if(theLastTable