diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp
index 183b7e0bf05..8782e8ca9ae 100644
--- a/mozilla/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/htmlparser/src/CNavDTD.cpp
@@ -843,7 +843,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
case eHTMLTag_counter:
{
PRInt32 theCount=mBodyContext->GetCount();
- eHTMLTags theGrandParentTag=mBodyContext->TagAt(theCount-1);
+ eHTMLTags theGrandParentTag=mBodyContext->TagAt(theCount-2);
nsAutoString theNumber;
@@ -980,47 +980,23 @@ PRBool CanBeContained(eHTMLTags aChildTag,nsDTDContext& aContext) {
//Note: This method is going away. First we need to get the elementtable to do closures right, and
// therefore we must get residual style handling to work.
- //the changes to this method were added to fix bug 54651...
-
- PRBool result=PR_TRUE;
- PRInt32 theCount=aContext.GetCount();
-
- if(0theSPIndex) ? theRootIndex : theSPIndex;
+ PRInt32 theBaseIndex=(theRootIndex>theSPIndex) ? theRootIndex : theSPIndex;
- if((theTargetIndex==theCount-1) ||
- ((theTargetIndex==theChildIndex) && gHTMLElements[aChildTag].CanContainSelf())) {
+ if((theBaseIndex==theChildIndex) && (gHTMLElements[aChildTag].CanContainSelf()))
result=PR_TRUE;
- }
- else {
-
- result=PR_FALSE;
-
- PRInt32 theIndex=theCount-1;
- while(theChildIndextheChildIndex);
}
}
return result;
-
}
enum eProcessRule {eNormalOp,eLetInlineContainBlock};
@@ -1065,7 +1041,7 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
(nsHTMLElement::IsResidualStyleTag(theParentTag)) &&
(IsBlockElement(aChildTag,theParentTag))) {
- if((eHTMLTag_table!=aChildTag) && (eHTMLTag_li!=aChildTag)) {
+ if(eHTMLTag_table!=aChildTag) {
nsCParserNode* theParentNode= NS_STATIC_CAST(nsCParserNode*, mBodyContext->PeekNode());
if(theParentNode->mToken->IsWellFormed()) {
theRule=eLetInlineContainBlock;
@@ -1213,12 +1189,15 @@ 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
*
**************************************************************************************/
if(MAX_REFLOW_DEPTHGetCount()) {
- return kHierarchyTooDeep;
+ if(gHTMLElements[aTag].IsMemberOf(kInlineEntity)) {
+ if(!gHTMLElements[aTag].IsMemberOf(kFormControl)) {
+ return kHierarchyTooDeep;
+ }
+ }
}
STOP_TIMER()
@@ -1661,8 +1640,7 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aContext,aCurrentTag);
if(kNotFound=anIndex) && (eHTMLTag_unknown==result)){
eHTMLTags theTag=aContext.TagAt(theIndex);
diff --git a/mozilla/htmlparser/src/nsElementTable.h b/mozilla/htmlparser/src/nsElementTable.h
index 492a75db3fb..853ae47a00e 100644
--- a/mozilla/htmlparser/src/nsElementTable.h
+++ b/mozilla/htmlparser/src/nsElementTable.h
@@ -161,7 +161,6 @@ struct nsHTMLElement {
TagList* GetSpecialParents(void) const {return mSpecialParents;}
PRBool IsMemberOf(PRInt32 aType) const;
- PRBool ContainsSet(PRInt32 aType) const;
PRBool CanContainType(PRInt32 aType) const;
eHTMLTags GetTag(void) const {return mTagID;}
diff --git a/mozilla/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
index bae9930fa16..21f285b167b 100644
--- a/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
@@ -343,74 +343,69 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
+ PRBool theTagIsBlock=gHTMLElements[theTag].IsMemberOf(kBlockEntity);
+ PRBool theTagIsInline= (theTagIsBlock) ? PR_FALSE : gHTMLElements[theTag].IsMemberOf(kInlineEntity);
- PRBool theTagIsContainer=nsHTMLElement::IsContainer(theTag); //bug54117...
+ if(theTagIsBlock || theTagIsInline || (eHTMLTag_table==theTag)) {
- if(theTagIsContainer) {
- PRBool theTagIsBlock=gHTMLElements[theTag].IsMemberOf(kBlockEntity);
- PRBool theTagIsInline= (theTagIsBlock) ? PR_FALSE : gHTMLElements[theTag].IsMemberOf(kInlineEntity);
+ switch(theType) {
- if(theTagIsBlock || theTagIsInline || (eHTMLTag_table==theTag)) {
+ case eToken_start:
+ if(0==theStack.GetSize()) {
+ //track the tag on the top of the stack...
+ theRootToken=theToken;
+ theRootTag=theTag;
+ }
+ theStack.Push(theToken);
+ theStackDepth++;
+ break;
- switch(theType) {
+ case eToken_end:
+ {
+ CHTMLToken *theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ if(theLastToken) {
+ if(theTag==theLastToken->GetTypeID()) {
+ theStack.Pop(); //yank it for real
+ theStackDepth--;
+ theLastToken->SetContainerInfo(eWellFormed);
- case eToken_start:
- if(0==theStack.GetSize()) {
- //track the tag on the top of the stack...
- theRootToken=theToken;
- theRootTag=theTag;
- }
- theStack.Push(theToken);
- theStackDepth++;
- break;
+ //in addition, let's look above this container to see if we can find
+ //any tags that are already marked malformed. If so, pop them too!
- case eToken_end:
- {
- CHTMLToken *theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- if(theLastToken) {
- if(theTag==theLastToken->GetTypeID()) {
- theStack.Pop(); //yank it for real
- theStackDepth--;
- theLastToken->SetContainerInfo(eWellFormed);
-
- //in addition, let's look above this container to see if we can find
- //any tags that are already marked malformed. If so, pop them too!
-
- theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- while(theLastToken) {
- if(eMalformed==theRootToken->GetContainerInfo()) {
- theStack.Pop(); //yank the malformed token for real.
- theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- continue;
- }
- break;
- }
- }
- else {
- //the topmost token isn't what we expected, so that container must
- //be malformed. If the tag is a block, we don't really care (but we'll
- //mark it anyway). If it's an inline we DO care, especially if the
- //inline tried to contain a block (that's when RS handling kicks in).
- if(theTagIsInline) {
- PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
- if(kNotFound!=theIndex) {
- theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
- theToken->SetContainerInfo(eMalformed);
- }
- //otherwise we ignore an out-of-place end tag.
- }
- else {
+ theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ while(theLastToken) {
+ if(eMalformed==theRootToken->GetContainerInfo()) {
+ theStack.Pop(); //yank the malformed token for real.
+ theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ continue;
}
+ break;
}
}
- }
- break;
+ else {
+ //the topmost token isn't what we expected, so that container must
+ //be malformed. If the tag is a block, we don't really care (but we'll
+ //mark it anyway). If it's an inline we DO care, especially if the
+ //inline tried to contain a block (that's when RS handling kicks in).
+ if(theTagIsInline) {
+ PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
+ if(kNotFound!=theIndex) {
+ theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
+ theToken->SetContainerInfo(eMalformed);
+ }
+ //otherwise we ignore an out-of-place end tag.
+ }
+ else {
+ }
+ }
+ }
+ }
+ break;
- default:
- break;
- } //switch
+ default:
+ break;
+ } //switch
- }
}
theToken=(CHTMLToken*)mTokenDeque.ObjectAt(++mTokenScanPos);
diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp
index da10666a711..5b7d75a5944 100644
--- a/mozilla/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp
@@ -997,13 +997,9 @@ nsresult CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMo
nsresult result=PR_TRUE;
switch(aMode) {
-
-#if 0 //set to 1 if you want strict comments... bug 53011...
case eDTDMode_strict:
result=ConsumeStrictComment(aChar,aScanner,mTextValue);
break;
-#endif
-
case eDTDMode_transitional:
default:
result=ConsumeComment(aChar,aScanner,mTextValue);
diff --git a/mozilla/htmlparser/src/nsIHTMLContentSink.h b/mozilla/htmlparser/src/nsIHTMLContentSink.h
index 061733bb9d2..7f1f8efbd13 100644
--- a/mozilla/htmlparser/src/nsIHTMLContentSink.h
+++ b/mozilla/htmlparser/src/nsIHTMLContentSink.h
@@ -73,11 +73,7 @@
{ 0xa6cf9051, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-#ifdef XP_MAC
-#define MAX_REFLOW_DEPTH 75 //setting to 75 to prevent layout from crashing on mac. Bug 55095.
-#else
-#define MAX_REFLOW_DEPTH 200 //windows and linux (etc) can do much deeper structures.
-#endif
+#define MAX_REFLOW_DEPTH 200
class nsIHTMLContentSink : public nsIContentSink {
diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp
index 183b7e0bf05..8782e8ca9ae 100644
--- a/mozilla/parser/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp
@@ -843,7 +843,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
case eHTMLTag_counter:
{
PRInt32 theCount=mBodyContext->GetCount();
- eHTMLTags theGrandParentTag=mBodyContext->TagAt(theCount-1);
+ eHTMLTags theGrandParentTag=mBodyContext->TagAt(theCount-2);
nsAutoString theNumber;
@@ -980,47 +980,23 @@ PRBool CanBeContained(eHTMLTags aChildTag,nsDTDContext& aContext) {
//Note: This method is going away. First we need to get the elementtable to do closures right, and
// therefore we must get residual style handling to work.
- //the changes to this method were added to fix bug 54651...
-
- PRBool result=PR_TRUE;
- PRInt32 theCount=aContext.GetCount();
-
- if(0theSPIndex) ? theRootIndex : theSPIndex;
+ PRInt32 theBaseIndex=(theRootIndex>theSPIndex) ? theRootIndex : theSPIndex;
- if((theTargetIndex==theCount-1) ||
- ((theTargetIndex==theChildIndex) && gHTMLElements[aChildTag].CanContainSelf())) {
+ if((theBaseIndex==theChildIndex) && (gHTMLElements[aChildTag].CanContainSelf()))
result=PR_TRUE;
- }
- else {
-
- result=PR_FALSE;
-
- PRInt32 theIndex=theCount-1;
- while(theChildIndextheChildIndex);
}
}
return result;
-
}
enum eProcessRule {eNormalOp,eLetInlineContainBlock};
@@ -1065,7 +1041,7 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
(nsHTMLElement::IsResidualStyleTag(theParentTag)) &&
(IsBlockElement(aChildTag,theParentTag))) {
- if((eHTMLTag_table!=aChildTag) && (eHTMLTag_li!=aChildTag)) {
+ if(eHTMLTag_table!=aChildTag) {
nsCParserNode* theParentNode= NS_STATIC_CAST(nsCParserNode*, mBodyContext->PeekNode());
if(theParentNode->mToken->IsWellFormed()) {
theRule=eLetInlineContainBlock;
@@ -1213,12 +1189,15 @@ 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
*
**************************************************************************************/
if(MAX_REFLOW_DEPTHGetCount()) {
- return kHierarchyTooDeep;
+ if(gHTMLElements[aTag].IsMemberOf(kInlineEntity)) {
+ if(!gHTMLElements[aTag].IsMemberOf(kFormControl)) {
+ return kHierarchyTooDeep;
+ }
+ }
}
STOP_TIMER()
@@ -1661,8 +1640,7 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aContext,aCurrentTag);
if(kNotFound=anIndex) && (eHTMLTag_unknown==result)){
eHTMLTags theTag=aContext.TagAt(theIndex);
diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h
index 492a75db3fb..853ae47a00e 100644
--- a/mozilla/parser/htmlparser/src/nsElementTable.h
+++ b/mozilla/parser/htmlparser/src/nsElementTable.h
@@ -161,7 +161,6 @@ struct nsHTMLElement {
TagList* GetSpecialParents(void) const {return mSpecialParents;}
PRBool IsMemberOf(PRInt32 aType) const;
- PRBool ContainsSet(PRInt32 aType) const;
PRBool CanContainType(PRInt32 aType) const;
eHTMLTags GetTag(void) const {return mTagID;}
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
index bae9930fa16..21f285b167b 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
@@ -343,74 +343,69 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType());
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
+ PRBool theTagIsBlock=gHTMLElements[theTag].IsMemberOf(kBlockEntity);
+ PRBool theTagIsInline= (theTagIsBlock) ? PR_FALSE : gHTMLElements[theTag].IsMemberOf(kInlineEntity);
- PRBool theTagIsContainer=nsHTMLElement::IsContainer(theTag); //bug54117...
+ if(theTagIsBlock || theTagIsInline || (eHTMLTag_table==theTag)) {
- if(theTagIsContainer) {
- PRBool theTagIsBlock=gHTMLElements[theTag].IsMemberOf(kBlockEntity);
- PRBool theTagIsInline= (theTagIsBlock) ? PR_FALSE : gHTMLElements[theTag].IsMemberOf(kInlineEntity);
+ switch(theType) {
- if(theTagIsBlock || theTagIsInline || (eHTMLTag_table==theTag)) {
+ case eToken_start:
+ if(0==theStack.GetSize()) {
+ //track the tag on the top of the stack...
+ theRootToken=theToken;
+ theRootTag=theTag;
+ }
+ theStack.Push(theToken);
+ theStackDepth++;
+ break;
- switch(theType) {
+ case eToken_end:
+ {
+ CHTMLToken *theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ if(theLastToken) {
+ if(theTag==theLastToken->GetTypeID()) {
+ theStack.Pop(); //yank it for real
+ theStackDepth--;
+ theLastToken->SetContainerInfo(eWellFormed);
- case eToken_start:
- if(0==theStack.GetSize()) {
- //track the tag on the top of the stack...
- theRootToken=theToken;
- theRootTag=theTag;
- }
- theStack.Push(theToken);
- theStackDepth++;
- break;
+ //in addition, let's look above this container to see if we can find
+ //any tags that are already marked malformed. If so, pop them too!
- case eToken_end:
- {
- CHTMLToken *theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- if(theLastToken) {
- if(theTag==theLastToken->GetTypeID()) {
- theStack.Pop(); //yank it for real
- theStackDepth--;
- theLastToken->SetContainerInfo(eWellFormed);
-
- //in addition, let's look above this container to see if we can find
- //any tags that are already marked malformed. If so, pop them too!
-
- theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- while(theLastToken) {
- if(eMalformed==theRootToken->GetContainerInfo()) {
- theStack.Pop(); //yank the malformed token for real.
- theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
- continue;
- }
- break;
- }
- }
- else {
- //the topmost token isn't what we expected, so that container must
- //be malformed. If the tag is a block, we don't really care (but we'll
- //mark it anyway). If it's an inline we DO care, especially if the
- //inline tried to contain a block (that's when RS handling kicks in).
- if(theTagIsInline) {
- PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
- if(kNotFound!=theIndex) {
- theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
- theToken->SetContainerInfo(eMalformed);
- }
- //otherwise we ignore an out-of-place end tag.
- }
- else {
+ theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ while(theLastToken) {
+ if(eMalformed==theRootToken->GetContainerInfo()) {
+ theStack.Pop(); //yank the malformed token for real.
+ theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
+ continue;
}
+ break;
}
}
- }
- break;
+ else {
+ //the topmost token isn't what we expected, so that container must
+ //be malformed. If the tag is a block, we don't really care (but we'll
+ //mark it anyway). If it's an inline we DO care, especially if the
+ //inline tried to contain a block (that's when RS handling kicks in).
+ if(theTagIsInline) {
+ PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
+ if(kNotFound!=theIndex) {
+ theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
+ theToken->SetContainerInfo(eMalformed);
+ }
+ //otherwise we ignore an out-of-place end tag.
+ }
+ else {
+ }
+ }
+ }
+ }
+ break;
- default:
- break;
- } //switch
+ default:
+ break;
+ } //switch
- }
}
theToken=(CHTMLToken*)mTokenDeque.ObjectAt(++mTokenScanPos);
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
index da10666a711..5b7d75a5944 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -997,13 +997,9 @@ nsresult CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMo
nsresult result=PR_TRUE;
switch(aMode) {
-
-#if 0 //set to 1 if you want strict comments... bug 53011...
case eDTDMode_strict:
result=ConsumeStrictComment(aChar,aScanner,mTextValue);
break;
-#endif
-
case eDTDMode_transitional:
default:
result=ConsumeComment(aChar,aScanner,mTextValue);
diff --git a/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h b/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h
index 061733bb9d2..7f1f8efbd13 100644
--- a/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h
+++ b/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h
@@ -73,11 +73,7 @@
{ 0xa6cf9051, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-#ifdef XP_MAC
-#define MAX_REFLOW_DEPTH 75 //setting to 75 to prevent layout from crashing on mac. Bug 55095.
-#else
-#define MAX_REFLOW_DEPTH 200 //windows and linux (etc) can do much deeper structures.
-#endif
+#define MAX_REFLOW_DEPTH 200
class nsIHTMLContentSink : public nsIContentSink {