зеркало из https://github.com/mozilla/pjs.git
bug fixes; more docs; lots of new testing
This commit is contained in:
Родитель
33a393036e
Коммит
986ecb2e47
|
@ -1506,6 +1506,11 @@ PRBool CNavDTD::CanOmitEndTag(eHTMLTags aParent,eHTMLTags aChild) const {
|
|||
result=PR_TRUE;
|
||||
break;
|
||||
|
||||
case eHTMLTag_html:
|
||||
case eHTMLTag_body:
|
||||
result=HasOpenContainer(aChild); //don't bother if they're already open...
|
||||
break;
|
||||
|
||||
case eHTMLTag_newline:
|
||||
case eHTMLTag_whitespace:
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
class nsIContentSink;
|
||||
class nsIStreamObserver;
|
||||
class nsString;
|
||||
class CToken;
|
||||
class nsIURL;
|
||||
class nsIDTDDebug;
|
||||
|
||||
|
@ -88,16 +87,6 @@ class nsIParser : public nsISupports {
|
|||
*/
|
||||
virtual eAutoDetectResult AutoDetectContentType(nsString& aBuffer,nsString& aType)=0;
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
virtual PRInt32 ConsumeToken(CToken*& aToken)=0;
|
||||
|
||||
|
||||
/******************************************************************************************
|
||||
* Parse methods always begin with an input source, and perform conversions
|
||||
|
|
|
@ -578,11 +578,11 @@ PRInt32 nsParser::BuildModel() {
|
|||
And guess what? It worked the first time!
|
||||
Uncomment the following code to enable the test:
|
||||
|
||||
int recurse=0;
|
||||
if(recurse){
|
||||
nsString theString("<table border=1><tr><td BGCOLOR=blue>cell</td></tr></table>");
|
||||
Parse(theString,PR_TRUE);
|
||||
}
|
||||
int recurse=0;
|
||||
if(recurse){
|
||||
nsString theString("<table border=1><tr><td BGCOLOR=blue>cell</td></tr></table>");
|
||||
Parse(theString,PR_TRUE);
|
||||
}
|
||||
**************************************************************************/
|
||||
|
||||
theMarkPos=*mParserContext->mCurrentPos;
|
||||
|
@ -770,19 +770,6 @@ nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& a
|
|||
Here comes the tokenization methods...
|
||||
*******************************************************************/
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
PRInt32 nsParser::ConsumeToken(CToken*& aToken) {
|
||||
PRInt32 result=mParserContext->mDTD->ConsumeToken(aToken);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Part of the code sandwich, this gets called right before
|
||||
|
|
|
@ -224,16 +224,6 @@ private:
|
|||
These are the tokenization methods...
|
||||
*******************************************/
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
virtual PRInt32 ConsumeToken(CToken*& aToken);
|
||||
|
||||
/**
|
||||
* Part of the code sandwich, this gets called right before
|
||||
* the tokenization process begins. The main reason for
|
||||
|
@ -299,42 +289,15 @@ protected:
|
|||
// And now, some data members...
|
||||
//*********************************************
|
||||
|
||||
/*****************************************************
|
||||
All of these moved into the parse-context object:
|
||||
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
|
||||
nsIURL* mURL;
|
||||
nsString mSourceType;
|
||||
nsString mTargetType;
|
||||
eAutoDetectResult mAutoDetectStatus;
|
||||
|
||||
nsDequeIterator* mCurrentPos;
|
||||
nsDequeIterator* mMarkPos;
|
||||
nsDeque mTokenDeque;
|
||||
CScanner* mScanner;
|
||||
nsIDTD* mDTD;
|
||||
|
||||
eParseMode mParseMode;
|
||||
char* mTransferBuffer;
|
||||
*****************************************************/
|
||||
|
||||
|
||||
CParserContext* mParserContext;
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
|
||||
/*****************************************************
|
||||
The above fields are moving into parse-context
|
||||
*****************************************************/
|
||||
|
||||
|
||||
nsIStreamObserver* mObserver;
|
||||
nsIContentSink* mSink;
|
||||
nsIParserFilter* mParserFilter;
|
||||
|
||||
|
||||
nsIDTDDebug* mDTDDebug;
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class nsCParserNode : public nsIParserNode {
|
|||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
virtual ~nsCParserNode();
|
||||
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
|
|
|
@ -257,7 +257,11 @@ nsresult CScanner::Eof() {
|
|||
* @return error code reflecting read status
|
||||
*/
|
||||
nsresult CScanner::GetChar(PRUnichar& aChar) {
|
||||
nsresult result=Eof();
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mOffset>=mBuffer.Length())
|
||||
result=Eof();
|
||||
|
||||
if(NS_OK == result) {
|
||||
aChar=mBuffer[mOffset++];
|
||||
}
|
||||
|
@ -274,7 +278,11 @@ nsresult CScanner::GetChar(PRUnichar& aChar) {
|
|||
* @return
|
||||
*/
|
||||
nsresult CScanner::Peek(PRUnichar& aChar) {
|
||||
nsresult result=Eof();
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mOffset>=mBuffer.Length())
|
||||
result=Eof();
|
||||
|
||||
if(NS_OK == result) {
|
||||
aChar=mBuffer[mOffset];
|
||||
}
|
||||
|
|
|
@ -1506,6 +1506,11 @@ PRBool CNavDTD::CanOmitEndTag(eHTMLTags aParent,eHTMLTags aChild) const {
|
|||
result=PR_TRUE;
|
||||
break;
|
||||
|
||||
case eHTMLTag_html:
|
||||
case eHTMLTag_body:
|
||||
result=HasOpenContainer(aChild); //don't bother if they're already open...
|
||||
break;
|
||||
|
||||
case eHTMLTag_newline:
|
||||
case eHTMLTag_whitespace:
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
class nsIContentSink;
|
||||
class nsIStreamObserver;
|
||||
class nsString;
|
||||
class CToken;
|
||||
class nsIURL;
|
||||
class nsIDTDDebug;
|
||||
|
||||
|
@ -88,16 +87,6 @@ class nsIParser : public nsISupports {
|
|||
*/
|
||||
virtual eAutoDetectResult AutoDetectContentType(nsString& aBuffer,nsString& aType)=0;
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
virtual PRInt32 ConsumeToken(CToken*& aToken)=0;
|
||||
|
||||
|
||||
/******************************************************************************************
|
||||
* Parse methods always begin with an input source, and perform conversions
|
||||
|
|
|
@ -578,11 +578,11 @@ PRInt32 nsParser::BuildModel() {
|
|||
And guess what? It worked the first time!
|
||||
Uncomment the following code to enable the test:
|
||||
|
||||
int recurse=0;
|
||||
if(recurse){
|
||||
nsString theString("<table border=1><tr><td BGCOLOR=blue>cell</td></tr></table>");
|
||||
Parse(theString,PR_TRUE);
|
||||
}
|
||||
int recurse=0;
|
||||
if(recurse){
|
||||
nsString theString("<table border=1><tr><td BGCOLOR=blue>cell</td></tr></table>");
|
||||
Parse(theString,PR_TRUE);
|
||||
}
|
||||
**************************************************************************/
|
||||
|
||||
theMarkPos=*mParserContext->mCurrentPos;
|
||||
|
@ -770,19 +770,6 @@ nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& a
|
|||
Here comes the tokenization methods...
|
||||
*******************************************************************/
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
PRInt32 nsParser::ConsumeToken(CToken*& aToken) {
|
||||
PRInt32 result=mParserContext->mDTD->ConsumeToken(aToken);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Part of the code sandwich, this gets called right before
|
||||
|
|
|
@ -224,16 +224,6 @@ private:
|
|||
These are the tokenization methods...
|
||||
*******************************************/
|
||||
|
||||
/**
|
||||
* Cause the tokenizer to consume the next token, and
|
||||
* return an error result.
|
||||
*
|
||||
* @update gess 3/25/98
|
||||
* @param anError -- ref to error code
|
||||
* @return new token or null
|
||||
*/
|
||||
virtual PRInt32 ConsumeToken(CToken*& aToken);
|
||||
|
||||
/**
|
||||
* Part of the code sandwich, this gets called right before
|
||||
* the tokenization process begins. The main reason for
|
||||
|
@ -299,42 +289,15 @@ protected:
|
|||
// And now, some data members...
|
||||
//*********************************************
|
||||
|
||||
/*****************************************************
|
||||
All of these moved into the parse-context object:
|
||||
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
|
||||
nsIURL* mURL;
|
||||
nsString mSourceType;
|
||||
nsString mTargetType;
|
||||
eAutoDetectResult mAutoDetectStatus;
|
||||
|
||||
nsDequeIterator* mCurrentPos;
|
||||
nsDequeIterator* mMarkPos;
|
||||
nsDeque mTokenDeque;
|
||||
CScanner* mScanner;
|
||||
nsIDTD* mDTD;
|
||||
|
||||
eParseMode mParseMode;
|
||||
char* mTransferBuffer;
|
||||
*****************************************************/
|
||||
|
||||
|
||||
CParserContext* mParserContext;
|
||||
PRInt32 mMajorIteration;
|
||||
PRInt32 mMinorIteration;
|
||||
|
||||
/*****************************************************
|
||||
The above fields are moving into parse-context
|
||||
*****************************************************/
|
||||
|
||||
|
||||
nsIStreamObserver* mObserver;
|
||||
nsIContentSink* mSink;
|
||||
nsIParserFilter* mParserFilter;
|
||||
|
||||
|
||||
nsIDTDDebug* mDTDDebug;
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class nsCParserNode : public nsIParserNode {
|
|||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
virtual ~nsCParserNode();
|
||||
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
|
|
|
@ -257,7 +257,11 @@ nsresult CScanner::Eof() {
|
|||
* @return error code reflecting read status
|
||||
*/
|
||||
nsresult CScanner::GetChar(PRUnichar& aChar) {
|
||||
nsresult result=Eof();
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mOffset>=mBuffer.Length())
|
||||
result=Eof();
|
||||
|
||||
if(NS_OK == result) {
|
||||
aChar=mBuffer[mOffset++];
|
||||
}
|
||||
|
@ -274,7 +278,11 @@ nsresult CScanner::GetChar(PRUnichar& aChar) {
|
|||
* @return
|
||||
*/
|
||||
nsresult CScanner::Peek(PRUnichar& aChar) {
|
||||
nsresult result=Eof();
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(mOffset>=mBuffer.Length())
|
||||
result=Eof();
|
||||
|
||||
if(NS_OK == result) {
|
||||
aChar=mBuffer[mOffset];
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче