and get pushed onto
+ the RS stack for the , since it originated in the
.
+ ***************************************************************************/
+
+ if(theTagIsStyle) {
+ if(theChildStyleStack) {
+ theChildStyleStack->PushFront(theNode);
+ mBodyContext->PushStyles(theChildStyleStack);
}
+ else if (0==theNode->mUseCount) {
+ if(theTag!=aTarget) {
+ mBodyContext->PushStyle(theNode);
+ } //otherwise just let the node recycle, because it was explicty closed
+ //and does not live on a style stack.
+ }
+ else {
+ //Ah, at last, the final case. If you're here, then we just popped a
+ //style tag that got onto that tag stack from a stylestack somewhere.
+ //The the target==theTag, then pop it from the stylestack.
+ if(theTag==aTarget) {
+ nsIParserNode* theNextNode=mBodyContext->PopStyle(theTag);
+ }
+ }
+ }
+ else if(theChildStyleStack) {
+ mBodyContext->PushStyles(theChildStyleStack);
}
}
- }
+ } //if
else {
//since stylehandling is disabled, let's recycle the associated nodes here...
}
#endif
- RecycleNode(theNode);
- }
+ }//if
+ RecycleNode(theNode);
}
+
+ if(eParseMode_quirks==mParseMode) {
+
#ifdef ENABLE_RESIDUALSTYLE
- //This code takes any nodes in style stack for at this level and reopens
- //then where they were originally.
+ //This code takes any nodes in style stack for at this level and reopens
+ //then where they were originally.
- if(!aClosedByStartTag) {
- nsEntryStack* theStack=mBodyContext->GetStylesAt(anIndex-1);
- if(theStack){
+ if(!aClosedByStartTag) {
+ nsEntryStack* theStack=mBodyContext->GetStylesAt(anIndex-1);
+ if(theStack){
- PRUint32 scount=theStack->mCount;
- PRUint32 sindex=0;
+ PRUint32 scount=theStack->mCount;
+ PRUint32 sindex=0;
- for(sindex=0;sindexNodeAt(sindex);
- if(theNode) {
- ((nsCParserNode*)theNode)->mUseCount--;
- result=OpenContainer(theNode,(eHTMLTags)theNode->GetNodeType(),PR_FALSE);
- }
- }
- theStack->mCount=0;
+ for(sindex=0;sindexNodeAt(sindex);
+ if(theNode) {
+ ((nsCParserNode*)theNode)->mUseCount--;
+ result=OpenContainer(theNode,(eHTMLTags)theNode->GetNodeType(),PR_FALSE);
+ }
+ }
+ theStack->mCount=0;
+ } //if
} //if
- } //if
#endif
+ }//if
} //if
return result;
diff --git a/mozilla/parser/htmlparser/src/CNavDTD.h b/mozilla/parser/htmlparser/src/CNavDTD.h
index 0ac0e39d7c9..ef1050fd413 100644
--- a/mozilla/parser/htmlparser/src/CNavDTD.h
+++ b/mozilla/parser/htmlparser/src/CNavDTD.h
@@ -448,7 +448,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
nsresult OpenForm(const nsIParserNode *aNode);
nsresult OpenMap(const nsIParserNode *aNode);
nsresult OpenFrameset(const nsIParserNode *aNode);
- nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,PRInt32 aResidualStyleLevel=-1);
+ nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,nsEntryStack* aStyleStack=0);
/**
* The next set of methods close the given HTML element.
diff --git a/mozilla/parser/htmlparser/src/COtherDTD.cpp b/mozilla/parser/htmlparser/src/COtherDTD.cpp
index cd656990ee3..224f7d8471f 100644
--- a/mozilla/parser/htmlparser/src/COtherDTD.cpp
+++ b/mozilla/parser/htmlparser/src/COtherDTD.cpp
@@ -534,8 +534,8 @@ nsresult COtherDTD::CloseFrameset(const nsIParserNode *aNode){
* @param aNode -- next node to be added to model
* @return TRUE if ok, FALSE if error
*/
-nsresult COtherDTD::OpenContainer(const nsIParserNode *aNode,eHTMLTags aTarget,PRBool aUpdateStyleStack,PRInt32 aResidualStyleLevel){
- return CNavDTD::OpenContainer(aNode,aTarget,aUpdateStyleStack,aResidualStyleLevel);
+nsresult COtherDTD::OpenContainer(const nsIParserNode *aNode,eHTMLTags aTarget,PRBool aUpdateStyleStack,nsEntryStack* aStyleStack){
+ return CNavDTD::OpenContainer(aNode,aTarget,aUpdateStyleStack,aStyleStack);
}
/**
diff --git a/mozilla/parser/htmlparser/src/COtherDTD.h b/mozilla/parser/htmlparser/src/COtherDTD.h
index fd1bc877f7c..558db944872 100644
--- a/mozilla/parser/htmlparser/src/COtherDTD.h
+++ b/mozilla/parser/htmlparser/src/COtherDTD.h
@@ -233,7 +233,7 @@ private:
nsresult OpenForm(const nsIParserNode *aNode);
nsresult OpenMap(const nsIParserNode *aNode);
nsresult OpenFrameset(const nsIParserNode *aNode);
- nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aUpdateStyleStack,PRInt32 aResidualStyleLevel=-1);
+ nsresult OpenContainer(const nsIParserNode *aNode,eHTMLTags aTag,PRBool aUpdateStyleStack,nsEntryStack* aStyleStack=0);
/**
* The next set of methods close the given HTML element.
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
index ab74d17a48a..459db6744df 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
@@ -34,7 +34,18 @@ MOZ_DECL_CTOR_COUNTER(nsDTDContext);
MOZ_DECL_CTOR_COUNTER(CTokenRecycler);
MOZ_DECL_CTOR_COUNTER(CObserverService);
+/**************************************************************************************
+ A few notes about how residual style handling is performed:
+
+ 1. The style stack contains nsTagEntry elements.
+ 2. Every tag on the containment stack can have it's own residual style stack.
+ 3. When a style leaks, it's mParent member is set to the level on the stack where
+ it originated. A node with an mParent of 0 is not opened on tag stack,
+ but is open on stylestack.
+ 4. An easy way to tell that a container on the element stack is a residual style tag
+ is that it's use count is >1.
+ **************************************************************************************/
/**
* Default constructor
@@ -117,7 +128,7 @@ void nsEntryStack::EnsureCapacityFor(PRInt32 aNewMax,PRInt32 aShiftOffset) {
*
* @update gess 04/22/99
*/
-void nsEntryStack::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel) {
+void nsEntryStack::Push(const nsIParserNode* aNode,nsEntryStack* aStyleStack) {
if(aNode) {
EnsureCapacityFor(mCount+1);
@@ -127,8 +138,7 @@ void nsEntryStack::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel)
mEntries[mCount].mTag=(eHTMLTags)aNode->GetNodeType();
mEntries[mCount].mNode=(nsIParserNode*)aNode;
- mEntries[mCount].mLevel=aResidualStyleLevel;
- mEntries[mCount].mParent=0;
+ mEntries[mCount].mParent=aStyleStack;
mEntries[mCount++].mStyles=0;
}
}
@@ -139,7 +149,7 @@ void nsEntryStack::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel)
*
* @update gess 11/10/99
*/
-void nsEntryStack::PushFront(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel) {
+void nsEntryStack::PushFront(const nsIParserNode* aNode,nsEntryStack* aStyleStack) {
if(aNode) {
if(mCountGetNodeType();
mEntries[0].mNode=(nsIParserNode*)aNode;
- mEntries[0].mLevel=aResidualStyleLevel;
- mEntries[0].mParent=0;
+ mEntries[0].mParent=aStyleStack;
mEntries[0].mStyles=0;
mCount++;
}
@@ -177,7 +186,7 @@ void nsEntryStack::Append(nsEntryStack *aStack) {
PRInt32 theIndex=0;
for(theIndex=0;theIndexmEntries[theIndex];
- mEntries[mCount++].mLevel=-1;
+ mEntries[mCount++].mParent=0;
}
}
}
@@ -190,7 +199,7 @@ void nsEntryStack::Append(nsEntryStack *aStack) {
*/
nsIParserNode* nsEntryStack::Pop(void) {
- nsIParserNode *result=0;
+ nsIParserNode* result=0;
if(0mToken->mUseCount--;
mEntries[mCount].mNode=0;
mEntries[mCount].mStyles=0;
+
+ nsEntryStack* theStyleStack=mEntries[mCount].mParent;
+
+ if(theStyleStack) {
+ //now we have to tell the residual style stack where this tag
+ //originated that it's no longer in use.
+ PRUint32 scount=theStyleStack->mCount;
+ PRUint32 sindex=0;
+
+ nsTagEntry *theStyleEntry=theStyleStack->mEntries;
+ for(sindex=scount-1;sindex>=0;sindex--){
+ if(theStyleEntry->mTag==mEntries[mCount].mTag) {
+ theStyleEntry->mParent=0; //this tells us that the style is not open at any level
+ break;
+ }
+ theStyleEntry++;
+ } //for
+ }
}
return result;
}
@@ -358,7 +385,7 @@ PRInt32 nsDTDContext::GetTopmostIndexOf(eHTMLTags aTag) const {
*
* @update gess7/9/98
*/
-void nsDTDContext::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel) {
+void nsDTDContext::Push(const nsIParserNode* aNode,nsEntryStack* aStyleStack) {
if(aNode) {
#ifdef NS_DEBUG
@@ -367,7 +394,7 @@ void nsDTDContext::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel)
if(size< eMaxTags)
mXTags[size]=theTag;
#endif
- mStack.Push((nsIParserNode*)aNode,aResidualStyleLevel);
+ mStack.Push((nsIParserNode*)aNode,aStyleStack);
}
}
@@ -375,10 +402,10 @@ void nsDTDContext::Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel)
* @update gess 11/11/99,
* harishd 04/04/99
*/
-nsIParserNode* nsDTDContext::Pop(nsEntryStack *&aStack) {
+nsIParserNode* nsDTDContext::Pop(nsEntryStack *&aChildStyleStack) {
- PRInt32 theSize=mStack.mCount;
- nsIParserNode *result=0;
+ PRInt32 theSize=mStack.mCount;
+ nsIParserNode* result=0;
if(0mStyles;
+ aChildStyleStack=theEntry->mStyles;
}
result=mStack.Pop();
+ theEntry->mParent=0;
}
return result;
@@ -457,10 +485,6 @@ void nsDTDContext::PushStyle(const nsIParserNode* aNode){
}
if(theStack) {
theStack->Push(aNode);
- theEntry=&theStack->mEntries[theStack->mCount-1];
- if(theEntry) {
- theEntry->mParent=theStack;
- }
}
} //if
}
@@ -480,6 +504,16 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){
nsEntryStack* theStyles=theEntry->mStyles;
if(!theStyles) {
theEntry->mStyles=aStyles;
+
+ PRUint32 scount=aStyles->mCount;
+ PRUint32 sindex=0;
+
+ nsTagEntry *theEntry=aStyles->mEntries;
+ for(sindex=0;sindexmParent=0; //this tells us that the style is not open at any level
+ theEntry++;
+ } //for
+
}
else theStyles->Append(aStyles);
} //if
@@ -492,15 +526,13 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){
* @update gess 04/28/99
*/
nsIParserNode* nsDTDContext::PopStyle(void){
- nsIParserNode* result=0;
+ nsIParserNode *result=0;
nsTagEntry *theEntry=mStack.EntryAt(mStack.mCount-1);
if(theEntry && (theEntry->mNode)) {
- if(kNotFoundmLevel){
- nsEntryStack *theStack=mStack.mEntries[theEntry->mLevel].mStyles;
- if(theStack) {
- result=theStack->Pop();
- }
+ nsEntryStack* theStyleStack=theEntry->mParent;
+ if(theStyleStack){
+ result=theStyleStack->Pop();
}
} //if
return result;
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.h b/mozilla/parser/htmlparser/src/nsDTDUtils.h
index 1a37dcc7e40..e8b1700f2c7 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.h
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.h
@@ -75,7 +75,6 @@ class nsEntryStack; //forware declare to make compilers happy.
struct nsTagEntry {
eHTMLTags mTag; //for speedier access to tag id
nsIParserNode* mNode;
- PRInt32 mLevel;
nsEntryStack* mParent;
nsEntryStack* mStyles;
};
@@ -86,8 +85,8 @@ public:
~nsEntryStack();
void EnsureCapacityFor(PRInt32 aNewMax, PRInt32 aShiftOffset=0);
- void Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel=-1);
- void PushFront(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel=-1);
+ void Push(const nsIParserNode* aNode,nsEntryStack* aStyleStack=0);
+ void PushFront(const nsIParserNode* aNode,nsEntryStack* aStyleStack=0);
void Append(nsEntryStack *theStack);
nsIParserNode* Pop(void);
nsIParserNode* NodeAt(PRInt32 anIndex) const;
@@ -132,8 +131,8 @@ public:
nsDTDContext();
~nsDTDContext();
- void Push(const nsIParserNode* aNode,PRInt32 aResidualStyleLevel=-1);
- nsIParserNode* Pop(nsEntryStack*& aStack);
+ void Push(const nsIParserNode* aNode,nsEntryStack* aStyleStack=0);
+ nsIParserNode* Pop(nsEntryStack*& aChildStack);
eHTMLTags First(void) const;
eHTMLTags Last(void) const;
eHTMLTags TagAt(PRInt32 anIndex) const;
diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp
index 526e45e652e..cea8c7f7d6a 100644
--- a/mozilla/parser/htmlparser/src/nsElementTable.cpp
+++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp
@@ -193,15 +193,11 @@ TagList gDontAutoClose={1,{eHTMLTag_td}};
//*********************************************************************************************
-#define FSTYPE kInlineEntity
-#define SPECIALTYPE kInlineEntity
-
const int kNoPropRange=0;
const int kDefaultPropRange=1;
const int kBodyPropRange=2;
-
//*********************************************************************************************
//
// Now let's dynamically build the element table...
@@ -213,19 +209,19 @@ nsHTMLElement* gHTMLElements=0;
void Initialize(eHTMLTags aTag,
eHTMLTags aRequiredAncestor,
eHTMLTags aExcludingAncestor,
- TagList* aRootNodes,
- TagList* aEndRootNodes,
- TagList* aAutocloseStart,
- TagList* aAutocloseEnd,
- TagList* aSynonymousTags,
- TagList* aDontAutocloseEnd,
+ TagList* aRootNodes,
+ TagList* aEndRootNodes,
+ TagList* aAutocloseStart,
+ TagList* aAutocloseEnd,
+ TagList* aSynonymousTags,
+ TagList* aDontAutocloseEnd,
int aParentBits,
int aInclusionBits,
int aExclusionBits,
int aSpecialProperties,
int aPropagateRange,
- TagList* aSpecialParents,
- TagList* aSpecialKids,
+ TagList* aSpecialParents,
+ TagList* aSpecialKids,
eHTMLTags aSkipTarget
)
{
@@ -273,7 +269,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, SPECIALTYPE|kBlockEntity, kNone,
+ /*parent,incl,exclgroups*/ kSpecial, kInlineEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -309,7 +305,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE|kFlowEntity), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInlineEntity|kFlowEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown);
@@ -327,7 +323,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (FSTYPE|kSelf), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kInlineEntity|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -345,7 +341,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, SPECIALTYPE, kNone,
+ /*parent,incl,exclgroups*/ kSpecial, kInlineEntity, kNone,
/*special props, prop-range*/ kNonContainer, kNoPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -354,7 +350,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -372,7 +368,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (FSTYPE|kSelf), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kInlineEntity|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -579,7 +575,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial|kFontStyle, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial|kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gFontKids,eHTMLTag_unknown);
@@ -697,7 +693,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0, kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -814,7 +810,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gLIRootTags,&gLIRootTags,
/*autoclose starttags and endtags*/ &gLIAutoClose,0,0,0,
- /*parent,incl,exclgroups*/ kFlowEntity, kFlowEntity, kSelf,
+ /*parent,incl,exclgroups*/ kBlockEntity, kFlowEntity, kSelf,
/*special props, prop-range*/ kNoPropagate, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gLIKids,eHTMLTag_unknown);
@@ -841,7 +837,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, SPECIALTYPE|kBlockEntity, kNone,
+ /*parent,incl,exclgroups*/ kSpecial, kInlineEntity|kBlockEntity, kNone,
/*special props, prop-range*/ kOmitWS, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gMapKids,eHTMLTag_unknown);
@@ -922,7 +918,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (kFlowEntity|SPECIALTYPE|kSelf), kNone,
+ /*parent,incl,exclgroups*/ (kHeadMisc|kSpecial), (kFlowEntity|kInlineEntity|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown);
@@ -1003,7 +999,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1012,7 +1008,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1057,7 +1053,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1106,7 +1102,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1135,7 +1131,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1145,7 +1141,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kSpecial, (kSelf|SPECIALTYPE), kNone,
+ /*parent,incl,exclgroups*/ kSpecial, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1235,7 +1231,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1244,7 +1240,7 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
- /*parent,incl,exclgroups*/ kFontStyle, (kSelf|FSTYPE), kNone,
+ /*parent,incl,exclgroups*/ kFontStyle, (kSelf|kInlineEntity), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
@@ -1681,33 +1677,34 @@ PRBool nsHTMLElement::IsStyleTag(eHTMLTags aChild) {
PRBool result=PR_FALSE;
switch(aChild) {
case eHTMLTag_a:
- case eHTMLTag_acronym:
+// case eHTMLTag_abbr:
+// case eHTMLTag_acronym:
case eHTMLTag_b:
case eHTMLTag_bdo:
case eHTMLTag_big:
case eHTMLTag_blink:
- case eHTMLTag_center:
- case eHTMLTag_cite:
- case eHTMLTag_code:
+// case eHTMLTag_center:
+// case eHTMLTag_cite:
+// case eHTMLTag_code:
case eHTMLTag_del:
- case eHTMLTag_dfn:
- case eHTMLTag_em:
+// case eHTMLTag_dfn:
+// case eHTMLTag_em:
case eHTMLTag_font:
case eHTMLTag_i:
case eHTMLTag_ins:
- case eHTMLTag_kbd:
+// case eHTMLTag_kbd:
case eHTMLTag_q:
case eHTMLTag_s:
- case eHTMLTag_samp:
+// case eHTMLTag_samp:
case eHTMLTag_small:
case eHTMLTag_span:
case eHTMLTag_strike:
- case eHTMLTag_strong:
+// case eHTMLTag_strong:
case eHTMLTag_sub:
case eHTMLTag_sup:
case eHTMLTag_tt:
case eHTMLTag_u:
- case eHTMLTag_var:
+// case eHTMLTag_var:
result=PR_TRUE;
default:
break;
@@ -1811,7 +1808,7 @@ PRBool nsHTMLElement::CanContainSelf(void) const {
PRBool nsHTMLElement::CanAutoCloseTag(eHTMLTags aTag) const{
PRBool result=PR_TRUE;
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)) {
- TagList* theTagList=gHTMLElements[mTagID].GetNonAutoCloseEndTags();
+ TagList* theTagList=gHTMLElements[mTagID].mDontAutocloseEnd;
if(theTagList) {
result=!FindTagInSet(aTag,theTagList->mTags,theTagList->mCount);
}
@@ -1912,6 +1909,11 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{
return PR_FALSE;
}
+ if(nsHTMLElement::IsBlockEntity(aChild)){
+ if(nsHTMLElement::IsBlockParent(mTagID)){
+ return PR_TRUE;
+ }
+ }
if(nsHTMLElement::IsInlineEntity(aChild)){
if(nsHTMLElement::IsInlineParent(mTagID)){
@@ -1931,12 +1933,6 @@ PRBool nsHTMLElement::CanContain(eHTMLTags aChild) const{
}
}
- if(nsHTMLElement::IsBlockEntity(aChild)){
- if(nsHTMLElement::IsBlockParent(mTagID) || IsStyleTag(mTagID)){
- return PR_TRUE;
- }
- }
-
if(CanContainType(gHTMLElements[aChild].mParentBits)) {
return PR_TRUE;
}
diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h
index 095aad35959..934bcd71a55 100644
--- a/mozilla/parser/htmlparser/src/nsElementTable.h
+++ b/mozilla/parser/htmlparser/src/nsElementTable.h
@@ -73,7 +73,6 @@ struct nsHTMLElement {
TagList* GetEndRootTags(void) const {return mEndRootNodes;}
TagList* GetAutoCloseStartTags(void) const {return mAutocloseStart;}
TagList* GetAutoCloseEndTags(void) const {return mAutocloseEnd;}
- TagList* GetNonAutoCloseEndTags(void) const {return mDontAutocloseEnd;}
eHTMLTags GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32 anIndex) const;
TagList* GetSpecialChildren(void) const {return mSpecialKids;}
@@ -114,7 +113,7 @@ struct nsHTMLElement {
TagList* mAutocloseStart; //these are the start tags that you can automatically close with this START tag
TagList* mAutocloseEnd; //these are the start tags that you can automatically close with this END tag
TagList* mSynonymousTags; //These are morally equivalent; an end tag for one can close a start tag for another (like )
- TagList* mDontAutocloseEnd; //these are the end tags that you cannot automatically close with this END tag
+ TagList* mDontAutocloseEnd; //...
int mParentBits; //defines groups that can contain this element
int mInclusionBits; //defines parental and containment rules
int mExclusionBits; //defines things you CANNOT contain
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
index 98fdcc68f04..dfc0558a044 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
@@ -359,8 +359,9 @@ nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner&
PRUnichar theNextChar;
result=aScanner.Peek(theNextChar);
if(NS_OK==result) {
- if(theNextChar==kMinus)
+ if((kMinus==theNextChar) || (kGreaterThan==theNextChar)) {
result=ConsumeComment(aChar,aToken,aScanner);
+ }
else
result=ConsumeSpecialMarkup(aChar,aToken,aScanner);
}
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
index 88dccf4c3a8..53f21540120 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -770,8 +770,10 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
}//if
}//while
if(NS_OK==result) {
- //if you're here, we're consuming a "short-form" comment
- result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE);
+ //Read up to the closing '>', unless you already did! (such as ).
+ if(kGreaterThan!=aChar) {
+ result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE);
+ }
}
return result;
}
@@ -864,8 +866,10 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
}//if
}//if
if(NS_OK==result) {
- //Read up to the closing '>'
- result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE);
+ //Read up to the closing '>', unless you already did! (such as ).
+ if(kGreaterThan!=aChar) {
+ result=aScanner.ReadUntil(aString,kGreaterThan,PR_TRUE);
+ }
}
return result;
}
diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index e11e22bd4a3..b200d350b63 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -926,7 +926,12 @@ nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITag
}
theContext.Append(""); //XXXHack! I'll make this better later.
nsAutoString theBuffer(theContext);
+
+#if 0
theBuffer.Append(aSourceBuffer);
+#else
+ theBuffer.Append("text");
+#endif
if(theBuffer.Length()){
//now it's time to try to build the model from this fragment
diff --git a/mozilla/parser/htmlparser/src/nsParserNode.cpp b/mozilla/parser/htmlparser/src/nsParserNode.cpp
index 3d8028284f0..c06b1e3d6e7 100644
--- a/mozilla/parser/htmlparser/src/nsParserNode.cpp
+++ b/mozilla/parser/htmlparser/src/nsParserNode.cpp
@@ -57,7 +57,6 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
mToken=aToken;
mRecycler=aRecycler;
mUseCount=0;
- mIsResidual=PR_FALSE;
}
static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) {
@@ -111,7 +110,6 @@ nsresult nsCParserNode::Init(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
RecycleTokens(mRecycler,*mAttributes);
mToken=aToken;
mUseCount=0;
- mIsResidual=PR_FALSE;
mSkippedContent.Truncate();
return NS_OK;
}
diff --git a/mozilla/parser/htmlparser/src/nsParserNode.h b/mozilla/parser/htmlparser/src/nsParserNode.h
index 698a2c592ee..d552af1613d 100644
--- a/mozilla/parser/htmlparser/src/nsParserNode.h
+++ b/mozilla/parser/htmlparser/src/nsParserNode.h
@@ -179,7 +179,6 @@ class nsCParserNode : public nsIParserNode {
nsDeque* mAttributes;
nsAutoString mSkippedContent;
PRInt32 mUseCount;
- PRBool mIsResidual;
nsITokenRecycler* mRecycler;
};
diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp
index 26eebc81511..9f9b427d4a1 100644
--- a/mozilla/parser/htmlparser/src/nsScanner.cpp
+++ b/mozilla/parser/htmlparser/src/nsScanner.cpp
@@ -323,7 +323,7 @@ PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
*/
PRBool nsScanner::Append(const PRUnichar* aBuffer, PRUint32 aLen){
- if(-1==aLen)
+ if(-1==(PRInt32)aLen)
aLen=nsCRT::strlen(aBuffer);
CBufDescriptor theDesc(aBuffer,PR_TRUE, aLen+1,aLen);