From beea70d29dce06bd8d37804cac5c0a1b3f9e032c Mon Sep 17 00:00:00 2001
From: "harishd%netscape.com"
Date: Fri, 14 Sep 2001 20:45:16 +0000
Subject: [PATCH] 98261 - Instead of throwing away the current tag close it's
parent such that the stack level does not go beyond the reflow depth limit.
This would allow leaf tags, that follow the current tag, to find the correct
node. r=heikki, sr=attinasi.
git-svn-id: svn://10.0.0.236/trunk@102933 18797224-902f-48f8-a5cc-f745e15eee43
---
mozilla/htmlparser/src/CNavDTD.cpp | 22 +++++++++++++++-------
mozilla/parser/htmlparser/src/CNavDTD.cpp | 22 +++++++++++++++-------
2 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp
index 9ba9ca8bebd..7f3de8e3343 100644
--- a/mozilla/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/htmlparser/src/CNavDTD.cpp
@@ -1341,13 +1341,21 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNode
*
is encountered by itself () is continuously produced.
*
**************************************************************************************/
-
- if(MAX_REFLOW_DEPTHGetCount()) {
- if(nsHTMLElement::IsContainer(aTag)) {
- if(!gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) {
- return kHierarchyTooDeep; //drop the container on the floor.
- }
- }
+
+ PRInt32 stackDepth = mBodyContext->GetCount();
+ if (stackDepth > MAX_REFLOW_DEPTH) {
+ if (nsHTMLElement::IsContainer(aTag) &&
+ !gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) {
+ // Ref. bug 98261,49678,55095,55980
+ // Instead of throwing away the current tag close it's parent
+ // such that the stack level does not go beyond the max_reflow_depth.
+ // This would allow leaf tags, that follow the current tag, to find
+ // the correct node.
+ while (stackDepth != MAX_REFLOW_DEPTH && NS_SUCCEEDED(result)) {
+ result = CloseContainersTo(mBodyContext->Last(),PR_FALSE);
+ --stackDepth;
+ }
+ }
}
STOP_TIMER()
diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp
index 9ba9ca8bebd..7f3de8e3343 100644
--- a/mozilla/parser/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp
@@ -1341,13 +1341,21 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNode
*
is encountered by itself () is continuously produced.
*
**************************************************************************************/
-
- if(MAX_REFLOW_DEPTHGetCount()) {
- if(nsHTMLElement::IsContainer(aTag)) {
- if(!gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) {
- return kHierarchyTooDeep; //drop the container on the floor.
- }
- }
+
+ PRInt32 stackDepth = mBodyContext->GetCount();
+ if (stackDepth > MAX_REFLOW_DEPTH) {
+ if (nsHTMLElement::IsContainer(aTag) &&
+ !gHTMLElements[aTag].HasSpecialProperty(kHandleStrayTag)) {
+ // Ref. bug 98261,49678,55095,55980
+ // Instead of throwing away the current tag close it's parent
+ // such that the stack level does not go beyond the max_reflow_depth.
+ // This would allow leaf tags, that follow the current tag, to find
+ // the correct node.
+ while (stackDepth != MAX_REFLOW_DEPTH && NS_SUCCEEDED(result)) {
+ result = CloseContainersTo(mBodyContext->Last(),PR_FALSE);
+ --stackDepth;
+ }
+ }
}
STOP_TIMER()