зеркало из https://github.com/mozilla/pjs.git
Bug 64448, comments in internal subset moved to before internal subset. I also fixed some static global variables and NS_GET_IID stuff. r=harishd, sr=vidur.
This commit is contained in:
Родитель
7dc0c2789c
Коммит
f9c74bf2ef
|
@ -60,8 +60,6 @@ typedef struct _XMLParserState {
|
|||
And now for the main class -- nsExpatTokenizer...
|
||||
************************************************************************/
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kITokenizerIID, NS_ITOKENIZER_IID);
|
||||
static NS_DEFINE_IID(kHTMLTokenizerIID, NS_HTMLTOKENIZER_IID);
|
||||
static NS_DEFINE_IID(kClassIID, NS_EXPATTOKENIZER_IID);
|
||||
|
||||
|
@ -100,10 +98,10 @@ nsresult nsExpatTokenizer::QueryInterface(const nsIID& aIID, void** aInstancePtr
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
|
||||
if(aIID.Equals(NS_GET_IID(nsISupports))) { //do IUnknown...
|
||||
*aInstancePtr = (nsExpatTokenizer*)(this);
|
||||
}
|
||||
else if(aIID.Equals(kITokenizerIID)) { //do ITokenizer base class...
|
||||
else if(aIID.Equals(NS_GET_IID(nsITokenizer))) { //do ITokenizer base class...
|
||||
*aInstancePtr = (nsITokenizer*)(this);
|
||||
}
|
||||
else if(aIID.Equals(kHTMLTokenizerIID)) { //do nsHTMLTokenizer base class...
|
||||
|
@ -627,6 +625,12 @@ void nsExpatTokenizer::HandleCharacterData(void *userData, const XML_Char *s, in
|
|||
|
||||
void nsExpatTokenizer::HandleComment(void *userData, const XML_Char *name) {
|
||||
XMLParserState* state = (XMLParserState*) userData;
|
||||
if (state->indoctype) {
|
||||
// We do not want comments popping out of the doctype...
|
||||
state->doctypeText.Append(NS_LITERAL_STRING("<!--"));
|
||||
state->doctypeText.Append((PRUnichar*)name);
|
||||
state->doctypeText.Append(NS_LITERAL_STRING("-->"));
|
||||
} else {
|
||||
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
|
||||
if(theToken) {
|
||||
AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
|
||||
|
@ -634,6 +638,7 @@ void nsExpatTokenizer::HandleComment(void *userData, const XML_Char *name) {
|
|||
else{
|
||||
//THROW A HUGE ERROR IF WE CANT CREATE A TOKEN!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsExpatTokenizer::HandleStartCdataSection(void *userData) {
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* MODULE NOTES:
|
||||
* @update gess 4/1/98
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NSITOKENIZER__
|
||||
#define __NSITOKENIZER__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "prtypes.h"
|
||||
#include "nshtmlpars.h"
|
||||
|
||||
class CToken;
|
||||
class nsScanner;
|
||||
class nsDeque;
|
||||
class nsTokenAllocator;
|
||||
|
||||
#define NS_ITOKENIZER_IID \
|
||||
{0xe4238ddc, 0x9eb6, 0x11d2, {0xba, 0xa5, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4 }}
|
||||
|
||||
/**
|
||||
* This interface is used as a callback to objects interested
|
||||
* in observing the token stream created from the parse process.
|
||||
*/
|
||||
class nsITokenObserver {
|
||||
public:
|
||||
virtual PRBool operator()(CToken* aToken)=0;
|
||||
};
|
||||
|
||||
/***************************************************************
|
||||
Notes:
|
||||
***************************************************************/
|
||||
|
||||
class nsITokenizer : public nsISupports {
|
||||
public:
|
||||
|
||||
virtual nsresult WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator)=0;
|
||||
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
|
||||
virtual nsresult DidTokenize(PRBool aIsFinalChunk)=0;
|
||||
virtual nsTokenAllocator* GetTokenAllocator(void)=0;
|
||||
|
||||
virtual CToken* PushTokenFront(CToken* aToken)=0;
|
||||
virtual CToken* PushToken(CToken* aToken)=0;
|
||||
virtual CToken* PopToken(void)=0;
|
||||
virtual CToken* PeekToken(void)=0;
|
||||
virtual PRInt32 GetCount(void)=0;
|
||||
virtual CToken* GetTokenAt(PRInt32 anIndex)=0;
|
||||
|
||||
virtual void PrependTokens(nsDeque& aDeque)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -60,8 +60,6 @@ typedef struct _XMLParserState {
|
|||
And now for the main class -- nsExpatTokenizer...
|
||||
************************************************************************/
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kITokenizerIID, NS_ITOKENIZER_IID);
|
||||
static NS_DEFINE_IID(kHTMLTokenizerIID, NS_HTMLTOKENIZER_IID);
|
||||
static NS_DEFINE_IID(kClassIID, NS_EXPATTOKENIZER_IID);
|
||||
|
||||
|
@ -100,10 +98,10 @@ nsresult nsExpatTokenizer::QueryInterface(const nsIID& aIID, void** aInstancePtr
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if(aIID.Equals(kISupportsIID)) { //do IUnknown...
|
||||
if(aIID.Equals(NS_GET_IID(nsISupports))) { //do IUnknown...
|
||||
*aInstancePtr = (nsExpatTokenizer*)(this);
|
||||
}
|
||||
else if(aIID.Equals(kITokenizerIID)) { //do ITokenizer base class...
|
||||
else if(aIID.Equals(NS_GET_IID(nsITokenizer))) { //do ITokenizer base class...
|
||||
*aInstancePtr = (nsITokenizer*)(this);
|
||||
}
|
||||
else if(aIID.Equals(kHTMLTokenizerIID)) { //do nsHTMLTokenizer base class...
|
||||
|
@ -627,6 +625,12 @@ void nsExpatTokenizer::HandleCharacterData(void *userData, const XML_Char *s, in
|
|||
|
||||
void nsExpatTokenizer::HandleComment(void *userData, const XML_Char *name) {
|
||||
XMLParserState* state = (XMLParserState*) userData;
|
||||
if (state->indoctype) {
|
||||
// We do not want comments popping out of the doctype...
|
||||
state->doctypeText.Append(NS_LITERAL_STRING("<!--"));
|
||||
state->doctypeText.Append((PRUnichar*)name);
|
||||
state->doctypeText.Append(NS_LITERAL_STRING("-->"));
|
||||
} else {
|
||||
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
|
||||
if(theToken) {
|
||||
AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
|
||||
|
@ -634,6 +638,7 @@ void nsExpatTokenizer::HandleComment(void *userData, const XML_Char *name) {
|
|||
else{
|
||||
//THROW A HUGE ERROR IF WE CANT CREATE A TOKEN!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsExpatTokenizer::HandleStartCdataSection(void *userData) {
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* MODULE NOTES:
|
||||
* @update gess 4/1/98
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NSITOKENIZER__
|
||||
#define __NSITOKENIZER__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "prtypes.h"
|
||||
#include "nshtmlpars.h"
|
||||
|
||||
class CToken;
|
||||
class nsScanner;
|
||||
class nsDeque;
|
||||
class nsTokenAllocator;
|
||||
|
||||
#define NS_ITOKENIZER_IID \
|
||||
{0xe4238ddc, 0x9eb6, 0x11d2, {0xba, 0xa5, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4 }}
|
||||
|
||||
/**
|
||||
* This interface is used as a callback to objects interested
|
||||
* in observing the token stream created from the parse process.
|
||||
*/
|
||||
class nsITokenObserver {
|
||||
public:
|
||||
virtual PRBool operator()(CToken* aToken)=0;
|
||||
};
|
||||
|
||||
/***************************************************************
|
||||
Notes:
|
||||
***************************************************************/
|
||||
|
||||
class nsITokenizer : public nsISupports {
|
||||
public:
|
||||
|
||||
virtual nsresult WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator)=0;
|
||||
virtual nsresult ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
|
||||
virtual nsresult DidTokenize(PRBool aIsFinalChunk)=0;
|
||||
virtual nsTokenAllocator* GetTokenAllocator(void)=0;
|
||||
|
||||
virtual CToken* PushTokenFront(CToken* aToken)=0;
|
||||
virtual CToken* PushToken(CToken* aToken)=0;
|
||||
virtual CToken* PopToken(void)=0;
|
||||
virtual CToken* PeekToken(void)=0;
|
||||
virtual PRInt32 GetCount(void)=0;
|
||||
virtual CToken* GetTokenAt(PRInt32 anIndex)=0;
|
||||
|
||||
virtual void PrependTokens(nsDeque& aDeque)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Загрузка…
Ссылка в новой задаче