RTM+Limbo bugs: 55980, 57378. r=harishd, sr=buster, a=pdt.

This commit is contained in:
rickg%netscape.com 2000-10-29 01:28:45 +00:00
Родитель cd56c0575b
Коммит 8d0a905b60
6 изменённых файлов: 106 добавлений и 4 удалений

Просмотреть файл

@ -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
* </P> is encountered by itself (<P>) is continuously produced.
*
**************************************************************************************/
if(MAX_REFLOW_DEPTH<mBodyContext->GetCount()) {
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;
}

Просмотреть файл

@ -2025,6 +2025,20 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
}
}
else if(gHTMLElements[mTagID].IsTableElement()) {
//This fixes 57378...
//example: <TABLE><THEAD><TR><TH></THEAD> which didn't close the <THEAD>
PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table);
PRInt32 theLastOfMe=aContext.LastOf(mTagID);
if(theLastTable<theLastOfMe) {
return mTagID;
}
}
return result;
}

Просмотреть файл

@ -147,6 +147,28 @@ struct nsHTMLElement {
return PR_FALSE;
}
inline PRBool IsTableElement(void) { //return yes if it's a table or child of a table...
PRBool result=PR_FALSE;
switch(mTagID) {
case eHTMLTag_table:
case eHTMLTag_thead:
case eHTMLTag_tbody:
case eHTMLTag_tfoot:
case eHTMLTag_caption:
case eHTMLTag_tr:
case eHTMLTag_td:
case eHTMLTag_th:
case eHTMLTag_col:
case eHTMLTag_colgroup:
result=PR_TRUE;
break;
default:
result=PR_FALSE;
}
return result;
}
static int GetSynonymousGroups(eHTMLTags aTag);

Просмотреть файл

@ -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
* </P> is encountered by itself (<P>) is continuously produced.
*
**************************************************************************************/
if(MAX_REFLOW_DEPTH<mBodyContext->GetCount()) {
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;
}

Просмотреть файл

@ -2025,6 +2025,20 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
}
}
else if(gHTMLElements[mTagID].IsTableElement()) {
//This fixes 57378...
//example: <TABLE><THEAD><TR><TH></THEAD> which didn't close the <THEAD>
PRInt32 theLastTable=aContext.LastOf(eHTMLTag_table);
PRInt32 theLastOfMe=aContext.LastOf(mTagID);
if(theLastTable<theLastOfMe) {
return mTagID;
}
}
return result;
}

Просмотреть файл

@ -147,6 +147,28 @@ struct nsHTMLElement {
return PR_FALSE;
}
inline PRBool IsTableElement(void) { //return yes if it's a table or child of a table...
PRBool result=PR_FALSE;
switch(mTagID) {
case eHTMLTag_table:
case eHTMLTag_thead:
case eHTMLTag_tbody:
case eHTMLTag_tfoot:
case eHTMLTag_caption:
case eHTMLTag_tr:
case eHTMLTag_td:
case eHTMLTag_th:
case eHTMLTag_col:
case eHTMLTag_colgroup:
result=PR_TRUE;
break;
default:
result=PR_FALSE;
}
return result;
}
static int GetSynonymousGroups(eHTMLTags aTag);