+ *
+ *
+ *
+ *
+ * In this case, the bottom is "gated" from closing the bottommost
+ * table.
+ *
+ * HOW THIS CODE WORKS:
+ *
+ * This block of code compares all the members of the default parent
+ * hierarchy for the childtag against the open containers on our stack.
+ * If they ever match, then the given child should be gated.
+ ***************************************************************************/
+
+ int theIndex;
+ int theTopIndex=mContextStack.mCount-1;
+
+ eHTMLTags theParent=GetDefaultParentTagFor(aChildTag);
+ while(eHTMLTag_unknown!=theParent) {
+ for(theIndex=theTopIndex;theIndex>tagPos;theIndex--){
+ if(mContextStack.mTags[theIndex]==theParent){
+ theGatePos=theIndex;
+ break;
+ }
+ }
+ theParent=GetDefaultParentTagFor(theParent);
+ }
+ }
break;
-
- /*
- eHTMLTag_table
- eHTMLTag_tbody
- eHTMLTag_thead
- eHTMLTag_tfoot
- eHTMLTag_caption
- eHTMLTag_col
- eHTMLTag_colgroup
- */
default:
break;
@@ -2809,11 +2849,12 @@ nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
//now, build up the stack according to the tags
//you have that aren't in the stack...
+ static CStartToken theToken(gEmpty);
if(PR_TRUE==bResult){
while(kPropagationStack.mCount>0) {
eHTMLTags theTag=kPropagationStack.Pop();
- CToken* theToken=gTokenRecycler.CreateTokenOfType(eToken_start,theTag,gEmpty);
- HandleStartToken(theToken);
+ theToken.SetTypeID(theTag); //open the container...
+ HandleStartToken(&theToken);
}
result=NS_OK;
}
diff --git a/htmlparser/src/CNavDTD.h b/htmlparser/src/CNavDTD.h
index 56cd98f355d1..087abf640e39 100644
--- a/htmlparser/src/CNavDTD.h
+++ b/htmlparser/src/CNavDTD.h
@@ -306,6 +306,17 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
*/
virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
+ /**
+ * This method is called to determine whether or not a tag
+ * of one type can contain a tag of another type.
+ *
+ * @update gess 3/25/98
+ * @param aParent -- int tag of parent container
+ * @param aChild -- int tag of child container
+ * @return PR_TRUE if parent can contain child
+ */
+ virtual PRBool CanPropagate(eHTMLTags aParent,eHTMLTags aChild) const;
+
/**
* This method is called to determine whether a tag
* of one of its children can contain a given child tag.
diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp
index a79928bb14e6..4019058278bb 100644
--- a/htmlparser/src/nsHTMLTokens.cpp
+++ b/htmlparser/src/nsHTMLTokens.cpp
@@ -1154,33 +1154,67 @@ PRInt32 CSkippedContentToken::GetTokenType(void) {
return eToken_skippedcontent;
}
-/*
- * Consume content until you find an end sequence that matches
+/*
+ * Consume content until you find an end sequence that matches
* this objects current mTextValue. Note that this is complicated
* by the fact that you can be parsing content that itself
* contains quoted content of the same type (like |