bug 294685: Remove unnecessary DEBUG-only counter/named entity code. r=jst sr=dbaron a=shaver

git-svn-id: svn://10.0.0.236/trunk@173993 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2005-06-01 22:23:13 +00:00
parent 6f39bbf718
commit 53d12e81d1
7 changed files with 14 additions and 724 deletions

View File

@@ -87,7 +87,6 @@ HTML_TAG(cite, Span)
HTML_TAG(code, Span)
HTML_TAG(col, TableCol)
HTML_TAG(colgroup, TableCol)
HTML_TAG(counter, Span)
HTML_TAG(dd, Span)
HTML_TAG(del, Mod)
HTML_TAG(dfn, Span)

View File

@@ -346,10 +346,6 @@ nsresult CNavDTD::WillBuildModel(const CParserContext& aParserContext,
if(!aParserContext.mPrevContext && aSink) {
#ifdef DEBUG
mBodyContext->ResetCounters();
#endif
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
@@ -1063,52 +1059,6 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
}
break;
}
#ifdef DEBUG
case eHTMLTag_counter:
{
PRInt32 theCount=mBodyContext->GetCount();
eHTMLTags theGrandParentTag=mBodyContext->TagAt(theCount-1);
nsAutoString theNumber;
mBodyContext->IncrementCounter(theGrandParentTag,aNode,theNumber);
CTextToken theToken(theNumber);
nsCParserNode theNode(&theToken, 0 /*stack token*/);
result=mSink->AddLeaf(theNode);
}
break;
case eHTMLTag_meta:
{
//we should only enable user-defined entities in debug builds...
PRInt32 theCount=aNode.GetAttributeCount();
const nsAString* theNamePtr=0;
const nsAString* theValuePtr=0;
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;++theIndex){
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.LowerCaseEqualsLiteral("entity")) {
const nsAString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(theKey.LowerCaseEqualsLiteral("value")) {
//store the named enity with the context...
const nsAString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;
}
}
}
if(theNamePtr && theValuePtr) {
mBodyContext->RegisterEntity(*theNamePtr,*theValuePtr);
}
}
break;
#endif
default:
break;
}//switch
@@ -2139,24 +2089,15 @@ nsresult CNavDTD::HandleEntityToken(CToken* aToken) {
const nsSubstring& theStr = aToken->GetStringValue();
if((kHashsign!=theStr.First()) && (-1==nsHTMLEntities::EntityToUnicode(theStr))){
//if you're here we have a bogus entity.
//convert it into a text token.
CToken *theToken=0;
#ifdef DEBUG
//before we just toss this away as a bogus entity, let's check...
CNamedEntity *theEntity=mBodyContext->GetEntity(theStr);
if(theEntity) {
theToken = NS_STATIC_CAST(CTextToken*,mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,theEntity->mValue));
}
else {
#endif
//if you're here we have a bogus entity.
//convert it into a text token.
nsAutoString entityName;
entityName.AssignLiteral("&");
entityName.Append(theStr); //should append the entity name; fix bug 51161.
theToken = mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,entityName);
#ifdef DEBUG
}
#endif
nsAutoString entityName;
entityName.AssignLiteral("&");
entityName.Append(theStr); //should append the entity name; fix bug 51161.
theToken = mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,entityName);
return HandleToken(theToken,mParser); //theToken should get recycled automagically...
}
@@ -3311,9 +3252,6 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,
}
break;
case eHTMLTag_counter: //drop it on the floor.
break;
case eHTMLTag_style:
case eHTMLTag_title:
break;

View File

