From 1f8f8d5c073b60590500cf9387c7d60b4028c1ce 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.
---
htmlparser/src/CNavDTD.cpp | 22 +++++++++++++++-------
parser/htmlparser/src/CNavDTD.cpp | 22 +++++++++++++++-------
2 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp
index 9ba9ca8bebdd..7f3de8e33431 100644
--- a/htmlparser/src/CNavDTD.cpp
+++ b/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/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp
index 9ba9ca8bebdd..7f3de8e33431 100644
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/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()