mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Remove unused parser-related code. b=130439 r=harishd sr=jst
This commit is contained in:
parent
d7be43384d
commit
de5585e5e7
@ -44,12 +44,13 @@
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
#define kNullCh (PRUnichar('\0'))
|
||||
|
||||
void
|
||||
ChangeCSSInlineStyleTxn::AppendDeclaration(nsAString & aOutputString,
|
||||
const nsAString & aProperty,
|
||||
|
@ -88,8 +88,6 @@
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIImage.h"
|
||||
#include "nsAOLCiter.h"
|
||||
#include "nsInternetCiter.h"
|
||||
|
@ -86,8 +86,6 @@
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIImage.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -82,8 +82,10 @@ static NS_DEFINE_IID(kClassIID, NS_INAVHTML_DTD_IID);
|
||||
|
||||
static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char* kNullToken = "Error: Null token given";
|
||||
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CRC
|
||||
static char gShowCRC;
|
||||
|
@ -875,6 +875,13 @@ public:
|
||||
to handle it.
|
||||
**********************************************************/
|
||||
virtual PRInt32 FindAutoCloseTargetForEndTag(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink, PRInt32& anIndex) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
PRInt32 result=kNotFound;
|
||||
|
||||
switch(aTag) {
|
||||
@ -1011,11 +1018,11 @@ public:
|
||||
|
||||
nsresult result=NS_OK;
|
||||
PRInt32 theCount=aContext->GetCount();
|
||||
eHTMLTags theGrandParentTag=aContext->TagAt(theCount-2);
|
||||
|
||||
nsCParserNode *theNode = (nsCParserNode*)aNode;
|
||||
|
||||
#ifdef DEBUG
|
||||
eHTMLTags theGrandParentTag=aContext->TagAt(theCount-2);
|
||||
nsAutoString theNumber;
|
||||
aContext->IncrementCounter(theGrandParentTag,*theNode,theNumber);
|
||||
|
||||
@ -1155,6 +1162,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult OpenContext(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
NS_ASSERTION(aContext!=nsnull,"cannot make a decision without a context");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
@ -1168,6 +1182,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult CloseContext(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
NS_ASSERTION(aContext!=nsnull,"cannot make a decision without a context");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
@ -1239,6 +1260,13 @@ public:
|
||||
Textcontainer handles the opening of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
@ -1254,6 +1282,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult HandleEndToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
return result;
|
||||
}
|
||||
@ -1279,6 +1314,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
CElement* theHead=GetElement(eHTMLTag_head);
|
||||
if(theHead) {
|
||||
@ -1375,6 +1417,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
CElement* theHead=GetElement(eHTMLTag_head);
|
||||
if(theHead) {
|
||||
@ -1422,6 +1471,13 @@ public:
|
||||
this gets called to close a tag in the given context
|
||||
**********************************************************/
|
||||
virtual nsresult CloseContext(nsIParserNode *aNode,eHTMLTags aTag,nsDTDContext *aContext,nsIHTMLContentSink *aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsEntryStack* theStack=0;
|
||||
nsIParserNode *theNode=aContext->Pop(theStack);
|
||||
|
||||
@ -1435,6 +1491,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(aContext->HasOpenContainer(eHTMLTag_body)) {
|
||||
@ -1903,6 +1966,13 @@ public:
|
||||
|
||||
//this gets called after each tag is opened in the given context
|
||||
virtual nsresult OpenContainer(nsCParserNode *aNode,eHTMLTags aTag,nsDTDContext *aContext,nsIHTMLContentSink *aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
if(mTag==aTag) {
|
||||
// Close the head before opening a body.
|
||||
@ -1946,7 +2016,6 @@ public:
|
||||
|
||||
nsresult result=CElement::HandleStartToken(aNode,aTag,aContext,aSink);
|
||||
|
||||
CElement *theElement=GetElement(aTag);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
if(aNode) {
|
||||
nsCParserNode* theNode=(nsCParserNode*)aNode;
|
||||
|
@ -482,8 +482,6 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
||||
aName.BeginReading(start);
|
||||
aName.EndReading(end);
|
||||
|
||||
|
||||
PRInt32 theLen=aName.Length();
|
||||
PRUnichar theChar=aName.Last();
|
||||
|
||||
// skip past leading and trailing quotes/etc
|
||||
|
@ -578,6 +578,7 @@ nsScanner* nsParser::GetScanner(void){
|
||||
nsDTDMode nsParser::GetParseMode(void){
|
||||
if(mParserContext)
|
||||
return mParserContext->mDTDMode;
|
||||
NS_NOTREACHED("no parser context");
|
||||
return eDTDMode_unknown;
|
||||
}
|
||||
|
||||
@ -1128,8 +1129,9 @@ void DetermineParseMode(const nsString& aBuffer,
|
||||
* @return
|
||||
*/
|
||||
static
|
||||
PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) {
|
||||
|
||||
PRBool FindSuitableDTD(CParserContext& aParserContext,
|
||||
const nsString& aBuffer)
|
||||
{
|
||||
//Let's start by trying the defaultDTD, if one exists...
|
||||
if(aParserContext.mDTD)
|
||||
if(aParserContext.mDTD->CanParse(aParserContext,aBuffer,0))
|
||||
@ -1210,38 +1212,30 @@ nsParser::CancelParsingEvents() {
|
||||
* last thing that happens right before parsing, so we
|
||||
* can delay until the last moment the resolution of
|
||||
* which DTD to use (unless of course we're assigned one).
|
||||
*
|
||||
* @update gess5/18/98
|
||||
* @param
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
nsresult nsParser::WillBuildModel(nsString& aFilename)
|
||||
{
|
||||
if (!mParserContext)
|
||||
return kInvalidParserContext;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mParserContext){
|
||||
if(eUnknownDetect==mParserContext->mAutoDetectStatus) {
|
||||
mMajorIteration=-1;
|
||||
mMinorIteration=-1;
|
||||
if (eUnknownDetect != mParserContext->mAutoDetectStatus)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString theBuffer;
|
||||
// XXXVidur Make a copy and only check in the first 1k
|
||||
mParserContext->mScanner->Peek(theBuffer, 1024);
|
||||
|
||||
if (eDTDMode_unknown == mParserContext->mDTDMode ||
|
||||
eDTDMode_autodetect == mParserContext->mDTDMode) {
|
||||
DetermineParseMode(theBuffer,mParserContext->mDTDMode,mParserContext->mDocType,mParserContext->mMimeType);
|
||||
}
|
||||
eDTDMode_autodetect == mParserContext->mDTDMode)
|
||||
DetermineParseMode(theBuffer, mParserContext->mDTDMode,
|
||||
mParserContext->mDocType, mParserContext->mMimeType);
|
||||
|
||||
if (!FindSuitableDTD(*mParserContext,theBuffer))
|
||||
return NS_OK;
|
||||
|
||||
if(PR_TRUE==FindSuitableDTD(*mParserContext,theBuffer)) {
|
||||
nsITokenizer* tokenizer;
|
||||
mParserContext->GetTokenizer(mParserContext->mDTD->GetType(), tokenizer);
|
||||
result = mParserContext->mDTD->WillBuildModel(*mParserContext, tokenizer, mSink);
|
||||
}//if
|
||||
}//if
|
||||
}
|
||||
else result=kInvalidParserContext;
|
||||
return result;
|
||||
return mParserContext->mDTD->WillBuildModel(*mParserContext, tokenizer, mSink);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2514,8 +2508,6 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
|
||||
}
|
||||
}
|
||||
else {
|
||||
++mMajorIteration;
|
||||
|
||||
PRBool flushTokens=PR_FALSE;
|
||||
|
||||
MOZ_TIMER_START(mTokenizeTime);
|
||||
@ -2523,7 +2515,6 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
|
||||
WillTokenize(aIsFinalChunk);
|
||||
while (NS_SUCCEEDED(result)) {
|
||||
mParserContext->mScanner->Mark();
|
||||
++mMinorIteration;
|
||||
result=theTokenizer->ConsumeToken(*mParserContext->mScanner, flushTokens);
|
||||
if (NS_FAILED(result)) {
|
||||
mParserContext->mScanner->RewindToMark();
|
||||
|
@ -448,8 +448,6 @@ protected:
|
||||
eParserCommands mCommand;
|
||||
nsresult mInternalState;
|
||||
PRInt32 mStreamStatus;
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
PRInt32 mCharsetSource;
|
||||
|
||||
PRUint16 mFlags;
|
||||
|
@ -82,8 +82,10 @@ static NS_DEFINE_IID(kClassIID, NS_INAVHTML_DTD_IID);
|
||||
|
||||
static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char* kNullToken = "Error: Null token given";
|
||||
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CRC
|
||||
static char gShowCRC;
|
||||
|
@ -875,6 +875,13 @@ public:
|
||||
to handle it.
|
||||
**********************************************************/
|
||||
virtual PRInt32 FindAutoCloseTargetForEndTag(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink, PRInt32& anIndex) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
PRInt32 result=kNotFound;
|
||||
|
||||
switch(aTag) {
|
||||
@ -1011,11 +1018,11 @@ public:
|
||||
|
||||
nsresult result=NS_OK;
|
||||
PRInt32 theCount=aContext->GetCount();
|
||||
eHTMLTags theGrandParentTag=aContext->TagAt(theCount-2);
|
||||
|
||||
nsCParserNode *theNode = (nsCParserNode*)aNode;
|
||||
|
||||
#ifdef DEBUG
|
||||
eHTMLTags theGrandParentTag=aContext->TagAt(theCount-2);
|
||||
nsAutoString theNumber;
|
||||
aContext->IncrementCounter(theGrandParentTag,*theNode,theNumber);
|
||||
|
||||
@ -1155,6 +1162,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult OpenContext(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
NS_ASSERTION(aContext!=nsnull,"cannot make a decision without a context");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
@ -1168,6 +1182,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult CloseContext(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
NS_ASSERTION(aContext!=nsnull,"cannot make a decision without a context");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
@ -1239,6 +1260,13 @@ public:
|
||||
Textcontainer handles the opening of it's own children
|
||||
**********************************************************/
|
||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
switch(aTag) {
|
||||
@ -1254,6 +1282,13 @@ public:
|
||||
}
|
||||
|
||||
virtual nsresult HandleEndToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
return result;
|
||||
}
|
||||
@ -1279,6 +1314,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
CElement* theHead=GetElement(eHTMLTag_head);
|
||||
if(theHead) {
|
||||
@ -1375,6 +1417,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
CElement* theHead=GetElement(eHTMLTag_head);
|
||||
if(theHead) {
|
||||
@ -1422,6 +1471,13 @@ public:
|
||||
this gets called to close a tag in the given context
|
||||
**********************************************************/
|
||||
virtual nsresult CloseContext(nsIParserNode *aNode,eHTMLTags aTag,nsDTDContext *aContext,nsIHTMLContentSink *aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsIParserNode| rather than
|
||||
// |nsCParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsEntryStack* theStack=0;
|
||||
nsIParserNode *theNode=aContext->Pop(theStack);
|
||||
|
||||
@ -1435,6 +1491,13 @@ public:
|
||||
Call this for each element as it get's closed
|
||||
**********************************************************/
|
||||
virtual nsresult NotifyClose(nsCParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CTextContainer.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(aContext->HasOpenContainer(eHTMLTag_body)) {
|
||||
@ -1903,6 +1966,13 @@ public:
|
||||
|
||||
//this gets called after each tag is opened in the given context
|
||||
virtual nsresult OpenContainer(nsCParserNode *aNode,eHTMLTags aTag,nsDTDContext *aContext,nsIHTMLContentSink *aSink) {
|
||||
|
||||
// XXXldb This method is completely unused because the |aNode|
|
||||
// parameter is declared as |nsCParserNode| rather than
|
||||
// |nsIParserNode| so it doesn't override the member function of
|
||||
// CElement.
|
||||
NS_NOTREACHED("This isn't used. Should it be?");
|
||||
|
||||
nsresult result=NS_OK;
|
||||
if(mTag==aTag) {
|
||||
// Close the head before opening a body.
|
||||
@ -1946,7 +2016,6 @@ public:
|
||||
|
||||
nsresult result=CElement::HandleStartToken(aNode,aTag,aContext,aSink);
|
||||
|
||||
CElement *theElement=GetElement(aTag);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
if(aNode) {
|
||||
nsCParserNode* theNode=(nsCParserNode*)aNode;
|
||||
|
@ -482,8 +482,6 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const {
|
||||
aName.BeginReading(start);
|
||||
aName.EndReading(end);
|
||||
|
||||
|
||||
PRInt32 theLen=aName.Length();
|
||||
PRUnichar theChar=aName.Last();
|
||||
|
||||
// skip past leading and trailing quotes/etc
|
||||
|
@ -578,6 +578,7 @@ nsScanner* nsParser::GetScanner(void){
|
||||
nsDTDMode nsParser::GetParseMode(void){
|
||||
if(mParserContext)
|
||||
return mParserContext->mDTDMode;
|
||||
NS_NOTREACHED("no parser context");
|
||||
return eDTDMode_unknown;
|
||||
}
|
||||
|
||||
@ -1128,8 +1129,9 @@ void DetermineParseMode(const nsString& aBuffer,
|
||||
* @return
|
||||
*/
|
||||
static
|
||||
PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aBuffer) {
|
||||
|
||||
PRBool FindSuitableDTD(CParserContext& aParserContext,
|
||||
const nsString& aBuffer)
|
||||
{
|
||||
//Let's start by trying the defaultDTD, if one exists...
|
||||
if(aParserContext.mDTD)
|
||||
if(aParserContext.mDTD->CanParse(aParserContext,aBuffer,0))
|
||||
@ -1210,38 +1212,30 @@ nsParser::CancelParsingEvents() {
|
||||
* last thing that happens right before parsing, so we
|
||||
* can delay until the last moment the resolution of
|
||||
* which DTD to use (unless of course we're assigned one).
|
||||
*
|
||||
* @update gess5/18/98
|
||||
* @param
|
||||
* @return error code -- 0 if ok, non-zero if error.
|
||||
*/
|
||||
nsresult nsParser::WillBuildModel(nsString& aFilename){
|
||||
nsresult nsParser::WillBuildModel(nsString& aFilename)
|
||||
{
|
||||
if (!mParserContext)
|
||||
return kInvalidParserContext;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mParserContext){
|
||||
if(eUnknownDetect==mParserContext->mAutoDetectStatus) {
|
||||
mMajorIteration=-1;
|
||||
mMinorIteration=-1;
|
||||
if (eUnknownDetect != mParserContext->mAutoDetectStatus)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString theBuffer;
|
||||
// XXXVidur Make a copy and only check in the first 1k
|
||||
mParserContext->mScanner->Peek(theBuffer, 1024);
|
||||
|
||||
if (eDTDMode_unknown == mParserContext->mDTDMode ||
|
||||
eDTDMode_autodetect == mParserContext->mDTDMode) {
|
||||
DetermineParseMode(theBuffer,mParserContext->mDTDMode,mParserContext->mDocType,mParserContext->mMimeType);
|
||||
}
|
||||
eDTDMode_autodetect == mParserContext->mDTDMode)
|
||||
DetermineParseMode(theBuffer, mParserContext->mDTDMode,
|
||||
mParserContext->mDocType, mParserContext->mMimeType);
|
||||
|
||||
if (!FindSuitableDTD(*mParserContext,theBuffer))
|
||||
return NS_OK;
|
||||
|
||||
if(PR_TRUE==FindSuitableDTD(*mParserContext,theBuffer)) {
|
||||
nsITokenizer* tokenizer;
|
||||
mParserContext->GetTokenizer(mParserContext->mDTD->GetType(), tokenizer);
|
||||
result = mParserContext->mDTD->WillBuildModel(*mParserContext, tokenizer, mSink);
|
||||
}//if
|
||||
}//if
|
||||
}
|
||||
else result=kInvalidParserContext;
|
||||
return result;
|
||||
return mParserContext->mDTD->WillBuildModel(*mParserContext, tokenizer, mSink);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2514,8 +2508,6 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
|
||||
}
|
||||
}
|
||||
else {
|
||||
++mMajorIteration;
|
||||
|
||||
PRBool flushTokens=PR_FALSE;
|
||||
|
||||
MOZ_TIMER_START(mTokenizeTime);
|
||||
@ -2523,7 +2515,6 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk){
|
||||
WillTokenize(aIsFinalChunk);
|
||||
while (NS_SUCCEEDED(result)) {
|
||||
mParserContext->mScanner->Mark();
|
||||
++mMinorIteration;
|
||||
result=theTokenizer->ConsumeToken(*mParserContext->mScanner, flushTokens);
|
||||
if (NS_FAILED(result)) {
|
||||
mParserContext->mScanner->RewindToMark();
|
||||
|
@ -448,8 +448,6 @@ protected:
|
||||
eParserCommands mCommand;
|
||||
nsresult mInternalState;
|
||||
PRInt32 mStreamStatus;
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
PRInt32 mCharsetSource;
|
||||
|
||||
PRUint16 mFlags;
|
||||
|
Loading…
Reference in New Issue
Block a user