@@ -318,10 +318,6 @@ nsresult COtherDTD::WillBuildModel(const CParserContext& aParserContext,
if(result==NS_OK) {
result = aSink->WillBuildModel();
#ifdef DEBUG
mBodyContext->ResetCounters();
#endif
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: COtherDTD::WillBuildModel(), this=%p\n", this));
START_TIMER();
@@ -554,37 +550,6 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
}
break;
#ifdef DEBUG
case eHTMLTag_meta:
{
//we should only enable user-defined entities in debug builds...
PRInt32 theCount=aNode.GetAttributeCount();
const nsAString* theNamePtr=0;
const nsAString* theValuePtr=0;
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;++theIndex){
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.LowerCaseEqualsLiteral("entity")) {
const nsAString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(theKey.LowerCaseEqualsLiteral("value")) {
//store the named enity with the context...
const nsAString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;
}
}
}
if(theNamePtr && theValuePtr) {
mBodyContext->RegisterEntity(*theNamePtr,*theValuePtr);
}
}
break;
#endif
default:
break;
}//switch
@@ -800,24 +765,12 @@ nsresult COtherDTD::HandleEntityToken(CToken* aToken) {
CToken *theToken=0;
if((kHashsign!=theChar) && (-1==nsHTMLEntities::EntityToUnicode(theStr))){
#ifdef DEBUG
//before we just toss this away as a bogus entity, let's check...
CNamedEntity *theEntity=mBodyContext->GetEntity(theStr);
if(theEntity) {
theToken=(CTextToken*)mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,theEntity->mValue);
}
else {
#endif
//if you're here we have a bogus entity.
//convert it into a text token.
nsAutoString entityName;
entityName.AssignLiteral("&");
entityName.Append(theStr); //should append the entity name; fix bug 51161.
theToken=(CTextToken*)mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,entityName);
#ifdef DEBUG
}
#endif
//if you're here we have a bogus entity.
//convert it into a text token.
nsAutoString entityName;
entityName.AssignLiteral("&");
entityName.Append(theStr); //should append the entity name; fix bug 51161.
theToken=(CTextToken*)mTokenAllocator->CreateTokenOfType(eToken_text,eHTMLTag_text,entityName);
result=HandleStartToken(theToken);
}
else {

View File

@@ -982,66 +982,6 @@ public:
};
/**********************************************************
This defines the counter element, and is for debug use.
Usage: <counter name="xxx" reset=n>
if you leave off the name key/value pair, we'll use the
name of the element instead.
**********************************************************/
class CCounterElement: public CInlineElement {
public:
CCounterElement(eHTMLTags aTag=eHTMLTag_counter) : CInlineElement(aTag) {
CInlineElement::Initialize(*this,aTag);
mProperties.mIsSinkContainer=PR_FALSE;
}
/**********************************************************
handles the opening of it's own children
**********************************************************/
virtual nsresult HandleStartToken( nsCParserNode* aNode,
eHTMLTags aTag,
nsDTDContext* aContext,
nsIHTMLContentSink* aSink) {
return CElement::HandleStartToken(aNode,aTag,aContext,aSink);
}
/**********************************************************
this gets called after each tag is opened in the given context
**********************************************************/
virtual nsresult OpenContext(nsCParserNode *aNode,eHTMLTags aTag,nsDTDContext *aContext,nsIHTMLContentSink *aSink) {
CElement::OpenContext(aNode,aTag,aContext,aSink);
nsresult result=NS_OK;
PRInt32 theCount=aContext->GetCount();
nsCParserNode *theNode = (nsCParserNode*)aNode;
#ifdef DEBUG
eHTMLTags theGrandParentTag=aContext->TagAt(theCount-2);
nsAutoString theNumber;
aContext->IncrementCounter(theGrandParentTag,*theNode,theNumber);
CTextToken theToken(theNumber);
nsCParserNode theNewNode(&theToken, 0 /*stack token*/);
*theNode = theNewNode;
#endif
result=aSink->AddLeaf(*theNode);
return result;
}
/**********************************************************
handles the opening of it's own children
**********************************************************/
virtual nsresult HandleEndToken(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
return CElement::HandleEndToken(aNode,aTag,aContext,aSink);
}
};
/**********************************************************
This defines the heading element group (h1..h6)
**********************************************************/
@@ -2082,7 +2022,6 @@ public:
mAppletElement(eHTMLTag_applet),
mObjectElement(eHTMLTag_object),
mFieldsetElement(),
mCounterElement(),
mFormElement(),
mHeadElement(eHTMLTag_head)
{
@@ -2131,7 +2070,6 @@ public:
CAppletElement mAppletElement;
CAppletElement mObjectElement;
CFieldsetElement mFieldsetElement;
CCounterElement mCounterElement;
CFormElement mFormElement;
CHeadElement mHeadElement;
};
@@ -2224,8 +2162,6 @@ void CElementTable::InitializeElements() {
mDfltElements[eHTMLTag_colgroup].mContainsGroups.mAllBits=0;
mDfltElements[eHTMLTag_colgroup].mIncludeKids=kColgroupKids;
CElement::Initialize( mDfltElements[eHTMLTag_counter], eHTMLTag_counter);
CElement::Initialize( mDfltElements[eHTMLTag_dd], eHTMLTag_dd, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
mDfltElements[eHTMLTag_dd].mAutoClose=kAutoCloseDD;
mDfltElements[eHTMLTag_dd].mContainsGroups.mBits.mSelf=0;
@@ -2437,7 +2373,6 @@ void CElementTable::InitializeElements() {
mElements[eHTMLTag_applet]=&mAppletElement;
mElements[eHTMLTag_object]=&mObjectElement;
mElements[eHTMLTag_fieldset]=&mFieldsetElement;
mElements[eHTMLTag_counter]=&mCounterElement;
mElements[eHTMLTag_form]=&mFormElement;
mElements[eHTMLTag_head]=&mHeadElement;
}

View File

@@ -439,21 +439,9 @@ nsDTDContext::nsDTDContext() : mStack(), mEntities(0){
#ifdef DEBUG
memset(mXTags,0,sizeof(mXTags));
mCounters = 0;
#endif
}
#ifdef DEBUG
class CEntityDeallocator: public nsDequeFunctor{
public:
virtual void* operator()(void* anObject) {
CNamedEntity *theEntity=(CNamedEntity*)anObject;
delete theEntity;
return 0;
}
};
#endif
/**
*
* @update gess9/10/98
@@ -466,486 +454,9 @@ nsDTDContext::~nsDTDContext() {
CTableState *theState=mTableStates;
mTableStates=theState->mPrevious;
delete theState;
}
#ifdef DEBUG
CEntityDeallocator theDeallocator;
mEntities.ForEach(theDeallocator);
if(mCounters) {
delete [] mCounters;
mCounters = 0;
}
#endif
}
#ifdef DEBUG
CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
if (aName.Length() > 2) {
nsAString::const_iterator start, end;
aName.BeginReading(start);
aName.EndReading(end);
PRUnichar theChar=aName.Last();
// skip past leading and trailing quotes/etc
if(kQuote==*start) {
++start;
}
if(kSemicolon==theChar ||
kQuote == theChar) {
--end;
}
const nsAString& entityName = Substring(start, end);
PRInt32 theCount=mEntities.GetSize();
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;++theIndex) {
CNamedEntity *theResult=(CNamedEntity*)mEntities.ObjectAt(theIndex);
if(theResult &&
theResult->mName.Equals(entityName,
nsCaseInsensitiveStringComparator())) {
return theResult;
}
}
}
return 0;
}
CNamedEntity* nsDTDContext::RegisterEntity(const nsAString& aName,const nsAString& aValue) {
CNamedEntity *theEntity=GetEntity(aName);
if(!GetEntity(aName)){
theEntity=new CNamedEntity(aName,aValue);
mEntities.Push(theEntity);
}
return theEntity;
}
/****************************************************************
The abacus class is useful today for debug purposes, but it
will eventually serve as the implementation for css counters.
This implementation is fine for static documents, but woefully
inadequate for dynamic documents. (This about what happens if
someone inserts a new counter using the DOM? -- The other
numbers in that "group" should be renumbered.)
In order to be dynamic, we need a counter "group" manager that
is aware of layout (geometry at least) -- and that has a
mechanism for notifying markers that need to be updated, along
with the ability to cause incremental reflow to occur in a
localized context (so the counters display correctly).
****************************************************************/
class CAbacus {
public:
enum eNumFormat {eUnknown,eAlpha,eDecimal,eRoman,eSpelled,eHex,eBinary,eFootnote,eUserSeries};
CAbacus(PRInt32 aDefaultValue=0,eNumFormat aFormat=eDecimal) {
mUserSeries=0;
mFormat=aFormat;
mCase=PR_FALSE;
mValue=0;
mUserBase=0;
}
~CAbacus() {
}
void SetValue(int aStartValue) {mValue=aStartValue;}
void SetNumberingStyle(eNumFormat aFormat) {mFormat=aFormat;}
void SetUserSeries(const char* aSeries,int aUserBase) {mUserSeries=aSeries; mUserBase=aUserBase;}
void SetCase(PRBool alwaysUpper) {mCase=alwaysUpper;}
void GetNextValueAsString(nsString& aString) {
GetFormattedString(mFormat,mValue++,aString,mUserSeries,0,mUserBase);
}
void GetValueAsString(nsString& aString) {
GetFormattedString(mFormat,mValue,aString,mUserSeries,0,mUserBase);
}
/**
* Get a counter string in the given style for the given value.
*
* @update rickg 6June2000
*
* @param aFormat -- format of choice
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void GetFormattedString(eNumFormat aFormat,PRInt32 aValue, nsString& aString,const char* aCharSet, int anOffset, int aBase) {
switch (aFormat) {
case eDecimal: DecimalString(aValue,aString); break;
case eHex: HexString(aValue,aString); break;
case eBinary: BinaryString(aValue,aString); break;
case eAlpha: AlphaString(aValue,aString); break;
case eSpelled: SpelledString(aValue,aString); break;
case eRoman: RomanString(aValue,aString); break;
case eFootnote: FootnoteString(aValue,aString); break;
case eUserSeries: SeriesString(aValue,aString,aCharSet,anOffset,aBase); break;
default:
DecimalString(aValue,aString); break;
}
}
/**
* Compute a counter string in the casted-series style for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void SeriesString(PRInt32 aValue,nsString& aString,const char* aCharSet, int offset, int base) {
int ndex=0;
int root=1;
int next=base;
int expn=1;
aString.Truncate();
if(aValue<0)
aString.Append(PRUnichar('-'));
aValue=abs(aValue); // must be positive here...
while(next<=aValue) { // scale up in baseN; exceed current value.
root=next;
next*=base;
++expn;
}
while(expn--) {
ndex = ((root<=aValue) && (root)) ? (aValue/root): 0;
aValue%=root;
aString.Append(PRUnichar(aCharSet[ndex+((root>1)*offset)]));
root/=base;
}
}
/**
* Compute a counter string in the spelled style for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void SpelledString(PRInt32 aValue,nsString& aString) {
static char ones[][12]= {"zero","one ","two ","three ","four ","five ","six ","seven ","eight ","nine ","ten "};
static char teens[][12]= {"ten ","eleven ","twelve ","thirteen ","fourteen ","fifteen ","sixteen ","seventeen ","eighteen ","nineteen "};
static char tens[][12]= {"","ten ","twenty ","thirty ","fourty ","fifty ","sixty ","seventy ","eighty ","ninety ","hundred "};
static char bases[][20]= {"","hundred ","thousand ","million ","billion ","trillion ","quadrillion ","quintillion ","bajillion "};
aString.Truncate();
if(aValue<0)
aString.Append(PRUnichar('-'));
PRInt32 root=1000000000;
PRInt32 expn=4;
PRInt32 modu=0;
aValue=abs(aValue);
if(0<aValue) {
while(root && aValue) {
PRInt32 temp=aValue/root;
if(temp) {
PRInt32 theDiv=temp/100;
if (theDiv) {//start with hundreds part
aString.AppendWithConversion(ones[theDiv]);
aString.AppendWithConversion(bases[1]);
}
modu=(temp%10);
theDiv=(temp%100)/10;
if (theDiv) {
if (theDiv<2) {
aString.AppendWithConversion(teens[modu]);
modu=0;
}
else aString.AppendWithConversion(tens[theDiv]);
}
if (modu)
aString.AppendWithConversion(ones[modu]); //do remainder
aValue-=(temp*root);
if (expn>1)
aString.AppendWithConversion(bases[expn]);
}
expn--;
root/=1000;
}
}
else aString.AppendWithConversion(ones[0]);
}
/**
* Compute a counter string in the decimal format for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void DecimalString(PRInt32 aValue,nsString& aString) {
aString.Truncate();
aString.AppendInt(aValue);
}
/**
* Compute a counter string in binary format for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void BinaryString(PRInt32 aValue,nsString& aString) {
static char kBinarySet[]="01";
if (aValue<0)
aValue=65536-abs(aValue);
SeriesString(aValue,aString,kBinarySet,0,2);
}
/**
* Compute a counter string in hex format for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void HexString(PRInt32 aValue,nsString& aString) {
static char kHexSet[]="0123456789ABCDEF";
if (aValue<0)
aValue=65536-abs(aValue);
SeriesString(aValue,aString,kHexSet,0,16);
}
/**
* Compute a counter string in the roman style for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void RomanString(PRInt32 aValue,nsString& aString) {
static PRUnichar digitsA[] = { PRUnichar('i'),
PRUnichar('x'),
PRUnichar('c'),
PRUnichar('m') };
static PRUnichar digitsB[] = { PRUnichar('v'),
PRUnichar('l'),
PRUnichar('d'),
PRUnichar('?') };
aString.Truncate();
if(aValue<0)
aString.Append(PRUnichar('-'));
aValue=abs(aValue);
char decStr[20];
sprintf(decStr,"%d", aValue);
int len=strlen(decStr);
int romanPos=len;
int digitPos=0;
int n=0;
for(digitPos=0;digitPos<len;++digitPos) {
romanPos--;
switch(decStr[digitPos]) {
case '0': break;
case '3': aString.Append(digitsA[romanPos]);
case '2': aString.Append(digitsA[romanPos]);
case '1': aString.Append(digitsA[romanPos]);
break;
case '4': aString.Append(digitsA[romanPos]);
case '5': case '6':
case '7': case '8':
aString.Append(digitsB[romanPos]);
for(n=0;n<(decStr[digitPos]-'5');++n)
aString.Append(digitsA[romanPos]);
break;
case '9':
aString.Append(digitsA[romanPos]);
aString.Append(digitsA[romanPos]);
break;
}
}
}
/**
* Compute a counter string in the alpha style for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void AlphaString(PRInt32 aValue,nsString& aString) {
static const char kAlphaSet[]="abcdefghijklmnopqrstuvwxyz";
if (0<aValue)
SeriesString(aValue-1,aString,kAlphaSet,-1,26);
}
/**
* Compute a counter string in the footnote style for the given value.
*
* @update rickg 6June2000
*
* @param aValue -- cardinal value of string
* @param aString -- will hold result
*/
static void FootnoteString(PRInt32 aValue,nsString& aString) {
static char kFootnoteSet[]="abcdefg";
int seriesLen = strlen (kFootnoteSet) - 1;
int count=0;
int repCount=0;
int modChar=0;
aString.Truncate();
aValue=abs(aValue);
repCount=((aValue-1)/seriesLen);
modChar=aValue-(repCount*seriesLen);
for(count=0;count<=repCount;++count) {
aString.Append(PRUnichar(kFootnoteSet[modChar]));
}
}
protected:
const char* mUserSeries;
eNumFormat mFormat;
PRBool mCase;
PRInt32 mValue;
int mUserBase;
};
/**
*
* @update gess 11May2000
*/
void nsDTDContext::AllocateCounters(void) {
if(!mCounters) {
mCounters = new PRInt32 [NS_HTML_TAG_MAX]; //in addition to reseting, you may need to allocate.
ResetCounters();
}
}
/**
*
* @update gess 11May2000
*/
void nsDTDContext::ResetCounters(void) {
if(mCounters) {
memset(mCounters,0,NS_HTML_TAG_MAX*sizeof(PRInt32));
}
}
/**********************************************************
@update: rickg 17May2000
Call this to handle counter attributes:
name="group"
value="nnn"
noincr="?"
format="alpha|dec|footnote|hex|roman|spelled|talk"
returns the newly incremented value for the (determined) group.
**********************************************************/
PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsString& aResult) {
PRInt32 result=0;
PRInt32 theIndex=0;
PRInt32 theNewValue=-1; //-1 is interpreted to mean "don't reset the counter sequence.
PRInt32 theIncrValue=1; //this may get set to 0 if we see a "noincr" key.
PRInt32 theCount=aNode.GetAttributeCount();
CNamedEntity *theEntity=0;
CAbacus::eNumFormat theNumFormat=CAbacus::eDecimal;
for(theIndex=0;theIndex<theCount;++theIndex){
const nsAString& theKey=aNode.GetKeyAt(theIndex);
const nsAString& theValue=aNode.GetValueAt(theIndex);
if(theKey.LowerCaseEqualsLiteral("name")){
theEntity=GetEntity(theValue);
if(!theEntity) {
theEntity=RegisterEntity(theValue,theValue);
theEntity->mOrdinal=0;
}
aTag=eHTMLTag_userdefined;
}
else if(theKey.LowerCaseEqualsLiteral("noincr")){
theIncrValue=0;
}
else if(theKey.LowerCaseEqualsLiteral("format")){
nsAString::const_iterator start;
PRUnichar theChar=*theValue.BeginReading(start);
if('"'==theChar)
theChar=*(++start);
switch(theChar){
case 'A': case 'a': theNumFormat=CAbacus::eAlpha; break;
case 'B': case 'b': theNumFormat=CAbacus::eBinary; break;
case 'D': case 'd': theNumFormat=CAbacus::eDecimal; break;
case 'H': case 'h': theNumFormat=CAbacus::eHex; break;
case 'R': case 'r': theNumFormat=CAbacus::eRoman; break;
case 'S': case 's': theNumFormat=CAbacus::eSpelled; break;
default:
theNumFormat=CAbacus::eDecimal;
break;
}
//determine numbering style
}
else if(theKey.LowerCaseEqualsLiteral("value")){
PRInt32 err=0;
theNewValue=atoi(NS_LossyConvertUCS2toASCII(theValue).get());
if(!err) {
theIncrValue=0;
AllocateCounters();
if(mCounters) {
mCounters[aTag]=theNewValue;
}
}
else theNewValue=-1;
}
}
if(theEntity && (eHTMLTag_userdefined==aTag)) {
result=theEntity->mOrdinal+=theIncrValue;
}
else {
AllocateCounters();
if(mCounters) {
result=mCounters[aTag]+=theIncrValue;
}
else result=0;
}
CAbacus::GetFormattedString(theNumFormat,result,aResult,0,0,0);
return result;
}
#endif
/**
*

View File

@@ -231,34 +231,6 @@ public:
CTableState *mPrevious;
};
#ifdef DEBUG
//used for named entities and counters (XXX debug only)
class CNamedEntity {
public:
CNamedEntity(const nsAString& aName,const nsAString& aValue) : mName(), mValue() {
PRUnichar theFirst=aName.First();
PRUnichar theLast=aName.Last();
PRInt32 theLen=aName.Length();
if((2<theLen) && (theFirst==theLast) && (kQuote==theFirst)) {
mName = Substring(aName, 1, theLen - 2);
}
else mName=aName;
theFirst=aValue.First();
theLast=aValue.Last();
theLen=aValue.Length();
if((2<theLen) && (theFirst==theLast) && (kQuote==theFirst)) {
mValue = Substring(aValue, 1, theLen - 2);
}
else mValue=aValue;
}
nsString mName;
nsString mValue;
PRInt32 mOrdinal;
};
#endif
/************************************************************************
nsTokenAllocator class implementation.
This class is used to recycle tokens.
@@ -387,14 +359,6 @@ public:
#ifdef NS_DEBUG
enum { eMaxTags = 100 };
eHTMLTags mXTags[eMaxTags];
PRInt32 *mCounters;
void ResetCounters(void);
void AllocateCounters(void);
PRInt32 IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsString& aResult);
CNamedEntity* RegisterEntity(const nsAString& aName,const nsAString& aValue);
CNamedEntity* GetEntity(const nsAString& aName) const;
#endif
};

View File

@@ -439,16 +439,6 @@ const nsHTMLElement gHTMLElements[] = {
/*special parents,kids,skip*/ &gInTable,&gColgroupKids,eHTMLTag_unknown,
/*contain-func*/ 0
},
{
/*tag*/ eHTMLTag_counter,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kPhrase, (kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown,
/*contain-func*/ 0
},
{
/*tag*/ eHTMLTag_dd,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,