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