backing out rickg's htmlparser changes (backing out fixes 56265 for two

independent developers).


git-svn-id: svn://10.0.0.236/trunk@81034 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
leaf%mozilla.org
2000-10-12 18:22:15 +00:00
parent db86f25730
commit 2f29f2439c
12 changed files with 142 additions and 238 deletions

View File

@@ -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(0<theCount){
PRBool result=PR_TRUE;
if(aContext.GetCount()){
TagList* theRootTags=gHTMLElements[aChildTag].GetRootTags();
TagList* theSpecialParents=gHTMLElements[aChildTag].GetSpecialParents();
if(theRootTags) {
PRInt32 theRootIndex=LastOf(aContext,*theRootTags);
PRInt32 theSPIndex=(theSpecialParents) ? LastOf(aContext,*theSpecialParents) : kNotFound;
PRInt32 theChildIndex=GetIndexOfChildOrSynonym(aContext,aChildTag);
PRInt32 theTargetIndex=(theRootIndex>theSPIndex) ? 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(theChildIndex<theIndex) {
eHTMLTags theParentTag=aContext.TagAt(theIndex--);
if (gHTMLElements[theParentTag].IsMemberOf(kBlockEntity) ||
gHTMLElements[theParentTag].IsMemberOf(kHeading) ||
gHTMLElements[theParentTag].IsMemberOf(kPreformatted) ||
gHTMLElements[theParentTag].IsMemberOf(kList)) {
if(!HasOptionalEndTag(theParentTag)) {
result=PR_TRUE;
break;
}
}
}
}
else result=PRBool(theBaseIndex>theChildIndex);
}
}
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_DEPTH<mBodyContext->GetCount()) {
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<theChildIndex) {
if((thePrevTag==aContext[theChildIndex]) ||
(eHTMLTag_noscript==aCurrentTag)){ //bug 54571
if(thePrevTag==aContext[theChildIndex]){
return aContext[theChildIndex];
}