зеркало из https://github.com/mozilla/pjs.git
Bug 484121 (1/6) - Decompose nsHTMLTokenizer::GetFlags. r+sr=mrbkap
This commit is contained in:
Родитель
7964c8f00a
Коммит
a56545afcb
|
@ -233,18 +233,8 @@ CNavDTD::WillBuildModel(const CParserContext& aParserContext,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (mSink) {
|
||||
PRBool enabled = PR_TRUE;
|
||||
mSink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if (enabled) {
|
||||
mFlags |= NS_IPARSER_FLAG_FRAMES_ENABLED;
|
||||
}
|
||||
|
||||
mSink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if (enabled) {
|
||||
mFlags |= NS_IPARSER_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
}
|
||||
mFlags |= nsHTMLTokenizer::GetFlags(aSink);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -105,25 +105,8 @@ CParserContext::GetTokenizer(nsIDTD* aDTD,
|
|||
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);
|
||||
mTokenizer = new nsHTMLTokenizer(mDTDMode, mDocType, mParserCommand,
|
||||
nsHTMLTokenizer::GetFlags(aSink));
|
||||
if (!mTokenizer) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,26 @@ nsHTMLTokenizer::~nsHTMLTokenizer()
|
|||
mTokenDeque.ForEach(theDeallocator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*static*/ PRUint32
|
||||
nsHTMLTokenizer::GetFlags(const nsIContentSink* aSink)
|
||||
{
|
||||
PRUint32 flags = 0;
|
||||
nsCOMPtr<nsIHTMLContentSink> sink =
|
||||
do_QueryInterface(const_cast<nsIContentSink*>(aSink));
|
||||
if (sink) {
|
||||
PRBool enabled = PR_TRUE;
|
||||
sink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if (enabled) {
|
||||
flags |= NS_IPARSER_FLAG_FRAMES_ENABLED;
|
||||
}
|
||||
sink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if (enabled) {
|
||||
flags |= NS_IPARSER_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Here begins the real working methods for the tokenizer.
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
PRUint16 aFlags = 0);
|
||||
virtual ~nsHTMLTokenizer();
|
||||
|
||||
static PRUint32 GetFlags(const nsIContentSink* aSink);
|
||||
|
||||
protected:
|
||||
|
||||
nsresult ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner& aScanner,PRBool& aFlushTokens);
|
||||
|
|
Загрузка…
Ссылка в новой задаче