WIP on fixing <noscript> bug for real -- post dogfood. r=syd

This commit is contained in:
rickg%netscape.com 1999-12-07 07:25:56 +00:00
Родитель 10e1f95da8
Коммит 78c5d8cb44
2 изменённых файлов: 148 добавлений и 116 удалений

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

@ -250,18 +250,19 @@ public:
SinkContext* mHeadContext; SinkContext* mHeadContext;
PRInt32 mNumOpenIFRAMES; PRInt32 mNumOpenIFRAMES;
nsString* mRef; nsString* mRef;
nsScrollPreference mOriginalScrollPreference; nsScrollPreference mOriginalScrollPreference;
PRBool mNotAtRef; PRBool mNotAtRef;
nsIHTMLContent* mRefContent; nsIHTMLContent* mRefContent;
nsString mBaseHREF; nsString mBaseHREF;
nsString mBaseTarget; nsString mBaseTarget;
nsString mPreferredStyle; nsString mPreferredStyle;
PRInt32 mStyleSheetCount; PRInt32 mStyleSheetCount;
nsICSSLoader* mCSSLoader; nsICSSLoader* mCSSLoader;
PRUint32 mContentIDCounter; PRUint32 mContentIDCounter;
PRInt32 mInsideNoXXXTag;
void StartLayout(); void StartLayout();
@ -1197,28 +1198,36 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
// Special handling for certain tags // Special handling for certain tags
switch (nodeType) { switch (nodeType) {
case eHTMLTag_a:
mSink->ProcessATag(aNode, content); case eHTMLTag_noembed:
break; case eHTMLTag_noframes:
case eHTMLTag_table: case eHTMLTag_nolayer:
case eHTMLTag_layer: case eHTMLTag_noscript:
case eHTMLTag_thead: mSink->mInsideNoXXXTag++;
case eHTMLTag_tbody: break;
case eHTMLTag_tfoot:
case eHTMLTag_tr: case eHTMLTag_a:
case eHTMLTag_td: mSink->ProcessATag(aNode, content);
case eHTMLTag_th: break;
// XXX if navigator_quirks_mode (only body in html supports background) case eHTMLTag_table:
mSink->AddBaseTagInfo(content); case eHTMLTag_layer:
break; case eHTMLTag_thead:
case eHTMLTag_map: case eHTMLTag_tbody:
mSink->ProcessMAPTag(aNode, content); case eHTMLTag_tfoot:
break; case eHTMLTag_tr:
case eHTMLTag_iframe: case eHTMLTag_td:
mSink->mNumOpenIFRAMES++; case eHTMLTag_th:
break; // XXX if navigator_quirks_mode (only body in html supports background)
default: mSink->AddBaseTagInfo(content);
break; break;
case eHTMLTag_map:
mSink->ProcessMAPTag(aNode, content);
break;
case eHTMLTag_iframe:
mSink->mNumOpenIFRAMES++;
break;
default:
break;
} }
return NS_OK; return NS_OK;
@ -1293,37 +1302,44 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
// Special handling for certain tags // Special handling for certain tags
switch (nodeType) { switch (nodeType) {
case eHTMLTag_form: case eHTMLTag_noembed:
{ case eHTMLTag_noframes:
nsHTMLTag parserNodeType = nsHTMLTag(aNode.GetNodeType()); case eHTMLTag_nolayer:
case eHTMLTag_noscript:
mSink->mInsideNoXXXTag--;
break;
case eHTMLTag_form:
{
nsHTMLTag parserNodeType = nsHTMLTag(aNode.GetNodeType());
// If there's a FORM on the stack, but this close tag doesn't // If there's a FORM on the stack, but this close tag doesn't
// close the form, then close out the form *and* close out the // close the form, then close out the form *and* close out the
// next container up. This is since the parser doesn't do fix up // next container up. This is since the parser doesn't do fix up
// of invalid form nesting. When the end FORM tag comes through, // of invalid form nesting. When the end FORM tag comes through,
// we'll ignore it. // we'll ignore it.
if (parserNodeType != nodeType) { if (parserNodeType != nodeType) {
result = CloseContainer(aNode); result = CloseContainer(aNode);
}
} }
} break;
break;
case eHTMLTag_iframe: case eHTMLTag_iframe:
mSink->mNumOpenIFRAMES--; mSink->mNumOpenIFRAMES--;
break; break;
case eHTMLTag_select: case eHTMLTag_select:
{ {
nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &result); nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &result);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
result = select->DoneAddingContent(PR_TRUE); result = select->DoneAddingContent(PR_TRUE);
}
} }
} break;
break;
default: default:
break; break;
} }
@ -1894,8 +1910,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult,
} }
// Note: operator new zeros our memory // Note: operator new zeros our memory
HTMLContentSink::HTMLContentSink() HTMLContentSink::HTMLContentSink() {
{
#ifdef NS_DEBUG #ifdef NS_DEBUG
if (nsnull == gSinkLogModuleInfo) { if (nsnull == gSinkLogModuleInfo) {
gSinkLogModuleInfo = PR_NewLogModule("htmlcontentsink"); gSinkLogModuleInfo = PR_NewLogModule("htmlcontentsink");
@ -1904,6 +1919,7 @@ HTMLContentSink::HTMLContentSink()
mNotAtRef = PR_TRUE; mNotAtRef = PR_TRUE;
mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE; mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE;
mInScript = 0; mInScript = 0;
mInsideNoXXXTag = 0;
} }
HTMLContentSink::~HTMLContentSink() HTMLContentSink::~HTMLContentSink()

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

@ -250,18 +250,19 @@ public:
SinkContext* mHeadContext; SinkContext* mHeadContext;
PRInt32 mNumOpenIFRAMES; PRInt32 mNumOpenIFRAMES;
nsString* mRef; nsString* mRef;
nsScrollPreference mOriginalScrollPreference; nsScrollPreference mOriginalScrollPreference;
PRBool mNotAtRef; PRBool mNotAtRef;
nsIHTMLContent* mRefContent; nsIHTMLContent* mRefContent;
nsString mBaseHREF; nsString mBaseHREF;
nsString mBaseTarget; nsString mBaseTarget;
nsString mPreferredStyle; nsString mPreferredStyle;
PRInt32 mStyleSheetCount; PRInt32 mStyleSheetCount;
nsICSSLoader* mCSSLoader; nsICSSLoader* mCSSLoader;
PRUint32 mContentIDCounter; PRUint32 mContentIDCounter;
PRInt32 mInsideNoXXXTag;
void StartLayout(); void StartLayout();
@ -1197,28 +1198,36 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
// Special handling for certain tags // Special handling for certain tags
switch (nodeType) { switch (nodeType) {
case eHTMLTag_a:
mSink->ProcessATag(aNode, content); case eHTMLTag_noembed:
break; case eHTMLTag_noframes:
case eHTMLTag_table: case eHTMLTag_nolayer:
case eHTMLTag_layer: case eHTMLTag_noscript:
case eHTMLTag_thead: mSink->mInsideNoXXXTag++;
case eHTMLTag_tbody: break;
case eHTMLTag_tfoot:
case eHTMLTag_tr: case eHTMLTag_a:
case eHTMLTag_td: mSink->ProcessATag(aNode, content);
case eHTMLTag_th: break;
// XXX if navigator_quirks_mode (only body in html supports background) case eHTMLTag_table:
mSink->AddBaseTagInfo(content); case eHTMLTag_layer:
break; case eHTMLTag_thead:
case eHTMLTag_map: case eHTMLTag_tbody:
mSink->ProcessMAPTag(aNode, content); case eHTMLTag_tfoot:
break; case eHTMLTag_tr:
case eHTMLTag_iframe: case eHTMLTag_td:
mSink->mNumOpenIFRAMES++; case eHTMLTag_th:
break; // XXX if navigator_quirks_mode (only body in html supports background)
default: mSink->AddBaseTagInfo(content);
break; break;
case eHTMLTag_map:
mSink->ProcessMAPTag(aNode, content);
break;
case eHTMLTag_iframe:
mSink->mNumOpenIFRAMES++;
break;
default:
break;
} }
return NS_OK; return NS_OK;
@ -1293,37 +1302,44 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
// Special handling for certain tags // Special handling for certain tags
switch (nodeType) { switch (nodeType) {
case eHTMLTag_form: case eHTMLTag_noembed:
{ case eHTMLTag_noframes:
nsHTMLTag parserNodeType = nsHTMLTag(aNode.GetNodeType()); case eHTMLTag_nolayer:
case eHTMLTag_noscript:
mSink->mInsideNoXXXTag--;
break;
case eHTMLTag_form:
{
nsHTMLTag parserNodeType = nsHTMLTag(aNode.GetNodeType());
// If there's a FORM on the stack, but this close tag doesn't // If there's a FORM on the stack, but this close tag doesn't
// close the form, then close out the form *and* close out the // close the form, then close out the form *and* close out the
// next container up. This is since the parser doesn't do fix up // next container up. This is since the parser doesn't do fix up
// of invalid form nesting. When the end FORM tag comes through, // of invalid form nesting. When the end FORM tag comes through,
// we'll ignore it. // we'll ignore it.
if (parserNodeType != nodeType) { if (parserNodeType != nodeType) {
result = CloseContainer(aNode); result = CloseContainer(aNode);
}
} }
} break;
break;
case eHTMLTag_iframe: case eHTMLTag_iframe:
mSink->mNumOpenIFRAMES--; mSink->mNumOpenIFRAMES--;
break; break;
case eHTMLTag_select: case eHTMLTag_select:
{ {
nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &result); nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &result);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
result = select->DoneAddingContent(PR_TRUE); result = select->DoneAddingContent(PR_TRUE);
}
} }
} break;
break;
default: default:
break; break;
} }
@ -1894,8 +1910,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult,
} }
// Note: operator new zeros our memory // Note: operator new zeros our memory
HTMLContentSink::HTMLContentSink() HTMLContentSink::HTMLContentSink() {
{
#ifdef NS_DEBUG #ifdef NS_DEBUG
if (nsnull == gSinkLogModuleInfo) { if (nsnull == gSinkLogModuleInfo) {
gSinkLogModuleInfo = PR_NewLogModule("htmlcontentsink"); gSinkLogModuleInfo = PR_NewLogModule("htmlcontentsink");
@ -1904,6 +1919,7 @@ HTMLContentSink::HTMLContentSink()
mNotAtRef = PR_TRUE; mNotAtRef = PR_TRUE;
mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE; mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE;
mInScript = 0; mInScript = 0;
mInsideNoXXXTag = 0;
} }
HTMLContentSink::~HTMLContentSink() HTMLContentSink::~HTMLContentSink()