69455 - enable noframes content when frames are disabled

r=heikki,sr=waterson,a=choffmann
This commit is contained in:
harishd%netscape.com 2001-04-21 22:22:15 +00:00
Родитель edbb90c5cd
Коммит d4272380d9
40 изменённых файлов: 601 добавлений и 581 удалений

Просмотреть файл

@ -462,18 +462,6 @@ nsPlainTextSerializer::CloseFrameset(const nsIParserNode& aNode)
return CloseContainer(aNode);
}
NS_IMETHODIMP
nsPlainTextSerializer::OpenNoscript(const nsIParserNode& aNode)
{
return OpenContainer(aNode);
}
NS_IMETHODIMP
nsPlainTextSerializer::CloseNoscript(const nsIParserNode& aNode)
{
return CloseContainer(aNode);
}
NS_IMETHODIMP
nsPlainTextSerializer::DoFragment(PRBool aFlag)
{

Просмотреть файл

@ -98,8 +98,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode);
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode);
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition) { return NS_OK; }
NS_IMETHOD EndContext(PRInt32 aPosition) { return NS_OK; }

Просмотреть файл

@ -199,6 +199,7 @@ HTML_ATOM(method, "method")
HTML_ATOM(multicol, "multicol")
HTML_ATOM(multiple, "multiple")
HTML_ATOM(name, "name")
HTML_ATOM(noframes, "noframes")
HTML_ATOM(nohref, "nohref")
HTML_ATOM(noresize, "noresize")
HTML_ATOM(noscript, "noscript")

Просмотреть файл

