diff --git a/mozilla/parser/htmlparser/public/nsHTMLTagList.h b/mozilla/parser/htmlparser/public/nsHTMLTagList.h
index 9e7f563c167..ea086f63016 100644
--- a/mozilla/parser/htmlparser/public/nsHTMLTagList.h
+++ b/mozilla/parser/htmlparser/public/nsHTMLTagList.h
@@ -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)
diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp
index 8fdfb1fbfd4..a7e7a8c31fb 100644
--- a/mozilla/parser/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp
@@ -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;theIndexRegisterEntity(*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;
diff --git a/mozilla/parser/htmlparser/src/COtherDTD.cpp b/mozilla/parser/htmlparser/src/COtherDTD.cpp
index 69361102d67..fbb3bfd328d 100644
--- a/mozilla/parser/htmlparser/src/COtherDTD.cpp
+++ b/mozilla/parser/htmlparser/src/COtherDTD.cpp
@@ -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;theIndexRegisterEntity(*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 {
diff --git a/mozilla/parser/htmlparser/src/COtherElements.h b/mozilla/parser/htmlparser/src/COtherElements.h
index 9f1cfc72433..1608910ebdb 100644
--- a/mozilla/parser/htmlparser/src/COtherElements.h
+++ b/mozilla/parser/htmlparser/src/COtherElements.h
@@ -982,66 +982,6 @@ public:
};
-/**********************************************************
- This defines the counter element, and is for debug use.
-
- Usage:
-
- 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;
}
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
index 75834542ff1..38f2b32132d 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
@@ -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;theIndexmName.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(01)
- 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;digitPosmOrdinal=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
/**
*
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.h b/mozilla/parser/htmlparser/src/nsDTDUtils.h
index 7ce2c89cc16..d54f810757a 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.h
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.h
@@ -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