зеркало из https://github.com/mozilla/gecko-dev.git
imported patch simplify-nsIDTD.diff
This commit is contained in:
Родитель
c2610d97bf
Коммит
ad89dbd67c
|
@ -103,8 +103,7 @@ public:
|
|||
* @return
|
||||
*/
|
||||
NS_IMETHOD DidBuildModel(nsresult anErrorCode, PRBool aNotifySink,
|
||||
nsIParser* aParser,
|
||||
nsIContentSink* aSink) = 0;
|
||||
nsIParser* aParser) = 0;
|
||||
|
||||
/**
|
||||
* Called by the parser after the parsing process has concluded
|
||||
|
@ -112,9 +111,7 @@ public:
|
|||
* @param anErrorCode - contains error code resulting from parse process
|
||||
* @return
|
||||
*/
|
||||
NS_IMETHOD BuildModel(nsIParser* aParser, nsITokenizer* aTokenizer,
|
||||
nsITokenObserver* anObserver,
|
||||
nsIContentSink* aSink) = 0;
|
||||
NS_IMETHOD BuildModel(nsIParser* aParser, nsITokenizer* aTokenizer) = 0;
|
||||
|
||||
/**
|
||||
* Called during model building phase of parse process. Each token
|
||||
|
@ -134,7 +131,7 @@ public:
|
|||
* @update gess5/18/98
|
||||
* @return ignored
|
||||
*/
|
||||
NS_IMETHOD WillResumeParse(nsIContentSink* aSink) = 0;
|
||||
NS_IMETHOD WillResumeParse() = 0;
|
||||
|
||||
/**
|
||||
* If the parse process gets interrupted, this method is called by
|
||||
|
@ -142,7 +139,7 @@ public:
|
|||
* @update gess5/18/98
|
||||
* @return ignored
|
||||
*/
|
||||
NS_IMETHOD WillInterruptParse(nsIContentSink* aSink) = 0;
|
||||
NS_IMETHOD WillInterruptParse() = 0;
|
||||
|
||||
/**
|
||||
* This method is called to determine whether or not a tag of one
|
||||
|
@ -178,19 +175,22 @@ public:
|
|||
NS_IMETHOD_(void) Terminate() = 0;
|
||||
|
||||
NS_IMETHOD_(PRInt32) GetType() = 0;
|
||||
|
||||
NS_IMETHOD_(nsITokenizer*) CreateTokenizer() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDTD, NS_IDTD_IID)
|
||||
|
||||
#define NS_DECL_NSIDTD \
|
||||
NS_IMETHOD WillBuildModel( const CParserContext& aParserContext, nsITokenizer* aTokenizer, nsIContentSink* aSink);\
|
||||
NS_IMETHOD DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink);\
|
||||
NS_IMETHOD BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink);\
|
||||
NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser);\
|
||||
NS_IMETHOD WillResumeParse(nsIContentSink* aSink = 0);\
|
||||
NS_IMETHOD WillInterruptParse(nsIContentSink* aSink = 0);\
|
||||
NS_IMETHOD DidBuildModel(nsresult anErrorCode, PRBool aNotifySink, nsIParser* aParser);\
|
||||
NS_IMETHOD BuildModel(nsIParser* aParser, nsITokenizer* aTokenizer);\
|
||||
NS_IMETHOD HandleToken(CToken* aToken, nsIParser* aParser);\
|
||||
NS_IMETHOD WillResumeParse();\
|
||||
NS_IMETHOD WillInterruptParse();\
|
||||
NS_IMETHOD_(PRBool) CanContain(PRInt32 aParent,PRInt32 aChild) const;\
|
||||
NS_IMETHOD_(PRBool) IsContainer(PRInt32 aTag) const;\
|
||||
NS_IMETHOD_(void) Terminate();\
|
||||
NS_IMETHOD_(PRInt32) GetType();
|
||||
NS_IMETHOD_(PRInt32) GetType();\
|
||||
NS_IMETHOD_(nsITokenizer*) CreateTokenizer();
|
||||
#endif /* nsIDTD_h___ */
|
||||
|
|
|
@ -56,14 +56,6 @@ 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:
|
||||
|
|
|
@ -253,9 +253,7 @@ CNavDTD::WillBuildModel(const CParserContext& aParserContext,
|
|||
|
||||
nsresult
|
||||
CNavDTD::BuildModel(nsIParser* aParser,
|
||||
nsITokenizer* aTokenizer,
|
||||
nsITokenObserver* anObserver,
|
||||
nsIContentSink* aSink)
|
||||
nsITokenizer* aTokenizer)
|
||||
{
|
||||
NS_PRECONDITION(mBodyContext != nsnull,
|
||||
"Create a context before calling build model");
|
||||
|
@ -363,8 +361,7 @@ CNavDTD::BuildModel(nsIParser* aParser,
|
|||
nsresult
|
||||
CNavDTD::BuildNeglectedTarget(eHTMLTags aTarget,
|
||||
eHTMLTokenTypes aType,
|
||||
nsIParser* aParser,
|
||||
nsIContentSink* aSink)
|
||||
nsIParser* aParser)
|
||||
{
|
||||
NS_ASSERTION(mTokenizer, "tokenizer is null! unable to build target.");
|
||||
NS_ASSERTION(mTokenAllocator, "unable to create tokens without an allocator.");
|
||||
|
@ -375,16 +372,15 @@ CNavDTD::BuildNeglectedTarget(eHTMLTags aTarget,
|
|||
CToken* target = mTokenAllocator->CreateTokenOfType(aType, aTarget);
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_OUT_OF_MEMORY);
|
||||
mTokenizer->PushTokenFront(target);
|
||||
return BuildModel(aParser, mTokenizer, 0, aSink);
|
||||
return BuildModel(aParser, mTokenizer);
|
||||
}
|
||||
|
||||
nsresult
|
||||
CNavDTD::DidBuildModel(nsresult anErrorCode,
|
||||
PRBool aNotifySink,
|
||||
nsIParser* aParser,
|
||||
nsIContentSink* aSink)
|
||||
nsIParser* aParser)
|
||||
{
|
||||
if (!aSink) {
|
||||
if (!mSink) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -397,7 +393,7 @@ CNavDTD::DidBuildModel(nsresult anErrorCode,
|
|||
// Also note: We ignore the return value of BuildNeglectedTarget, we
|
||||
// can't reasonably respond to errors (or requests to block) at this
|
||||
// point in the parsing process.
|
||||
BuildNeglectedTarget(eHTMLTag_body, eToken_start, aParser, aSink);
|
||||
BuildNeglectedTarget(eHTMLTag_body, eToken_start, aParser);
|
||||
}
|
||||
if (mFlags & NS_DTD_FLAG_MISPLACED_CONTENT) {
|
||||
// Looks like the misplaced contents are not processed yet.
|
||||
|
@ -435,7 +431,7 @@ CNavDTD::DidBuildModel(nsresult anErrorCode,
|
|||
result = CloseContainersTo(mBodyContext->Last(), PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
//No matter what, you need to call did build model.
|
||||
aSink->DidBuildModel();
|
||||
mSink->DidBuildModel();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +456,7 @@ CNavDTD::DidBuildModel(nsresult anErrorCode,
|
|||
}
|
||||
|
||||
// No matter what, you need to call did build model.
|
||||
return aSink->DidBuildModel();
|
||||
return mSink->DidBuildModel();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
|
@ -476,6 +472,12 @@ CNavDTD::GetType()
|
|||
return NS_IPARSER_FLAG_HTML;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsITokenizer*)
|
||||
CNavDTD::CreateTokenizer()
|
||||
{
|
||||
return new nsHTMLTokenizer(mDTDMode, mDocType, mParserCommand, mSink);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text and some tags require a body when they're added, this function returns
|
||||
* true for those tags.
|
||||
|
@ -3152,12 +3154,12 @@ CNavDTD::CreateContextStackFor(eHTMLTags aParent, eHTMLTags aChild)
|
|||
}
|
||||
|
||||
nsresult
|
||||
CNavDTD::WillResumeParse(nsIContentSink* aSink)
|
||||
CNavDTD::WillResumeParse()
|
||||
{
|
||||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
|
||||
|
||||
nsresult result = aSink ? aSink->WillResume() : NS_OK;
|
||||
nsresult result = mSink ? mSink->WillResume() : NS_OK;
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillResumeParse(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
|
@ -3166,12 +3168,12 @@ CNavDTD::WillResumeParse(nsIContentSink* aSink)
|
|||
}
|
||||
|
||||
nsresult
|
||||
CNavDTD::WillInterruptParse(nsIContentSink* aSink)
|
||||
CNavDTD::WillInterruptParse()
|
||||
{
|
||||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
|
||||
|
||||
nsresult result = aSink ? aSink->WillInterrupt() : NS_OK;
|
||||
nsresult result = mSink ? mSink->WillInterrupt() : NS_OK;
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillInterruptParse(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
|
|
|
@ -296,7 +296,7 @@ private:
|
|||
nsresult HandleProcessingInstructionToken(CToken* aToken);
|
||||
nsresult HandleDocTypeDeclToken(CToken* aToken);
|
||||
nsresult BuildNeglectedTarget(eHTMLTags aTarget, eHTMLTokenTypes aType,
|
||||
nsIParser* aParser, nsIContentSink* aSink);
|
||||
nsIParser* aParser);
|
||||
|
||||
nsresult OpenHTML(const nsCParserNode *aNode);
|
||||
nsresult OpenBody(const nsCParserNode *aNode);
|
||||
|
|
|
@ -95,51 +95,11 @@ CParserContext::SetMimeType(const nsACString& aMimeType)
|
|||
}
|
||||
|
||||
nsresult
|
||||
CParserContext::GetTokenizer(nsIDTD* aDTD,
|
||||
nsIContentSink* aSink,
|
||||
nsITokenizer*& aTokenizer)
|
||||
CParserContext::GetTokenizer(nsIDTD* aDTD, nsITokenizer*& aTokenizer)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
PRInt32 type = aDTD ? aDTD->GetType() : NS_IPARSER_FLAG_HTML;
|
||||
|
||||
if (!mTokenizer) {
|
||||
if (type == NS_IPARSER_FLAG_HTML || mParserCommand == eViewSource) {
|
||||
nsCOMPtr<nsIHTMLContentSink> theSink = do_QueryInterface(aSink);
|
||||
PRUint16 theFlags = 0;
|
||||
|
||||
if (theSink) {
|
||||
// XXX This code is repeated both here and in CNavDTD. Can the two
|
||||
// callsites be combined?
|
||||
PRBool enabled;
|
||||
theSink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if(enabled) {
|
||||
theFlags |= NS_IPARSER_FLAG_FRAMES_ENABLED;
|
||||
}
|
||||
|
||||
theSink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if(enabled) {
|
||||
theFlags |= NS_IPARSER_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
}
|
||||
|
||||
mTokenizer = new nsHTMLTokenizer(mDTDMode, mDocType,
|
||||
mParserCommand, theFlags);
|
||||
if (!mTokenizer) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Make sure the new tokenizer has all of the necessary information.
|
||||
// XXX this might not be necessary.
|
||||
if (mPrevContext) {
|
||||
mTokenizer->CopyState(mPrevContext->mTokenizer);
|
||||
}
|
||||
}
|
||||
else if (type == NS_IPARSER_FLAG_XML) {
|
||||
mTokenizer = do_QueryInterface(aDTD, &result);
|
||||
}
|
||||
}
|
||||
|
||||
aTokenizer = mTokenizer;
|
||||
|
||||
return result;
|
||||
if (!mTokenizer)
|
||||
mTokenizer = aDTD->CreateTokenizer();
|
||||
return (aTokenizer = mTokenizer)
|
||||
? NS_OK
|
||||
: NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -73,9 +73,7 @@ public:
|
|||
|
||||
~CParserContext();
|
||||
|
||||
nsresult GetTokenizer(nsIDTD* aDTD,
|
||||
nsIContentSink* aSink,
|
||||
nsITokenizer*& aTokenizer);
|
||||
nsresult GetTokenizer(nsIDTD* aDTD, nsITokenizer*& aTokenizer);
|
||||
void SetMimeType(const nsACString& aMimeType);
|
||||
|
||||
nsCOMPtr<nsIRequest> mRequest; // provided by necko to differnciate different input streams
|
||||
|
|
|
@ -803,10 +803,12 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr,
|
|||
localURI.swap(uri);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentSink> sink = do_QueryInterface(mSink);
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (sink)
|
||||
doc = do_QueryInterface(sink->GetTarget());
|
||||
NS_ASSERTION(mSink == nsCOMPtr<nsIExpatSink>(do_QueryInterface(mOriginalSink)),
|
||||
"In nsExpatDriver::OpenInputStreamFromExternalDTD: "
|
||||
"mOriginalSink not the same object as mSink?");
|
||||
if (mOriginalSink)
|
||||
doc = do_QueryInterface(mOriginalSink->GetTarget());
|
||||
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_DTD,
|
||||
uri,
|
||||
|
@ -1232,6 +1234,8 @@ nsExpatDriver::WillBuildModel(const CParserContext& aParserContext,
|
|||
return mInternalState;
|
||||
}
|
||||
|
||||
mOriginalSink = aSink;
|
||||
|
||||
static const XML_Memory_Handling_Suite memsuite =
|
||||
{
|
||||
(void *(*)(size_t))PR_Malloc,
|
||||
|
@ -1299,9 +1303,7 @@ nsExpatDriver::WillBuildModel(const CParserContext& aParserContext,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsExpatDriver::BuildModel(nsIParser* aParser,
|
||||
nsITokenizer* aTokenizer,
|
||||
nsITokenObserver* anObserver,
|
||||
nsIContentSink* aSink)
|
||||
nsITokenizer* aTokenizer)
|
||||
{
|
||||
return mInternalState;
|
||||
}
|
||||
|
@ -1309,17 +1311,19 @@ nsExpatDriver::BuildModel(nsIParser* aParser,
|
|||
NS_IMETHODIMP
|
||||
nsExpatDriver::DidBuildModel(nsresult anErrorCode,
|
||||
PRBool aNotifySink,
|
||||
nsIParser* aParser,
|
||||
nsIContentSink* aSink)
|
||||
nsIParser* aParser)
|
||||
{
|
||||
// Check for mSink is intentional. This would make sure
|
||||
NS_ASSERTION(mSink == nsCOMPtr<nsIExpatSink>(do_QueryInterface(mOriginalSink)),
|
||||
"In nsExpatDriver::DidBuildModel: mOriginalSink not the same object as mSink?");
|
||||
// Check for mOriginalSink is intentional. This would make sure
|
||||
// that DidBuildModel() is called only once on the sink.
|
||||
nsresult result = NS_OK;
|
||||
if (mSink) {
|
||||
result = aSink->DidBuildModel();
|
||||
mSink = nsnull;
|
||||
if (mOriginalSink) {
|
||||
result = mOriginalSink->DidBuildModel();
|
||||
mOriginalSink = nsnull;
|
||||
}
|
||||
|
||||
mSink = nsnull;
|
||||
mExtendedSink = nsnull;
|
||||
|
||||
return result;
|
||||
|
@ -1334,15 +1338,19 @@ nsExpatDriver::WillTokenize(PRBool aIsFinalChunk,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpatDriver::WillResumeParse(nsIContentSink* aSink)
|
||||
nsExpatDriver::WillResumeParse()
|
||||
{
|
||||
return aSink ? aSink->WillResume() : NS_OK;
|
||||
NS_ASSERTION(mSink == nsCOMPtr<nsIExpatSink>(do_QueryInterface(mOriginalSink)),
|
||||
"In nsExpatDriver::WillResumeParse: mOriginalSink not the same object as mSink?");
|
||||
return mOriginalSink ? mOriginalSink->WillResume() : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpatDriver::WillInterruptParse(nsIContentSink* aSink)
|
||||
nsExpatDriver::WillInterruptParse()
|
||||
{
|
||||
return aSink ? aSink->WillInterrupt() : NS_OK;
|
||||
NS_ASSERTION(mSink == nsCOMPtr<nsIExpatSink>(do_QueryInterface(mOriginalSink)),
|
||||
"In nsExpatDriver::WillInterruptParse: mOriginalSink not the same object as mSink?");
|
||||
return mOriginalSink ? mOriginalSink->WillInterrupt() : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1367,6 +1375,12 @@ nsExpatDriver::GetType()
|
|||
return NS_IPARSER_FLAG_XML;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsITokenizer*)
|
||||
nsExpatDriver::CreateTokenizer()
|
||||
{
|
||||
return static_cast<nsITokenizer*>(this);
|
||||
}
|
||||
|
||||
/*************************** Unused methods **********************************/
|
||||
|
||||
NS_IMETHODIMP_(CToken*)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "expat_config.h"
|
||||
#include "expat.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDTD.h"
|
||||
#include "nsITokenizer.h"
|
||||
|
@ -156,8 +157,13 @@ private:
|
|||
// The length of the data in Expat's buffer (in number of PRUnichars).
|
||||
PRUint32 mExpatBuffered;
|
||||
|
||||
// These sinks all refer the same conceptual object. mOriginalSink is
|
||||
// identical with the nsIContentSink* passed to WillBuildModel, and exists
|
||||
// only to avoid QI-ing back to nsIContentSink*.
|
||||
nsCOMPtr<nsIContentSink> mOriginalSink;
|
||||
nsCOMPtr<nsIExpatSink> mSink;
|
||||
nsCOMPtr<nsIExtendedExpatSink> mExtendedSink;
|
||||
|
||||
const nsCatalogData* mCatalogData; // weak
|
||||
nsString mURISpec;
|
||||
};
|
||||
|
|
|
@ -73,9 +73,19 @@ NS_IMPL_ISUPPORTS1(nsHTMLTokenizer, nsITokenizer)
|
|||
nsHTMLTokenizer::nsHTMLTokenizer(PRInt32 aParseMode,
|
||||
eParserDocType aDocType,
|
||||
eParserCommands aCommand,
|
||||
PRUint16 aFlags) :
|
||||
nsITokenizer(), mTokenDeque(0), mFlags(aFlags)
|
||||
nsIHTMLContentSink* aSink)
|
||||
: nsITokenizer(), mTokenDeque(0), mFlags(0)
|
||||
{
|
||||
if (aSink) {
|
||||
PRBool enabled;
|
||||
aSink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if (enabled)
|
||||
mFlags |= NS_IPARSER_FLAG_FRAMES_ENABLED;
|
||||
aSink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if (enabled)
|
||||
mFlags |= NS_IPARSER_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
|
||||
if (aParseMode == eDTDMode_full_standards ||
|
||||
aParseMode == eDTDMode_almost_standards) {
|
||||
mFlags |= NS_IPARSER_FLAG_STRICT_MODE;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
nsHTMLTokenizer(PRInt32 aParseMode = eDTDMode_quirks,
|
||||
eParserDocType aDocType = eHTML_Quirks,
|
||||
eParserCommands aCommand = eViewNormal,
|
||||
PRUint16 aFlags = 0);
|
||||
nsIHTMLContentSink* aSink = 0);
|
||||
virtual ~nsHTMLTokenizer();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1508,7 +1508,7 @@ nsParser::WillBuildModel(nsString& aFilename)
|
|||
NS_ENSURE_TRUE(mDTD, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsITokenizer* tokenizer;
|
||||
nsresult rv = mParserContext->GetTokenizer(mDTD, mSink, tokenizer);
|
||||
nsresult rv = mParserContext->GetTokenizer(mDTD, tokenizer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return mDTD->WillBuildModel(*mParserContext, tokenizer, mSink);
|
||||
|
@ -1531,7 +1531,7 @@ nsParser::DidBuildModel(nsresult anErrorCode)
|
|||
PRBool terminated = mInternalState == NS_ERROR_HTMLPARSER_STOPPARSING;
|
||||
if (mDTD && mSink &&
|
||||
mSink->ReadyToCallDidBuildModel(terminated)) {
|
||||
result = mDTD->DidBuildModel(anErrorCode,PR_TRUE,this,mSink);
|
||||
result = mDTD->DidBuildModel(anErrorCode,PR_TRUE,this);
|
||||
}
|
||||
|
||||
//Ref. to bug 61462.
|
||||
|
@ -2227,7 +2227,7 @@ nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk,
|
|||
}
|
||||
|
||||
if (mDTD) {
|
||||
mDTD->WillResumeParse(mSink);
|
||||
mDTD->WillResumeParse();
|
||||
PRBool theIterationIsOk = PR_TRUE;
|
||||
|
||||
while (result == NS_OK && theIterationIsOk) {
|
||||
|
@ -2265,7 +2265,7 @@ nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk,
|
|||
// (and cache any data coming in) until the parser is re-enabled.
|
||||
if (NS_ERROR_HTMLPARSER_BLOCK == result) {
|
||||
if (mDTD) {
|
||||
mDTD->WillInterruptParse(mSink);
|
||||
mDTD->WillInterruptParse();
|
||||
}
|
||||
|
||||
if (mFlags & NS_PARSER_FLAG_PARSER_ENABLED) {
|
||||
|
@ -2332,7 +2332,7 @@ nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk,
|
|||
result == NS_ERROR_HTMLPARSER_INTERRUPTED) {
|
||||
result = (result == NS_ERROR_HTMLPARSER_INTERRUPTED) ? NS_OK : result;
|
||||
if (mDTD) {
|
||||
mDTD->WillInterruptParse(mSink);
|
||||
mDTD->WillInterruptParse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2358,13 +2358,13 @@ nsParser::BuildModel()
|
|||
|
||||
nsresult result = NS_OK;
|
||||
if (mParserContext) {
|
||||
result = mParserContext->GetTokenizer(mDTD, mSink, theTokenizer);
|
||||
result = mParserContext->GetTokenizer(mDTD, theTokenizer);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (mDTD) {
|
||||
MOZ_TIMER_START(mDTDTime);
|
||||
result = mDTD->BuildModel(this, theTokenizer, nsnull, mSink);
|
||||
result = mDTD->BuildModel(this, theTokenizer);
|
||||
MOZ_TIMER_STOP(mDTDTime);
|
||||
}
|
||||
} else {
|
||||
|
@ -2981,7 +2981,7 @@ nsParser::WillTokenize(PRBool aIsFinalChunk)
|
|||
}
|
||||
|
||||
nsITokenizer* theTokenizer;
|
||||
nsresult result = mParserContext->GetTokenizer(mDTD, mSink, theTokenizer);
|
||||
nsresult result = mParserContext->GetTokenizer(mDTD, theTokenizer);
|
||||
NS_ENSURE_SUCCESS(result, PR_FALSE);
|
||||
return NS_SUCCEEDED(theTokenizer->WillTokenize(aIsFinalChunk,
|
||||
&mTokenAllocator));
|
||||
|
@ -2999,7 +2999,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk)
|
|||
|
||||
nsresult result = NS_ERROR_NOT_AVAILABLE;
|
||||
if (mParserContext) {
|
||||
result = mParserContext->GetTokenizer(mDTD, mSink, theTokenizer);
|
||||
result = mParserContext->GetTokenizer(mDTD, theTokenizer);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
@ -3074,7 +3074,7 @@ nsParser::DidTokenize(PRBool aIsFinalChunk)
|
|||
}
|
||||
|
||||
nsITokenizer* theTokenizer;
|
||||
nsresult rv = mParserContext->GetTokenizer(mDTD, mSink, theTokenizer);
|
||||
nsresult rv = mParserContext->GetTokenizer(mDTD, theTokenizer);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
rv = theTokenizer->DidTokenize(aIsFinalChunk);
|
||||
|
|
|
@ -338,7 +338,9 @@ nsresult CViewSourceHTML::WillBuildModel(const CParserContext& aParserContext,
|
|||
* @param aFilename is the name of the file being parsed.
|
||||
* @return error code (almost always 0)
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink) {
|
||||
NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,
|
||||
nsITokenizer* aTokenizer)
|
||||
{
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if(aTokenizer && aParser) {
|
||||
|
@ -547,7 +549,10 @@ void CViewSourceHTML::AddAttrToNode(nsCParserStartNode& aNode,
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
|
||||
NS_IMETHODIMP CViewSourceHTML::DidBuildModel(nsresult anErrorCode,
|
||||
PRBool aNotifySink,
|
||||
nsIParser* aParser)
|
||||
{
|
||||
nsresult result= NS_OK;
|
||||
|
||||
//ADD CODE HERE TO CLOSE OPEN CONTAINERS...
|
||||
|
@ -611,13 +616,20 @@ CViewSourceHTML::GetType() {
|
|||
return NS_IPARSER_FLAG_HTML;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsITokenizer*)
|
||||
CViewSourceHTML::CreateTokenizer()
|
||||
{
|
||||
return new nsHTMLTokenizer(mDTDMode, mDocType, mParserCommand, mSink);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess5/18/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::WillResumeParse(nsIContentSink* aSink){
|
||||
NS_IMETHODIMP CViewSourceHTML::WillResumeParse()
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if(mSink) {
|
||||
result = mSink->WillResume();
|
||||
|
@ -631,7 +643,8 @@ NS_IMETHODIMP CViewSourceHTML::WillResumeParse(nsIContentSink* aSink){
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
NS_IMETHODIMP CViewSourceHTML::WillInterruptParse(nsIContentSink* aSink){
|
||||
NS_IMETHODIMP CViewSourceHTML::WillInterruptParse()
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if(mSink) {
|
||||
result = mSink->WillInterrupt();
|
||||
|
|
Загрузка…
Ссылка в новой задаче