@ -138,6 +138,9 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
#define SINK_TRACE_REFLOW 0x2
#define SINK_ALWAYS_REFLOW 0x4
#define NS_SINK_FLAG_SCRIPT_ENABLED 0x8
#define NS_SINK_FLAG_FRAMES_ENABLED 0x10
#define SINK_LOG_TEST(_lm,_bit) (PRIntn((_lm)->level) & (_bit))
#define SINK_TRACE(_bit,_args) \
@ -213,8 +216,7 @@ public:
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode);
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode);
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref);
NS_IMETHOD DoFragment(PRBool aFlag);
@ -351,6 +353,7 @@ public:
nsICSSLoader* mCSSLoader;
PRInt32 mInsideNoXXXTag;
PRInt32 mInMonolithicContainer;
PRUint32 mFlags;
void StartLayout();
@ -2203,6 +2206,7 @@ HTMLContentSink::HTMLContentSink() {
mInMonolithicContainer = 0;
mInsideNoXXXTag = 0;
mNodeInfoManager = nsnull;
mFlags=0;
}
HTMLContentSink::~HTMLContentSink()
@ -2307,6 +2311,22 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mWebShell = aContainer;
NS_ADDREF(aContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mWebShell));
NS_ASSERTION(docShell,"oops no docshell!");
if (docShell) {
PRBool enabled;
docShell->GetAllowJavascript(&enabled);
if (enabled) {
mFlags |= NS_SINK_FLAG_SCRIPT_ENABLED;
}
docShell->GetAllowSubframes(&enabled);
if (enabled) {
mFlags |= NS_SINK_FLAG_FRAMES_ENABLED;
}
}
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
if (NS_FAILED(rv)) {
@ -3014,7 +3034,8 @@ HTMLContentSink::OpenFrameset(const nsIParserNode& aNode)
mCurrentContext->mStackPos, this);
nsresult rv = mCurrentContext->OpenContainer(aNode);
if ((NS_OK == rv) && (nsnull == mFrameset)) {
if ((NS_SUCCEEDED(rv)) && (!mFrameset) &&
(mFlags & NS_SINK_FLAG_FRAMES_ENABLED)) {
mFrameset = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
NS_ADDREF(mFrameset);
}
@ -3038,7 +3059,8 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
nsresult rv = sc->CloseContainer(aNode);
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseFrameset()\n"));
MOZ_TIMER_STOP(mWatch);
if (done) {
if (done && (mFlags & NS_SINK_FLAG_FRAMES_ENABLED)) {
StartLayout();
}
return rv;
@ -3080,84 +3102,21 @@ HTMLContentSink::CloseMap(const nsIParserNode& aNode)
return rv;
}
/**
* From the pref determine if the noscript content should be
* processed or not. If java script is enabled then inform
* DTD that the content should be treated as an alternate content,i.e.,
* the content should not be treated as a regular content.
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
NS_IMETHODIMP
HTMLContentSink::OpenNoscript(const nsIParserNode& aNode) {
nsresult result=NS_OK;
HTMLContentSink::GetPref(PRInt32 aTag,PRBool& aPref) {
nsHTMLTag theHTMLTag = nsHTMLTag(aTag);
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenNoscript()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::OpenNoscript", aNode,
mCurrentContext->mStackPos, this);
nsCOMPtr<nsIPref> prefs(do_GetService("@mozilla.org/preferences;1", &result));
if(NS_SUCCEEDED(result)) {
PRBool jsEnabled;
result=prefs->GetBoolPref("javascript.enabled", &jsEnabled);
if(NS_SUCCEEDED(result)){
// If JS is disabled then we want to lose the noscript element
// ,and therefore don't OpenContainer, so that the noscript contents
// get handled as if noscript wasn't present.
if(jsEnabled) {
result=mCurrentContext->OpenContainer(aNode);
if(NS_SUCCEEDED(result)) {
mInsideNoXXXTag++; // To indicate that no processing should be done to this content
result=NS_HTMLPARSER_ALTERNATECONTENT; // Inform DTD that the noscript content should be treated as CDATA.
}
if (theHTMLTag == eHTMLTag_script) {
aPref = mFlags & NS_SINK_FLAG_SCRIPT_ENABLED;
}
else if (theHTMLTag == eHTMLTag_frameset) {
aPref = mFlags & NS_SINK_FLAG_FRAMES_ENABLED;
}
else {
aPref = PR_FALSE;
}
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenNoscript()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
}
/**
* Close noscript and enable processing for rest of the content,
* outside noscript
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
NS_IMETHODIMP
HTMLContentSink::CloseNoscript(const nsIParserNode& aNode) {
// When JS is diabled this method wouldn't get called because
// noscript element will not be present then.
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::CloseNoscript()\n"));
MOZ_TIMER_START(mWatch);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseNoscript", aNode,
mCurrentContext->mStackPos-1, this);
nsresult result=mCurrentContext->CloseContainer(aNode);
if(NS_SUCCEEDED(result)) {
NS_ASSERTION((mInsideNoXXXTag > -1), "mInsideNoXXXTag underflow");
if (mInsideNoXXXTag > 0) {
mInsideNoXXXTag--;
}
}
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::CloseNoscript()\n"));
MOZ_TIMER_STOP(mWatch);
return result;
return NS_OK;
}
NS_IMETHODIMP
@ -3168,11 +3127,11 @@ HTMLContentSink::OpenContainer(const nsIParserNode& aNode)
nsresult rv = NS_OK;
// XXX work around parser bug
if (eHTMLTag_frameset == aNode.GetNodeType()) {
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return OpenFrameset(aNode);
rv = OpenFrameset(aNode);
}
else {
rv = mCurrentContext->OpenContainer(aNode);
}
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n"));
MOZ_TIMER_STOP(mWatch);
return rv;

Просмотреть файл

@ -92,6 +92,7 @@ public:
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode);
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode);
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }

Просмотреть файл

@ -199,6 +199,7 @@ HTML_ATOM(method, "method")
HTML_ATOM(multicol, "multicol")
HTML_ATOM(multiple, "multiple")
HTML_ATOM(name, "name")
HTML_ATOM(noframes, "noframes")
HTML_ATOM(nohref, "nohref")
HTML_ATOM(noresize, "noresize")
HTML_ATOM(noscript, "noscript")

Просмотреть файл

@ -139,6 +139,7 @@ nsDocShell::nsDocShell() :
mAllowPlugins(PR_TRUE),
mAllowJavascript(PR_TRUE),
mAllowMetaRedirects(PR_TRUE),
mAllowSubframes(PR_TRUE),
mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
mBusyFlags(BUSY_FLAGS_NONE),
mEODForCurrentDocument (PR_FALSE),
@ -750,6 +751,21 @@ nsDocShell::SetAllowMetaRedirects(PRBool aValue)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetAllowSubframes(PRBool* aAllowSubframes)
{
NS_ENSURE_ARG_POINTER(aAllowSubframes);
*aAllowSubframes = mAllowSubframes;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetAllowSubframes(PRBool aAllowSubframes)
{
mAllowSubframes = aAllowSubframes;
return NS_OK;
}
NS_IMETHODIMP nsDocShell::GetAppType(PRUint32* aAppType)
{
@ -1687,6 +1703,8 @@ NS_IMETHODIMP nsDocShell::Create()
// so read it in once here and be done with it...
mPrefs->GetBoolPref("network.protocols.useSystemDefaults", &mUseExternalProtocolHandler);
mPrefs->GetBoolPref("browser.target_new_blocked", &mDisallowPopupWindows);
mPrefs->GetBoolPref("javascript.enabled", &mAllowJavascript);
mPrefs->GetBoolPref("browser.frames.enabled", &mAllowSubframes);
return NS_OK;
}

Просмотреть файл

@ -293,6 +293,7 @@ protected:
PRBool mAllowPlugins;
PRBool mAllowJavascript;
PRBool mAllowMetaRedirects;
PRBool mAllowSubframes;
PRUint32 mAppType;
PRInt32 mChildOffset; // Offset in the parent's child list.
PRUint32 mBusyFlags;

Просмотреть файл

@ -148,11 +148,16 @@ interface nsIDocShell : nsISupports
*/
attribute boolean allowJavascript;
/**
* Attribute stating if refresh based redirects can be allowed
/*
Attribute stating if refresh based redirects can be allowed
*/
attribute boolean allowMetaRedirects;
/*
Attribute stating if it should allow subframes (framesets/iframes) or not.
*/
attribute boolean allowSubframes;
/*
The type of application that created this window

Просмотреть файл

@ -34,7 +34,8 @@ interface nsIWebBrowserSetup : nsISupports
{
const unsigned long SETUP_ALLOW_PLUGINS = 1;
const unsigned long SETUP_ALLOW_JAVASCRIPT = 2;
const unsigned long SETUP_ALLOW_META_REDIRECTS =3;
const unsigned long SETUP_ALLOW_META_REDIRECTS = 3;
const unsigned long SETUP_ALLOW_SUBFRAMES = 4;

Просмотреть файл

@ -629,6 +629,13 @@ NS_IMETHODIMP nsWebBrowser::SetProperty(PRUint32 aId, PRUint32 aValue)
mDocShell->SetAllowMetaRedirects(aValue);
}
break;
case nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES:
{
NS_ENSURE_STATE(mDocShell);
NS_ENSURE_TRUE((aValue == PR_TRUE || aValue == PR_FALSE), NS_ERROR_INVALID_ARG);
mDocShell->SetAllowSubframes(aValue);
}
break;
default:
return NS_ERROR_INVALID_ARG;

Просмотреть файл

@ -71,8 +71,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode){ return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD NotifyError(const nsParserError* aError);

Просмотреть файл

@ -94,15 +94,18 @@ static char gShowCRC;
************************************************************************/
#define NS_PARSER_FLAG_NONE 0x00
#define NS_PARSER_FLAG_HAS_OPEN_BODY 0x01
#define NS_PARSER_FLAG_HAS_OPEN_FORM 0x02
#define NS_PARSER_FLAG_HAS_OPEN_SCRIPT 0x04
#define NS_PARSER_FLAG_HAD_BODY 0x08
#define NS_PARSER_FLAG_HAD_FRAMESET 0x10
#define NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE 0x20
#define NS_PARSER_FLAG_REQUESTED_HEAD 0x40
#define NS_PARSER_FLAG_IS_FORM_CONTAINER 0x80
#define NS_PARSER_FLAG_NONE 0x00000000
#define NS_PARSER_FLAG_HAS_OPEN_BODY 0x00000001
#define NS_PARSER_FLAG_HAS_OPEN_FORM 0x00000002
#define NS_PARSER_FLAG_HAS_OPEN_SCRIPT 0x00000004
#define NS_PARSER_FLAG_HAD_BODY 0x00000008
#define NS_PARSER_FLAG_HAD_FRAMESET 0x00000010
#define NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE 0x00000020
#define NS_PARSER_FLAG_REQUESTED_HEAD 0x00000040
#define NS_PARSER_FLAG_IS_FORM_CONTAINER 0x00000080
#define NS_PARSER_FLAG_SCRIPT_ENABLED 0x00000100
#define NS_PARSER_FLAG_FRAMES_ENABLED 0x00000200
#define NS_PARSER_FLAG_ALTERNATE_CONTENT 0x00000400 // NOFRAMES, NOSCRIPT
/**
* This method gets called as part of our COM-like interfaces.
@ -149,37 +152,41 @@ NS_IMPL_RELEASE(CNavDTD)
*/
CNavDTD::CNavDTD() : nsIDTD(),
mMisplacedContent(0),
mSkippedContent(0) {
mSkippedContent(0),
mSink(0),
mTokenAllocator(0),
mTempContext(0),
mOpenHeadCount(0),
mOpenMapCount(0),
mParser(0),
mTokenizer(0),
mDocType(eHTML3Text),
mDTDMode(eDTDMode_quirks),
mParserCommand(eViewNormal),
mSkipTarget(eHTMLTag_unknown),
mDTDState(NS_OK),
mFlags(NS_PARSER_FLAG_NONE),
#ifdef ENABLE_CRC
mComputedCRC32(0),
mExpectedCRC32(0),
#endif
#ifdef NS_DEBUG
mDTDDebug(0),
#endif
mLineNumber(1)
{
NS_INIT_REFCNT();
mSink = nsnull;
mTempContext=nsnull;
mBodyContext=new nsDTDContext();
mOpenHeadCount=0;
mOpenMapCount=0;
mAlternateTagOpenCount=0;
mLineNumber=1;
mComputedCRC32=0;
mExpectedCRC32=0;
mFlags = NS_PARSER_FLAG_NONE;
mParser=nsnull;
mTokenizer=nsnull;
mDTDState=NS_OK;
mDocType=eHTML3Text;
mDTDDebug=0; // Why is this not ifdefed?
#ifdef RICKG_DEBUG
//DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules");
nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules");
nsHTMLElement::DebugDumpMembership("c:/temp/membership.out");
nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out");
#endif
}
/**
@ -281,7 +288,9 @@ CNavDTD::~CNavDTD(){
NS_IF_RELEASE(mSink);
}
#ifdef NS_DEBUG
NS_IF_RELEASE(mDTDDebug);
#endif
}
@ -323,7 +332,7 @@ PRBool CNavDTD::Verify(nsString& aURLRef,nsIParser* aParser){
* breaks on some compilers because of some broken
* streams code in prstrm.cpp.
*/
#if !defined(MOZ_DISABLE_DTD_DEBUG)
#ifdef NS_DEBUG
if(!mDTDDebug){
nsresult rval = NS_NewDTDDebug(&mDTDDebug);
if (NS_OK != rval) {
@ -332,11 +341,12 @@ PRBool CNavDTD::Verify(nsString& aURLRef,nsIParser* aParser){
}
else mDTDDebug->SetVerificationDirectory(kVerificationDir);
}
#endif
if(mDTDDebug) {
// mDTDDebug->Verify(this,aParser,mBodyContext->GetCount(),mBodyContext->mStack,aURLRef);
}
#endif
return result;
}
@ -408,7 +418,6 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
mFilename=aParserContext.mScanner->GetFilename();
mFlags = NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE; // residual style is always on. This will also reset the flags
mLineNumber=1;
mAlternateTagOpenCount=0;
mDTDMode=aParserContext.mDTDMode;
mParserCommand=aParserContext.mParserCommand;
mMimeType=aParserContext.mMimeType;
@ -432,7 +441,6 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
//proxy for the real sink we're given from the parser.
#ifdef NS_DEBUG
nsLoggingSink *theLogSink=GetLoggingSink();
if(theLogSink) {
theLogSink->SetProxySink(mSink);
@ -445,9 +453,27 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
START_TIMER();
if(mSink) {
PRBool enabled;
mSink->GetPref(eHTMLTag_frameset,enabled);
if(enabled) {
mFlags |= NS_PARSER_FLAG_FRAMES_ENABLED;
}
mSink->GetPref(eHTMLTag_script,enabled);
if(enabled) {
mFlags |= NS_PARSER_FLAG_SCRIPT_ENABLED;
}
}
mSkipTarget=eHTMLTag_unknown;
#ifdef ENABLE_CRC
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
}
}
@ -491,6 +517,12 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
mTokenizer->PushTokenFront(theToken);
}
}
// always open a body if frames are disabled....
if(!(mFlags & NS_PARSER_FLAG_FRAMES_ENABLED)) {
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
mTokenizer->PushTokenFront(theToken);
}
//if the content model is empty, then begin by opening <html>...
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
if(theToken) {
@ -640,9 +672,11 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
IF_FREE(theToken, mTokenAllocator);
}
#ifdef NS_DEBUG
if(mDTDDebug) {
mDTDDebug->DumpVectorRecord();
}
#endif
}
} //if aparser
@ -735,8 +769,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
return result;
}
}
else if(mDTDState==NS_HTMLPARSER_ALTERNATECONTENT) {
if(eHTMLTag_noscript!=theTag || theType!=eToken_end) {
else if(mFlags & NS_PARSER_FLAG_ALTERNATE_CONTENT) {
if(theTag != mBodyContext->Last() || theType!=eToken_end) {
// attribute source is a part of start token.
if(theType!=eToken_attribute) {
aToken->AppendSource(mScratch);
@ -797,6 +831,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
switch(theTag) {
case eHTMLTag_html:
case eHTMLTag_noframes:
case eHTMLTag_noscript:
case eHTMLTag_script:
case eHTMLTag_doctypeDecl:
@ -898,9 +933,9 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
return NS_OK;
}
#if 0
#ifdef NS_DEBUG
if (mDTDDebug) {
mDTDDebug->Verify(this, mParser, mBodyContext->GetCount(), mBodyContext->mStack, mFilename);
//mDTDDebug->Verify(this, mParser, mBodyContext->GetCount(), mBodyContext->mStack, mFilename);
}
#endif
}
@ -1213,17 +1248,10 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsC
theChildAgrees=PR_TRUE;
if(theParentContains) {
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
eHTMLTags theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
}
}
if(theChildAgrees && theChildIsContainer) {
if(theParentTag!=aChildTag) {
@ -1679,11 +1707,6 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
isTokenHandled=PR_TRUE;
break;
case eHTMLTag_noframes:
case eHTMLTag_noembed:
mAlternateTagOpenCount++;
break;
case eHTMLTag_script:
theHeadIsParent=(!(mFlags & NS_PARSER_FLAG_HAS_OPEN_BODY) ||
(mFlags & NS_PARSER_FLAG_REQUESTED_HEAD));
@ -1925,11 +1948,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
StripWSFollowingTag(theChildTag,mTokenizer,mTokenAllocator,mLineNumber);
break;
case eHTMLTag_noframes:
case eHTMLTag_noembed:
mAlternateTagOpenCount--;
//and allow to fall through...
default:
{
//now check to see if this token should be omitted, or
@ -2633,10 +2651,11 @@ PRBool CNavDTD::CanPropagate(eHTMLTags aParentTag,eHTMLTags aChildTag,PRBool aPa
PRBool CNavDTD::CanOmit(eHTMLTags aParent,eHTMLTags aChild,PRBool& aParentContains) {
eHTMLTags theAncestor=gHTMLElements[aChild].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
if(HasOpenContainer(theAncestor))
if (eHTMLTag_unknown!=theAncestor){
if (HasOpenContainer(theAncestor)) {
return PR_TRUE;
}
}
theAncestor=gHTMLElements[aChild].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
@ -3091,13 +3110,6 @@ nsresult CNavDTD::OpenBody(const nsCParserNode *aNode){
mFlags |= NS_PARSER_FLAG_HAD_BODY;
PRBool theBodyIsOpen=HasOpenContainer(eHTMLTag_body);
if(!theBodyIsOpen){
//body is not already open, but head may be so close it
PRInt32 theHTMLPos=mBodyContext->LastOf(eHTMLTag_html);
result=CloseContainersTo(theHTMLPos+1,eHTMLTag_body,PR_TRUE); //close current stack containers.
}
if(NS_OK==result) {
STOP_TIMER();
@ -3108,7 +3120,7 @@ nsresult CNavDTD::OpenBody(const nsCParserNode *aNode){
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
START_TIMER();
if(!theBodyIsOpen) {
if(!HasOpenContainer(eHTMLTag_body)) {
mBodyContext->Push(aNode);
mTokenizer->PrependTokens(mMisplacedContent);
}
@ -3300,77 +3312,6 @@ nsresult CNavDTD::CloseFrameset(const nsIParserNode *aNode){
return result;
}
/**
* This method would determine how the noscript content
* should be handled.
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
nsresult CNavDTD::OpenNoscript(const nsCParserNode *aNode,nsEntryStack* aStyleStack) {
nsresult result=NS_OK;
if(mSink) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenNoscript(), this=%p\n", this));
result=mSink->OpenNoscript(*aNode);
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenNoscript(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
if(result==NS_HTMLPARSER_ALTERNATECONTENT) {
// We're here because the sink has identified that
// JS is enabled and therefore noscript content should
// not be treated as a regular content
++mAlternateTagOpenCount;
mScratch.Truncate();
mScratch.SetCapacity(0);
mBodyContext->Push(aNode,aStyleStack);
mDTDState=result;
result=NS_OK;
}
}
}
return result;
}
/**
* Call this method to stop handling noscript content
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
nsresult CNavDTD::CloseNoscript(const nsIParserNode *aNode) {
nsresult result=NS_OK;
if(mSink) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseNoscript(), this=%p\n", this));
result=mSink->CloseNoscript(*aNode);
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseNoscript(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
NS_ASSERTION((mAlternateTagOpenCount > -1), "mAlternateTagOpenCount underflow");
if(mAlternateTagOpenCount > 0) {
mAlternateTagOpenCount--;
}
mDTDState=NS_OK; // switch from alternate content state to regular state
}
}
return result;
}
/**
* This method does two things: 1st, help construct
* our own internal model of the content-stack; and
@ -3385,7 +3326,7 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
nsresult result=NS_OK;
PRBool isDefaultNode=PR_FALSE;
PRBool done=PR_TRUE;
if (nsHTMLElement::IsResidualStyleTag(aTag)) {
@ -3430,7 +3371,9 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
CloseHead(aNode); //do this just in case someone left it open...
result=OpenBody(aNode);
}
else isDefaultNode=PR_TRUE;
else {
done=PR_FALSE;
}
}
break;
@ -3472,25 +3415,41 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
break;
case eHTMLTag_noscript:
result=OpenNoscript(aNode,aStyleStack);
// If the script is disabled noscript should not be
// in the content model until the layout can somehow
// turn noscript's display property to block <-- bug 67899
if(mFlags & NS_PARSER_FLAG_SCRIPT_ENABLED) {
done=PR_FALSE;
mScratch.Truncate();
mFlags |= NS_PARSER_FLAG_ALTERNATE_CONTENT;
}
break;
case eHTMLTag_noframes:
done=PR_FALSE;
if(mFlags & NS_PARSER_FLAG_FRAMES_ENABLED) {
mScratch.Truncate();
mFlags |= NS_PARSER_FLAG_ALTERNATE_CONTENT;
}
break;
default:
isDefaultNode=PR_TRUE;
done=PR_FALSE;
break;
}
if(!done) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
if(isDefaultNode) {
result=(mSink) ? mSink->OpenContainer(*aNode) : NS_OK;
mBodyContext->Push(aNode,aStyleStack);
}
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Push(aNode,aStyleStack);
}
return result;
}
@ -3545,9 +3504,10 @@ CNavDTD::CloseContainer(const nsCParserNode *aNode,eHTMLTags aTarget,PRBool aClo
break;
case eHTMLTag_noscript:
result=CloseNoscript(aNode);
break;
case eHTMLTag_noframes:
// switch from alternate content state to regular state
mFlags &= ~NS_PARSER_FLAG_ALTERNATE_CONTENT;
// falling thro' intentionally....
case eHTMLTag_title:
default:
@ -3602,12 +3562,11 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC
}
/*************************************************************
I've added a check (mAlternateTagOpenCount) below to prevent residual
style handling from getting invoked in these cases.
This fixes bug 25214.
Do not invoke residual style handling when dealing with
alternate content. This fixes bug 25214.
*************************************************************/
if(theTagIsStyle && (0==mAlternateTagOpenCount)) {
if(theTagIsStyle && !(mFlags & NS_PARSER_FLAG_ALTERNATE_CONTENT)) {
PRBool theTargetTagIsStyle=nsHTMLElement::IsResidualStyleTag(aTarget);

Просмотреть файл

@ -430,7 +430,6 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
nsresult OpenForm(const nsIParserNode *aNode);
nsresult OpenMap(const nsCParserNode *aNode);
nsresult OpenFrameset(const nsCParserNode *aNode);
nsresult OpenNoscript(const nsCParserNode *aNode,nsEntryStack* aStyleStack=0);
nsresult OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,nsEntryStack* aStyleStack=0);
/**
@ -446,7 +445,6 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
nsresult CloseForm(const nsIParserNode *aNode);
nsresult CloseMap(const nsIParserNode *aNode);
nsresult CloseFrameset(const nsIParserNode *aNode);
nsresult CloseNoscript(const nsIParserNode *aNode);
/**
* The special purpose methods automatically close
@ -494,40 +492,37 @@ protected:
nsresult HandleKeyGen(nsIParserNode *aNode);
void RecycleNodes(nsEntryStack *aNodeStack);
nsIHTMLContentSink* mSink;
nsDTDContext* mBodyContext;
nsDTDContext* mTempContext;
PRInt32 mOpenHeadCount;
PRInt32 mOpenMapCount;
PRInt32 mAlternateTagOpenCount; //true when NOFRAMES, NOSCRIPT, NOEMBED, NOLAYER are open
PRInt32 mLineNumber;
PRUint32 mComputedCRC32;
PRUint32 mExpectedCRC32;
PRUint16 mFlags;
nsString mFilename;
nsString mScratch; //used for various purposes; non-persistent
nsAutoString mMimeType; //ok as an autostring; these are short.
nsIDTDDebug* mDTDDebug;
nsITokenizer* mTokenizer;
nsParser* mParser;
nsTokenAllocator* mTokenAllocator;
nsNodeAllocator mNodeAllocator;
nsDeque mMisplacedContent;
nsDeque mSkippedContent;
nsresult mDTDState;
nsIHTMLContentSink* mSink;
nsTokenAllocator* mTokenAllocator;
nsDTDContext* mBodyContext;
nsDTDContext* mTempContext;
PRInt32 mOpenHeadCount;
PRInt32 mOpenMapCount;
nsParser* mParser;
nsITokenizer* mTokenizer;
nsDTDMode mDTDMode;
eHTMLTags mSkipTarget;
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
eParserDocType mDocType;
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
eHTMLTags mSkipTarget;
nsresult mDTDState;
PRUint16 mFlags;
PRInt32 mLineNumber;
nsString mScratch; //used for various purposes; non-persistent
nsAutoString mMimeType; //ok as an autostring; these are short.
nsNodeAllocator mNodeAllocator;
#ifdef NS_DEBUG
nsString mFilename;
nsIDTDDebug* mDTDDebug;
#endif
#ifdef ENABLE_CRC
PRUint32 mComputedCRC32;
PRUint32 mExpectedCRC32;
#endif
};
inline nsresult NS_NewNavHTMLDTD(nsIDTD** aInstancePtrResult)

Просмотреть файл

@ -350,7 +350,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kHTMLContent,(kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kOmitEndTag, kBodyPropRange,
/*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown);
/*special parents,kids,skip*/ 0,&gBodyKids,eHTMLTag_unknown);
Initialize(
/*tag*/ eHTMLTag_br,
@ -857,7 +857,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kNone,
/*special props, prop-range*/ 0, kNoPropRange,
/*special parents,kids,skip*/ &gNoframeRoot,0,eHTMLTag_noframes); // Added noframes - fix bug 62803 - since Mozilla supports frames.
/*special parents,kids,skip*/ &gNoframeRoot,0,eHTMLTag_unknown);
Initialize(
/*tag*/ eHTMLTag_nolayer,

Просмотреть файл

@ -571,8 +571,6 @@ USE_GENERAL_OPEN_METHOD(OpenMap, eHTMLTag_map)
USE_GENERAL_CLOSE_METHOD(CloseMap, eHTMLTag_map)
USE_GENERAL_OPEN_METHOD(OpenFrameset, eHTMLTag_frameset)
USE_GENERAL_CLOSE_METHOD(CloseFrameset, eHTMLTag_frameset)
USE_GENERAL_OPEN_METHOD(OpenNoscript, eHTMLTag_noscript)
USE_GENERAL_CLOSE_METHOD(CloseNoscript, eHTMLTag_noscript)
/**
*

Просмотреть файл

@ -138,8 +138,7 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSinkStream
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) ;
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode);
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);
NS_IMETHOD EndContext(PRInt32 aPosition);

Просмотреть файл

@ -70,8 +70,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode){ return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);

Просмотреть файл

@ -190,23 +190,6 @@ public:
*/
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used in opening a NOSCRIPT container.
*
* @update harishd 08/25/00
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode)=0;
/**
* This method is used in closing a NOSCRIPT container.
*
* @update harishd 08/25/00
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode)=0;
/**
* This method tells the sink whether or not it is
* encoding an HTML fragment or the whole document.
@ -236,6 +219,14 @@ public:
*/
NS_IMETHOD EndContext(PRInt32 aPosition)=0;
/**
* Use this method to retrieve pref. for the tag.
*
* @update 04/11/01 harishd
* @param aTag - Check pref. for this tag.
*/
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref)=0;
};
extern NS_HTMLPARS nsresult NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult);

Просмотреть файл

@ -304,9 +304,6 @@ class nsIParser : public nsISupports {
#define NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1016)
#define NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1017)
#define NS_HTMLPARSER_ALTERNATECONTENT NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,1)
#define NS_ERROR_HTMLPARSER_CONTINUE NS_OK

Просмотреть файл

@ -72,8 +72,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);
NS_IMETHOD EndContext(PRInt32 aPosition);

Просмотреть файл

@ -97,7 +97,12 @@ public:
class CSharedParserObjects {
public:
CSharedParserObjects() : mDTDDeque(0) {
CSharedParserObjects()
:mDTDDeque(0),
mHasViewSourceDTD(PR_FALSE),
mHasXMLDTD(PR_FALSE),
mOtherDTD(nsnull)
{
//Note: To cut down on startup time/overhead, we defer the construction of non-html DTD's.
@ -111,6 +116,10 @@ public:
}
NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD...
// please handle allocation failure
NS_ASSERTION(theDTD, "Failed to create DTD");
mDTDDeque.Push(theDTD);
mHasViewSourceDTD=PR_FALSE;

Просмотреть файл

@ -2,8 +2,9 @@
use Cwd;
$path=`cd`;
$path=~m/:/;
$path=`pwd`;;
$path=~m/mozilla/;
$drive=$`;
@ -17,14 +18,16 @@
if($ARGV[0] eq "-b") {
foreach $input(<FILE_LIST>) {
$input =~s/\n//g;
@output=split(/\./,$input);
system("$drive://mozilla//dist//WIN32_D.obj//bin//TestParser.exe $input $output[0].b");
system("$drive\mozilla/dist/WIN32_D.obj/bin/TestParser.exe $input $output[0].b");
}
}
elsif($ARGV[0] eq "-v") {
foreach $input(<FILE_LIST>) {
$input =~s/\n//g;
@output=split(/\./,$input);
system("$drive://mozilla//dist//WIN32_D.obj//bin//TestParser.exe $input $output[0].v");
system("$drive\mozilla/dist/WIN32_D.obj/bin/TestParser.exe $input $output[0].v");
system("fc $output[0].b $output[0].v");
}
}

Просмотреть файл

@ -82,6 +82,7 @@
#include "nsIXBLBinding.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
#include "nsIDocShell.h"
#include "nsFormControlHelper.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
@ -4834,16 +4835,67 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresShell* aPresShell,
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
rv = NS_NewHTMLFramesetFrame(aPresShell, &newFrame);
canBePositioned = PR_FALSE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFramesetFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::iframe == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::noframes == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
// make <noframes> be display:none if frames are enabled
nsStyleDisplay* display = (nsStyleDisplay*)aStyleContext->GetMutableStyleData(eStyleStruct_Display);
display->mDisplay = NS_STYLE_DISPLAY_NONE;
aState.mFrameManager->SetUndisplayedContent(aContent, aStyleContext);
}
else {
processChildren = PR_TRUE;
rv = NS_NewBlockFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::spacer == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
@ -5449,8 +5501,21 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
else if (aTag == nsXULAtoms::iframe || aTag == nsXULAtoms::editor ||
aTag == nsXULAtoms::browser) {
isReplaced = PR_TRUE;
// XXX should turning off frames allow XUL iframes?
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
}
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(aPresShell, &newFrame);

Просмотреть файл

@ -376,6 +376,11 @@ iframe {
border: 2px inset;
}
noframes {
display: block;
}
/* focusable content */
/* links */
@ -398,8 +403,8 @@ iframe {
}
/* hidden elements */
area, base, basefont, head, meta, script, style, title, noembed,
noscript, noframes, param, :-moz-comment, :-moz-pi {
area, base, basefont, head, meta, script, style, title,
noembed, noscript, param, :-moz-comment, :-moz-pi {
display: none;
}

Просмотреть файл

@ -82,6 +82,7 @@
#include "nsIXBLBinding.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
#include "nsIDocShell.h"
#include "nsFormControlHelper.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
@ -4834,16 +4835,67 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresShell* aPresShell,
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
rv = NS_NewHTMLFramesetFrame(aPresShell, &newFrame);
canBePositioned = PR_FALSE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFramesetFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::iframe == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::noframes == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
}
isReplaced = PR_TRUE;
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
// make <noframes> be display:none if frames are enabled
nsStyleDisplay* display = (nsStyleDisplay*)aStyleContext->GetMutableStyleData(eStyleStruct_Display);
display->mDisplay = NS_STYLE_DISPLAY_NONE;
aState.mFrameManager->SetUndisplayedContent(aContent, aStyleContext);
}
else {
processChildren = PR_TRUE;
rv = NS_NewBlockFrame(aPresShell, &newFrame);
}
}
else if (nsHTMLAtoms::spacer == aTag) {
if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames
ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems);
@ -5449,8 +5501,21 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
else if (aTag == nsXULAtoms::iframe || aTag == nsXULAtoms::editor ||
aTag == nsXULAtoms::browser) {
isReplaced = PR_TRUE;
// XXX should turning off frames allow XUL iframes?
PRBool allowSubframes = PR_TRUE;
if (aPresContext) {
nsCOMPtr<nsISupports> container;
aPresContext->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
docShell->GetAllowSubframes(&allowSubframes);
}
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
}
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(aPresShell, &newFrame);

Просмотреть файл

@ -376,6 +376,11 @@ iframe {
border: 2px inset;
}
noframes {
display: block;
}
/* focusable content */
/* links */
@ -398,8 +403,8 @@ iframe {
}
/* hidden elements */
area, base, basefont, head, meta, script, style, title, noembed,
noscript, noframes, param, :-moz-comment, :-moz-pi {
area, base, basefont, head, meta, script, style, title,
noembed, noscript, param, :-moz-comment, :-moz-pi {
display: none;
}

Просмотреть файл

@ -112,6 +112,9 @@ pref("browser.PICS.service.http___home_netscape_com_default_rating.s", 0);
pref("browser.target_new_blocked", false);
// loading and rendering of framesets and iframes
pref("browser.frames.enabled", true);
// view source
pref("view_source.syntax_highlight", true);

Просмотреть файл

@ -71,8 +71,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode){ return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsIParserNode& aNode);
NS_IMETHOD NotifyError(const nsParserError* aError);

Просмотреть файл

@ -94,15 +94,18 @@ static char gShowCRC;
************************************************************************/
#define NS_PARSER_FLAG_NONE 0x00
#define NS_PARSER_FLAG_HAS_OPEN_BODY 0x01
#define NS_PARSER_FLAG_HAS_OPEN_FORM 0x02
#define NS_PARSER_FLAG_HAS_OPEN_SCRIPT 0x04
#define NS_PARSER_FLAG_HAD_BODY 0x08
#define NS_PARSER_FLAG_HAD_FRAMESET 0x10
#define NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE 0x20
#define NS_PARSER_FLAG_REQUESTED_HEAD 0x40
#define NS_PARSER_FLAG_IS_FORM_CONTAINER 0x80
#define NS_PARSER_FLAG_NONE 0x00000000
#define NS_PARSER_FLAG_HAS_OPEN_BODY 0x00000001
#define NS_PARSER_FLAG_HAS_OPEN_FORM 0x00000002
#define NS_PARSER_FLAG_HAS_OPEN_SCRIPT 0x00000004
#define NS_PARSER_FLAG_HAD_BODY 0x00000008
#define NS_PARSER_FLAG_HAD_FRAMESET 0x00000010
#define NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE 0x00000020
#define NS_PARSER_FLAG_REQUESTED_HEAD 0x00000040
#define NS_PARSER_FLAG_IS_FORM_CONTAINER 0x00000080
#define NS_PARSER_FLAG_SCRIPT_ENABLED 0x00000100
#define NS_PARSER_FLAG_FRAMES_ENABLED 0x00000200
#define NS_PARSER_FLAG_ALTERNATE_CONTENT 0x00000400 // NOFRAMES, NOSCRIPT
/**
* This method gets called as part of our COM-like interfaces.
@ -149,37 +152,41 @@ NS_IMPL_RELEASE(CNavDTD)
*/
CNavDTD::CNavDTD() : nsIDTD(),
mMisplacedContent(0),
mSkippedContent(0) {
mSkippedContent(0),
mSink(0),
mTokenAllocator(0),
mTempContext(0),
mOpenHeadCount(0),
mOpenMapCount(0),
mParser(0),
mTokenizer(0),
mDocType(eHTML3Text),
mDTDMode(eDTDMode_quirks),
mParserCommand(eViewNormal),
mSkipTarget(eHTMLTag_unknown),
mDTDState(NS_OK),
mFlags(NS_PARSER_FLAG_NONE),
#ifdef ENABLE_CRC
mComputedCRC32(0),
mExpectedCRC32(0),
#endif
#ifdef NS_DEBUG
mDTDDebug(0),
#endif
mLineNumber(1)
{
NS_INIT_REFCNT();
mSink = nsnull;
mTempContext=nsnull;
mBodyContext=new nsDTDContext();
mOpenHeadCount=0;
mOpenMapCount=0;
mAlternateTagOpenCount=0;
mLineNumber=1;
mComputedCRC32=0;
mExpectedCRC32=0;
mFlags = NS_PARSER_FLAG_NONE;
mParser=nsnull;
mTokenizer=nsnull;
mDTDState=NS_OK;
mDocType=eHTML3Text;
mDTDDebug=0; // Why is this not ifdefed?
#ifdef RICKG_DEBUG
//DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules");
nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules");
nsHTMLElement::DebugDumpMembership("c:/temp/membership.out");
nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out");
#endif
}
/**
@ -281,7 +288,9 @@ CNavDTD::~CNavDTD(){
NS_IF_RELEASE(mSink);
}
#ifdef NS_DEBUG
NS_IF_RELEASE(mDTDDebug);
#endif
}
@ -323,7 +332,7 @@ PRBool CNavDTD::Verify(nsString& aURLRef,nsIParser* aParser){
* breaks on some compilers because of some broken
* streams code in prstrm.cpp.
*/
#if !defined(MOZ_DISABLE_DTD_DEBUG)
#ifdef NS_DEBUG
if(!mDTDDebug){
nsresult rval = NS_NewDTDDebug(&mDTDDebug);
if (NS_OK != rval) {
@ -332,11 +341,12 @@ PRBool CNavDTD::Verify(nsString& aURLRef,nsIParser* aParser){
}
else mDTDDebug->SetVerificationDirectory(kVerificationDir);
}
#endif
if(mDTDDebug) {
// mDTDDebug->Verify(this,aParser,mBodyContext->GetCount(),mBodyContext->mStack,aURLRef);
}
#endif
return result;
}
@ -408,7 +418,6 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
mFilename=aParserContext.mScanner->GetFilename();
mFlags = NS_PARSER_FLAG_ENABLE_RESIDUAL_STYLE; // residual style is always on. This will also reset the flags
mLineNumber=1;
mAlternateTagOpenCount=0;
mDTDMode=aParserContext.mDTDMode;
mParserCommand=aParserContext.mParserCommand;
mMimeType=aParserContext.mMimeType;
@ -432,7 +441,6 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
//proxy for the real sink we're given from the parser.
#ifdef NS_DEBUG
nsLoggingSink *theLogSink=GetLoggingSink();
if(theLogSink) {
theLogSink->SetProxySink(mSink);
@ -445,9 +453,27 @@ nsresult CNavDTD::WillBuildModel( const CParserContext& aParserContext,nsIConte
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
START_TIMER();
if(mSink) {
PRBool enabled;
mSink->GetPref(eHTMLTag_frameset,enabled);
if(enabled) {
mFlags |= NS_PARSER_FLAG_FRAMES_ENABLED;
}
mSink->GetPref(eHTMLTag_script,enabled);
if(enabled) {
mFlags |= NS_PARSER_FLAG_SCRIPT_ENABLED;
}
}
mSkipTarget=eHTMLTag_unknown;
#ifdef ENABLE_CRC
mComputedCRC32=0;
mExpectedCRC32=0;
#endif
}
}
@ -491,6 +517,12 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
mTokenizer->PushTokenFront(theToken);
}
}
// always open a body if frames are disabled....
if(!(mFlags & NS_PARSER_FLAG_FRAMES_ENABLED)) {
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
mTokenizer->PushTokenFront(theToken);
}
//if the content model is empty, then begin by opening <html>...
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
if(theToken) {
@ -640,9 +672,11 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
IF_FREE(theToken, mTokenAllocator);
}
#ifdef NS_DEBUG
if(mDTDDebug) {
mDTDDebug->DumpVectorRecord();
}
#endif
}
} //if aparser
@ -735,8 +769,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
return result;
}
}
else if(mDTDState==NS_HTMLPARSER_ALTERNATECONTENT) {
if(eHTMLTag_noscript!=theTag || theType!=eToken_end) {
else if(mFlags & NS_PARSER_FLAG_ALTERNATE_CONTENT) {
if(theTag != mBodyContext->Last() || theType!=eToken_end) {
// attribute source is a part of start token.
if(theType!=eToken_attribute) {
aToken->AppendSource(mScratch);
@ -797,6 +831,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
switch(theTag) {
case eHTMLTag_html:
case eHTMLTag_noframes:
case eHTMLTag_noscript:
case eHTMLTag_script:
case eHTMLTag_doctypeDecl:
@ -898,9 +933,9 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
return NS_OK;
}
#if 0
#ifdef NS_DEBUG
if (mDTDDebug) {
mDTDDebug->Verify(this, mParser, mBodyContext->GetCount(), mBodyContext->mStack, mFilename);
//mDTDDebug->Verify(this, mParser, mBodyContext->GetCount(), mBodyContext->mStack, mFilename);
}
#endif
}
@ -1213,17 +1248,10 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsC
theChildAgrees=PR_TRUE;
if(theParentContains) {
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
eHTMLTags theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
}
}
if(theChildAgrees && theChildIsContainer) {
if(theParentTag!=aChildTag) {
@ -1679,11 +1707,6 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
isTokenHandled=PR_TRUE;
break;
case eHTMLTag_noframes:
case eHTMLTag_noembed:
mAlternateTagOpenCount++;
break;
case eHTMLTag_script:
theHeadIsParent=(!(mFlags & NS_PARSER_FLAG_HAS_OPEN_BODY) ||
(mFlags & NS_PARSER_FLAG_REQUESTED_HEAD));
@ -1925,11 +1948,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
StripWSFollowingTag(theChildTag,mTokenizer,mTokenAllocator,mLineNumber);
break;
case eHTMLTag_noframes:
case eHTMLTag_noembed:
mAlternateTagOpenCount--;
//and allow to fall through...
default:
{
//now check to see if this token should be omitted, or
@ -2633,10 +2651,11 @@ PRBool CNavDTD::CanPropagate(eHTMLTags aParentTag,eHTMLTags aChildTag,PRBool aPa
PRBool CNavDTD::CanOmit(eHTMLTags aParent,eHTMLTags aChild,PRBool& aParentContains) {
eHTMLTags theAncestor=gHTMLElements[aChild].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
if(HasOpenContainer(theAncestor))
if (eHTMLTag_unknown!=theAncestor){
if (HasOpenContainer(theAncestor)) {
return PR_TRUE;
}
}
theAncestor=gHTMLElements[aChild].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
@ -3091,13 +3110,6 @@ nsresult CNavDTD::OpenBody(const nsCParserNode *aNode){
mFlags |= NS_PARSER_FLAG_HAD_BODY;
PRBool theBodyIsOpen=HasOpenContainer(eHTMLTag_body);
if(!theBodyIsOpen){
//body is not already open, but head may be so close it
PRInt32 theHTMLPos=mBodyContext->LastOf(eHTMLTag_html);
result=CloseContainersTo(theHTMLPos+1,eHTMLTag_body,PR_TRUE); //close current stack containers.
}
if(NS_OK==result) {
STOP_TIMER();
@ -3108,7 +3120,7 @@ nsresult CNavDTD::OpenBody(const nsCParserNode *aNode){
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenBody(), this=%p\n", this));
START_TIMER();
if(!theBodyIsOpen) {
if(!HasOpenContainer(eHTMLTag_body)) {
mBodyContext->Push(aNode);
mTokenizer->PrependTokens(mMisplacedContent);
}
@ -3300,77 +3312,6 @@ nsresult CNavDTD::CloseFrameset(const nsIParserNode *aNode){
return result;
}
/**
* This method would determine how the noscript content
* should be handled.
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
nsresult CNavDTD::OpenNoscript(const nsCParserNode *aNode,nsEntryStack* aStyleStack) {
nsresult result=NS_OK;
if(mSink) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenNoscript(), this=%p\n", this));
result=mSink->OpenNoscript(*aNode);
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenNoscript(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
if(result==NS_HTMLPARSER_ALTERNATECONTENT) {
// We're here because the sink has identified that
// JS is enabled and therefore noscript content should
// not be treated as a regular content
++mAlternateTagOpenCount;
mScratch.Truncate();
mScratch.SetCapacity(0);
mBodyContext->Push(aNode,aStyleStack);
mDTDState=result;
result=NS_OK;
}
}
}
return result;
}
/**
* Call this method to stop handling noscript content
*
* harishd 08/24/00
* @param aNode - The noscript node
* return NS_OK if succeeded else ERROR
*/
nsresult CNavDTD::CloseNoscript(const nsIParserNode *aNode) {
nsresult result=NS_OK;
if(mSink) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::CloseNoscript(), this=%p\n", this));
result=mSink->CloseNoscript(*aNode);
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::CloseNoscript(), this=%p\n", this));
START_TIMER();
if(NS_SUCCEEDED(result)) {
NS_ASSERTION((mAlternateTagOpenCount > -1), "mAlternateTagOpenCount underflow");
if(mAlternateTagOpenCount > 0) {
mAlternateTagOpenCount--;
}
mDTDState=NS_OK; // switch from alternate content state to regular state
}
}
return result;
}
/**
* This method does two things: 1st, help construct
* our own internal model of the content-stack; and
@ -3385,7 +3326,7 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
nsresult result=NS_OK;
PRBool isDefaultNode=PR_FALSE;
PRBool done=PR_TRUE;
if (nsHTMLElement::IsResidualStyleTag(aTag)) {
@ -3430,7 +3371,9 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
CloseHead(aNode); //do this just in case someone left it open...
result=OpenBody(aNode);
}
else isDefaultNode=PR_TRUE;
else {
done=PR_FALSE;
}
}
break;
@ -3472,25 +3415,41 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedB
break;
case eHTMLTag_noscript:
result=OpenNoscript(aNode,aStyleStack);
// If the script is disabled noscript should not be
// in the content model until the layout can somehow
// turn noscript's display property to block <-- bug 67899
if(mFlags & NS_PARSER_FLAG_SCRIPT_ENABLED) {
done=PR_FALSE;
mScratch.Truncate();
mFlags |= NS_PARSER_FLAG_ALTERNATE_CONTENT;
}
break;
case eHTMLTag_noframes:
done=PR_FALSE;
if(mFlags & NS_PARSER_FLAG_FRAMES_ENABLED) {
mScratch.Truncate();
mFlags |= NS_PARSER_FLAG_ALTERNATE_CONTENT;
}
break;
default:
isDefaultNode=PR_TRUE;
done=PR_FALSE;
break;
}
if(!done) {
STOP_TIMER();
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
if(isDefaultNode) {
result=(mSink) ? mSink->OpenContainer(*aNode) : NS_OK;
mBodyContext->Push(aNode,aStyleStack);
}
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::OpenContainer(), this=%p\n", this));
START_TIMER();
mBodyContext->Push(aNode,aStyleStack);
}
return result;
}
@ -3545,9 +3504,10 @@ CNavDTD::CloseContainer(const nsCParserNode *aNode,eHTMLTags aTarget,PRBool aClo
break;
case eHTMLTag_noscript:
result=CloseNoscript(aNode);
break;
case eHTMLTag_noframes:
// switch from alternate content state to regular state
mFlags &= ~NS_PARSER_FLAG_ALTERNATE_CONTENT;
// falling thro' intentionally....
case eHTMLTag_title:
default:
@ -3602,12 +3562,11 @@ nsresult CNavDTD::CloseContainersTo(PRInt32 anIndex,eHTMLTags aTarget, PRBool aC
}
/*************************************************************
I've added a check (mAlternateTagOpenCount) below to prevent residual
style handling from getting invoked in these cases.
This fixes bug 25214.
Do not invoke residual style handling when dealing with
alternate content. This fixes bug 25214.
*************************************************************/
if(theTagIsStyle && (0==mAlternateTagOpenCount)) {
if(theTagIsStyle && !(mFlags & NS_PARSER_FLAG_ALTERNATE_CONTENT)) {
PRBool theTargetTagIsStyle=nsHTMLElement::IsResidualStyleTag(aTarget);

Просмотреть файл

@ -430,7 +430,6 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
nsresult OpenForm(const nsIParserNode *aNode);
nsresult OpenMap(const nsCParserNode *aNode);
nsresult OpenFrameset(const nsCParserNode *aNode);
nsresult OpenNoscript(const nsCParserNode *aNode,nsEntryStack* aStyleStack=0);
nsresult OpenContainer(const nsCParserNode *aNode,eHTMLTags aTag,PRBool aClosedByStartTag,nsEntryStack* aStyleStack=0);
/**
@ -446,7 +445,6 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
nsresult CloseForm(const nsIParserNode *aNode);
nsresult CloseMap(const nsIParserNode *aNode);
nsresult CloseFrameset(const nsIParserNode *aNode);
nsresult CloseNoscript(const nsIParserNode *aNode);
/**
* The special purpose methods automatically close
@ -494,40 +492,37 @@ protected:
nsresult HandleKeyGen(nsIParserNode *aNode);
void RecycleNodes(nsEntryStack *aNodeStack);
nsIHTMLContentSink* mSink;
nsDTDContext* mBodyContext;
nsDTDContext* mTempContext;
PRInt32 mOpenHeadCount;
PRInt32 mOpenMapCount;
PRInt32 mAlternateTagOpenCount; //true when NOFRAMES, NOSCRIPT, NOEMBED, NOLAYER are open
PRInt32 mLineNumber;
PRUint32 mComputedCRC32;
PRUint32 mExpectedCRC32;
PRUint16 mFlags;
nsString mFilename;
nsString mScratch; //used for various purposes; non-persistent
nsAutoString mMimeType; //ok as an autostring; these are short.
nsIDTDDebug* mDTDDebug;
nsITokenizer* mTokenizer;
nsParser* mParser;
nsTokenAllocator* mTokenAllocator;
nsNodeAllocator mNodeAllocator;
nsDeque mMisplacedContent;
nsDeque mSkippedContent;
nsresult mDTDState;
nsIHTMLContentSink* mSink;
nsTokenAllocator* mTokenAllocator;
nsDTDContext* mBodyContext;
nsDTDContext* mTempContext;
PRInt32 mOpenHeadCount;
PRInt32 mOpenMapCount;
nsParser* mParser;
nsITokenizer* mTokenizer;
nsDTDMode mDTDMode;
eHTMLTags mSkipTarget;
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
eParserDocType mDocType;
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
eHTMLTags mSkipTarget;
nsresult mDTDState;
PRUint16 mFlags;
PRInt32 mLineNumber;
nsString mScratch; //used for various purposes; non-persistent
nsAutoString mMimeType; //ok as an autostring; these are short.
nsNodeAllocator mNodeAllocator;
#ifdef NS_DEBUG
nsString mFilename;
nsIDTDDebug* mDTDDebug;
#endif
#ifdef ENABLE_CRC
PRUint32 mComputedCRC32;
PRUint32 mExpectedCRC32;
#endif
};
inline nsresult NS_NewNavHTMLDTD(nsIDTD** aInstancePtrResult)

Просмотреть файл

@ -350,7 +350,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kHTMLContent,(kFlowEntity|kSelf), kNone,
/*special props, prop-range*/ kOmitEndTag, kBodyPropRange,
/*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown);
/*special parents,kids,skip*/ 0,&gBodyKids,eHTMLTag_unknown);
Initialize(
/*tag*/ eHTMLTag_br,
@ -857,7 +857,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kNone,
/*special props, prop-range*/ 0, kNoPropRange,
/*special parents,kids,skip*/ &gNoframeRoot,0,eHTMLTag_noframes); // Added noframes - fix bug 62803 - since Mozilla supports frames.
/*special parents,kids,skip*/ &gNoframeRoot,0,eHTMLTag_unknown);
Initialize(
/*tag*/ eHTMLTag_nolayer,

Просмотреть файл

@ -571,8 +571,6 @@ USE_GENERAL_OPEN_METHOD(OpenMap, eHTMLTag_map)
USE_GENERAL_CLOSE_METHOD(CloseMap, eHTMLTag_map)
USE_GENERAL_OPEN_METHOD(OpenFrameset, eHTMLTag_frameset)
USE_GENERAL_CLOSE_METHOD(CloseFrameset, eHTMLTag_frameset)
USE_GENERAL_OPEN_METHOD(OpenNoscript, eHTMLTag_noscript)
USE_GENERAL_CLOSE_METHOD(CloseNoscript, eHTMLTag_noscript)
/**
*

Просмотреть файл

@ -138,8 +138,7 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSinkStream
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) ;
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode);
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);
NS_IMETHOD EndContext(PRInt32 aPosition);

Просмотреть файл

@ -70,8 +70,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode){ return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);

Просмотреть файл

@ -190,23 +190,6 @@ public:
*/
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode)=0;
/**
* This method is used in opening a NOSCRIPT container.
*
* @update harishd 08/25/00
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode)=0;
/**
* This method is used in closing a NOSCRIPT container.
*
* @update harishd 08/25/00
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode)=0;
/**
* This method tells the sink whether or not it is
* encoding an HTML fragment or the whole document.
@ -236,6 +219,14 @@ public:
*/
NS_IMETHOD EndContext(PRInt32 aPosition)=0;
/**
* Use this method to retrieve pref. for the tag.
*
* @update 04/11/01 harishd
* @param aTag - Check pref. for this tag.
*/
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref)=0;
};
extern NS_HTMLPARS nsresult NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult);

Просмотреть файл

@ -304,9 +304,6 @@ class nsIParser : public nsISupports {
#define NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1016)
#define NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1017)
#define NS_HTMLPARSER_ALTERNATECONTENT NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,1)
#define NS_ERROR_HTMLPARSER_CONTINUE NS_OK

Просмотреть файл

@ -72,8 +72,7 @@ public:
NS_IMETHOD CloseMap(const nsIParserNode& aNode);
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
NS_IMETHOD CloseFrameset(const nsIParserNode& aNode);
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD CloseNoscript(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
NS_IMETHOD DoFragment(PRBool aFlag);
NS_IMETHOD BeginContext(PRInt32 aPosition);
NS_IMETHOD EndContext(PRInt32 aPosition);

Просмотреть файл

@ -97,7 +97,12 @@ public:
class CSharedParserObjects {
public:
CSharedParserObjects() : mDTDDeque(0) {
CSharedParserObjects()
:mDTDDeque(0),
mHasViewSourceDTD(PR_FALSE),
mHasXMLDTD(PR_FALSE),
mOtherDTD(nsnull)
{
//Note: To cut down on startup time/overhead, we defer the construction of non-html DTD's.
@ -111,6 +116,10 @@ public:
}
NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD...
// please handle allocation failure
NS_ASSERTION(theDTD, "Failed to create DTD");
mDTDDeque.Push(theDTD);
mHasViewSourceDTD=PR_FALSE;

Просмотреть файл

@ -2,8 +2,9 @@
use Cwd;
$path=`cd`;
$path=~m/:/;
$path=`pwd`;;
$path=~m/mozilla/;
$drive=$`;
@ -17,14 +18,16 @@
if($ARGV[0] eq "-b") {
foreach $input(<FILE_LIST>) {
$input =~s/\n//g;
@output=split(/\./,$input);
system("$drive://mozilla//dist//WIN32_D.obj//bin//TestParser.exe $input $output[0].b");
system("$drive\mozilla/dist/WIN32_D.obj/bin/TestParser.exe $input $output[0].b");
}
}
elsif($ARGV[0] eq "-v") {
foreach $input(<FILE_LIST>) {
$input =~s/\n//g;
@output=split(/\./,$input);
system("$drive://mozilla//dist//WIN32_D.obj//bin//TestParser.exe $input $output[0].v");
system("$drive\mozilla/dist/WIN32_D.obj/bin/TestParser.exe $input $output[0].v");
system("fc $output[0].b $output[0].v");
}
}