fixed bugs 17663, 17750, 21779, 21787, 22351, 22406; r=dcone, kmcclusk; a=jar

This commit is contained in:
rickg%netscape.com 1999-12-22 23:12:49 +00:00
Родитель 33e0ceef3c
Коммит 7f2b5212c5
14 изменённых файлов: 68 добавлений и 68 удалений

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

@ -1494,7 +1494,7 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
2. Is it in the rootTag list? If so, then we're gated by it 2. Is it in the rootTag list? If so, then we're gated by it
3. Otherwise its non-specified and we simply presume we can close it. 3. Otherwise its non-specified and we simply presume we can close it.
*/ */
TagList* theCloseTags=gHTMLElements[aCurrentTag].GetAutoCloseEndTags(); TagList* theCloseTags=gHTMLElements[aCurrentTag].GetAutoCloseEndTags();
TagList* theRootTags=gHTMLElements[aCurrentTag].GetEndRootTags(); TagList* theRootTags=gHTMLElements[aCurrentTag].GetEndRootTags();
@ -3401,7 +3401,7 @@ nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) { nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
nsresult result=NS_OK; nsresult result=NS_OK;
if(!mTokenizer) { if(!mTokenizer) {
result=NS_NewHTMLTokenizer(&mTokenizer); result=NS_NewHTMLTokenizer(&mTokenizer,mParseMode,PR_FALSE);
} }
aTokenizer=mTokenizer; aTokenizer=mTokenizer;
return result; return result;

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

@ -60,7 +60,6 @@ TagList gParamParents={2,{eHTMLTag_applet,eHTMLTag_object}};
TagList gTRParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}}; TagList gTRParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}};
TagList gTREndParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}}; TagList gTREndParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}};
//********************************************************************************************* //*********************************************************************************************
// Next, define the set of taglists for tags with special kids... // Next, define the set of taglists for tags with special kids...
//********************************************************************************************* //*********************************************************************************************
@ -104,7 +103,7 @@ TagList gULKids={2,{eHTMLTag_li,eHTMLTag_p}};
// The following tag lists are used to define common set of root notes for the HTML elements... // The following tag lists are used to define common set of root notes for the HTML elements...
//********************************************************************************************* //*********************************************************************************************
TagList gRootTags={3,{eHTMLTag_body,eHTMLTag_td,eHTMLTag_table}}; TagList gRootTags={4,{eHTMLTag_body,eHTMLTag_td,eHTMLTag_table,eHTMLTag_applet}};
TagList gHTMLRootTags={1,{eHTMLTag_unknown}}; TagList gHTMLRootTags={1,{eHTMLTag_unknown}};
TagList gLIRootTags={7,{eHTMLTag_ul,eHTMLTag_ol,eHTMLTag_dir,eHTMLTag_menu,eHTMLTag_p,eHTMLTag_body,eHTMLTag_td}}; TagList gLIRootTags={7,{eHTMLTag_ul,eHTMLTag_ol,eHTMLTag_dir,eHTMLTag_menu,eHTMLTag_p,eHTMLTag_body,eHTMLTag_td}};
@ -509,7 +508,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_fieldset, /*tag*/ eHTMLTag_fieldset,
/*requiredAncestor*/ eHTMLTag_form,eHTMLTag_unknown, /*requiredAncestor*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, (kSelf|kFlowEntity), kNone, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlowEntity), kNone,
@ -744,7 +743,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_legend, /*tag*/ eHTMLTag_legend,
/*requiredAncestor*/ eHTMLTag_form,eHTMLTag_unknown, /*requiredAncestor*/ eHTMLTag_fieldset,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset, /*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kInlineEntity, kNone, /*parent,incl,exclgroups*/ kNone, kInlineEntity, kNone,
@ -883,7 +882,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kNone, kNone, /*parent,incl,exclgroups*/ kNone, kNone, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange, /*special props, prop-range*/ kOmitWS,kDefaultPropRange,
/*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown); /*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown);
Initialize( Initialize(
@ -1094,7 +1093,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_table, /*tag*/ eHTMLTag_table,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gInBody, /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kNone, (kSelf|kInlineEntity), /*parent,incl,exclgroups*/ kBlock, kNone, (kSelf|kInlineEntity),
/*special props, prop-range*/ (kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), 2, /*special props, prop-range*/ (kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), 2,
@ -1380,7 +1379,7 @@ PRBool nsHTMLElement::IsMemberOf(PRInt32 aSet) const{
PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=(gHTMLElements[aTag].IsBlock() || result=(gHTMLElements[aTag].IsBlock() ||
gHTMLElements[aTag].IsBlockEntity() || gHTMLElements[aTag].IsBlockEntity() ||
@ -1405,7 +1404,7 @@ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){ PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity); result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity);
} }
return result; return result;
@ -1420,7 +1419,7 @@ PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){
PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){ PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity); result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity);
} }
return result; return result;
@ -1434,7 +1433,7 @@ PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity);
} }
return result; return result;
@ -1449,7 +1448,7 @@ PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity);
} }
return result; return result;
@ -1464,7 +1463,7 @@ PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsFlowParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsFlowParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity);
} }
return result; return result;
@ -1731,7 +1730,7 @@ PRBool nsHTMLElement::CanContainSelf(void) const {
*/ */
PRBool nsHTMLElement::CanAutoCloseTag(eHTMLTags aTag) const{ PRBool nsHTMLElement::CanAutoCloseTag(eHTMLTags aTag) const{
PRBool result=PR_TRUE; PRBool result=PR_TRUE;
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)) { if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)) {
TagList* theTagList=gHTMLElements[mTagID].mDontAutocloseEnd; TagList* theTagList=gHTMLElements[mTagID].mDontAutocloseEnd;
if(theTagList) { if(theTagList) {
result=!FindTagInSet(aTag,theTagList->mTags,theTagList->mCount); result=!FindTagInSet(aTag,theTagList->mTags,theTagList->mCount);

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

@ -112,35 +112,35 @@ struct nsHTMLElement {
static PRBool IsBlockCloser(eHTMLTags aTag); static PRBool IsBlockCloser(eHTMLTags aTag);
inline PRBool IsBlock(void) { inline PRBool IsBlock(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kBlock); return TestBits(mParentBits,kBlock);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsBlockEntity(void) { inline PRBool IsBlockEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kBlockEntity); return TestBits(mParentBits,kBlockEntity);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsSpecialEntity(void) { inline PRBool IsSpecialEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kSpecial); return TestBits(mParentBits,kSpecial);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsPhraseEntity(void) { inline PRBool IsPhraseEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kPhrase); return TestBits(mParentBits,kPhrase);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsFontStyleEntity(void) { inline PRBool IsFontStyleEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kFontStyle); return TestBits(mParentBits,kFontStyle);
} }
return PR_FALSE; return PR_FALSE;

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

@ -92,12 +92,13 @@ nsHTMLTokenizer::FreeTokenRecycler(void) {
* @param nsIParser** ptr to newly instantiated parser * @param nsIParser** ptr to newly instantiated parser
* @return NS_xxx error result * @return NS_xxx error result
*/ */
NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult) {
NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult,PRInt32 aMode,PRBool aPlaintext) {
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) { if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
nsHTMLTokenizer* it = new nsHTMLTokenizer(); nsHTMLTokenizer* it = new nsHTMLTokenizer(aMode,aPlaintext);
if (nsnull == it) { if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }

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

@ -99,7 +99,7 @@ protected:
PRBool mPlainText; PRBool mPlainText;
}; };
extern NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult); extern NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult,PRInt32 aMode,PRBool aPlaintext);
#endif #endif

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

@ -41,10 +41,7 @@
#include "nsIProgressEventSink.h" #include "nsIProgressEventSink.h"
#include "nsIBufferInputStream.h" #include "nsIBufferInputStream.h"
#undef rickgdebug //#define rickgdebug
#ifdef rickgdebug
#include "CRtfDTD.h"
#endif
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -1104,7 +1101,7 @@ nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext, const PRUnichar*
#ifdef rickgdebug #ifdef rickgdebug
#include <fstream.h> #include <fstream.h>
fstream* gDumpFile; fstream* gOutFile;
#endif #endif
/** /**
@ -1136,7 +1133,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
NS_ASSERTION(contentType, "parser needs a content type to find a dtd"); NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
#ifdef rickgdebug #ifdef rickgdebug
gDumpFile = new fstream("c:/temp/out.file",ios::trunc); gOutFile= new fstream("c:/temp/out.file",ios::trunc);
#endif #endif
return NS_OK; return NS_OK;
@ -1323,7 +1320,10 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
mParserContext->mScanner->Append(mParserContext->mTransferBuffer,theNumRead); mParserContext->mScanner->Append(mParserContext->mTransferBuffer,theNumRead);
#ifdef rickgdebug #ifdef rickgdebug
(*gDumpFile) << mParserContext->mTransferBuffer; mParserContext->mTransferBuffer[theNumRead]=0;
mParserContext->mTransferBuffer[theNumRead+1]=0;
mParserContext->mTransferBuffer[theNumRead+2]=0;
(*gOutFile) << mParserContext->mTransferBuffer;
#endif #endif
} //if } //if
@ -1378,9 +1378,9 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
} }
#ifdef rickgdebug #ifdef rickgdebug
if(gDumpFile){ if(gOutFile){
gDumpFile->close(); gOutFile->close();
delete gDumpFile; delete gOutFile;
} }
#endif #endif

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

@ -468,7 +468,7 @@ nsresult CViewSourceHTML::Terminate(void) {
nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) { nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) {
nsresult result=NS_OK; nsresult result=NS_OK;
if(!mTokenizer) { if(!mTokenizer) {
result=NS_NewHTMLTokenizer(&mTokenizer); result=NS_NewHTMLTokenizer(&mTokenizer,eParseMode_quirks,PR_TRUE);
} }
aTokenizer=mTokenizer; aTokenizer=mTokenizer;
return result; return result;

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

@ -1494,7 +1494,7 @@ eHTMLTags FindAutoCloseTargetForEndTag(eHTMLTags aCurrentTag,nsDTDContext& aCont
2. Is it in the rootTag list? If so, then we're gated by it 2. Is it in the rootTag list? If so, then we're gated by it
3. Otherwise its non-specified and we simply presume we can close it. 3. Otherwise its non-specified and we simply presume we can close it.
*/ */
TagList* theCloseTags=gHTMLElements[aCurrentTag].GetAutoCloseEndTags(); TagList* theCloseTags=gHTMLElements[aCurrentTag].GetAutoCloseEndTags();
TagList* theRootTags=gHTMLElements[aCurrentTag].GetEndRootTags(); TagList* theRootTags=gHTMLElements[aCurrentTag].GetEndRootTags();
@ -3401,7 +3401,7 @@ nsresult CNavDTD::CreateContextStackFor(eHTMLTags aChildTag){
nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) { nsresult CNavDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
nsresult result=NS_OK; nsresult result=NS_OK;
if(!mTokenizer) { if(!mTokenizer) {
result=NS_NewHTMLTokenizer(&mTokenizer); result=NS_NewHTMLTokenizer(&mTokenizer,mParseMode,PR_FALSE);
} }
aTokenizer=mTokenizer; aTokenizer=mTokenizer;
return result; return result;

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

@ -60,7 +60,6 @@ TagList gParamParents={2,{eHTMLTag_applet,eHTMLTag_object}};
TagList gTRParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}}; TagList gTRParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}};
TagList gTREndParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}}; TagList gTREndParents={4,{eHTMLTag_tbody,eHTMLTag_tfoot,eHTMLTag_thead,eHTMLTag_table}};
//********************************************************************************************* //*********************************************************************************************
// Next, define the set of taglists for tags with special kids... // Next, define the set of taglists for tags with special kids...
//********************************************************************************************* //*********************************************************************************************
@ -104,7 +103,7 @@ TagList gULKids={2,{eHTMLTag_li,eHTMLTag_p}};
// The following tag lists are used to define common set of root notes for the HTML elements... // The following tag lists are used to define common set of root notes for the HTML elements...
//********************************************************************************************* //*********************************************************************************************
TagList gRootTags={3,{eHTMLTag_body,eHTMLTag_td,eHTMLTag_table}}; TagList gRootTags={4,{eHTMLTag_body,eHTMLTag_td,eHTMLTag_table,eHTMLTag_applet}};
TagList gHTMLRootTags={1,{eHTMLTag_unknown}}; TagList gHTMLRootTags={1,{eHTMLTag_unknown}};
TagList gLIRootTags={7,{eHTMLTag_ul,eHTMLTag_ol,eHTMLTag_dir,eHTMLTag_menu,eHTMLTag_p,eHTMLTag_body,eHTMLTag_td}}; TagList gLIRootTags={7,{eHTMLTag_ul,eHTMLTag_ol,eHTMLTag_dir,eHTMLTag_menu,eHTMLTag_p,eHTMLTag_body,eHTMLTag_td}};
@ -509,7 +508,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_fieldset, /*tag*/ eHTMLTag_fieldset,
/*requiredAncestor*/ eHTMLTag_form,eHTMLTag_unknown, /*requiredAncestor*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, (kSelf|kFlowEntity), kNone, /*parent,incl,exclgroups*/ kBlock, (kSelf|kFlowEntity), kNone,
@ -744,7 +743,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_legend, /*tag*/ eHTMLTag_legend,
/*requiredAncestor*/ eHTMLTag_form,eHTMLTag_unknown, /*requiredAncestor*/ eHTMLTag_fieldset,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset, /*rootnodes,endrootnodes*/ &gInFieldset,&gInFieldset,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kInlineEntity, kNone, /*parent,incl,exclgroups*/ kNone, kInlineEntity, kNone,
@ -883,7 +882,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents, /*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kNone, kNone, /*parent,incl,exclgroups*/ kNone, kNone, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange, /*special props, prop-range*/ kOmitWS,kDefaultPropRange,
/*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown); /*special parents,kids,skip*/ &gOptgroupParents,&gContainsOpts,eHTMLTag_unknown);
Initialize( Initialize(
@ -1094,7 +1093,7 @@ void InitializeElementTable(void) {
Initialize( Initialize(
/*tag*/ eHTMLTag_table, /*tag*/ eHTMLTag_table,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gInBody, /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kNone, (kSelf|kInlineEntity), /*parent,incl,exclgroups*/ kBlock, kNone, (kSelf|kInlineEntity),
/*special props, prop-range*/ (kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), 2, /*special props, prop-range*/ (kOmitWS|kBadContentWatch|kNoStyleLeaksIn|kNoStyleLeaksOut), 2,
@ -1380,7 +1379,7 @@ PRBool nsHTMLElement::IsMemberOf(PRInt32 aSet) const{
PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=(gHTMLElements[aTag].IsBlock() || result=(gHTMLElements[aTag].IsBlock() ||
gHTMLElements[aTag].IsBlockEntity() || gHTMLElements[aTag].IsBlockEntity() ||
@ -1405,7 +1404,7 @@ PRBool nsHTMLElement::IsBlockCloser(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){ PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity); result=TestBits(gHTMLElements[aTag].mParentBits,kInlineEntity);
} }
return result; return result;
@ -1420,7 +1419,7 @@ PRBool nsHTMLElement::IsInlineEntity(eHTMLTags aTag){
PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){ PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity); result=TestBits(gHTMLElements[aTag].mParentBits,kFlowEntity);
} }
return result; return result;
@ -1434,7 +1433,7 @@ PRBool nsHTMLElement::IsFlowEntity(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kBlockEntity);
} }
return result; return result;
@ -1449,7 +1448,7 @@ PRBool nsHTMLElement::IsBlockParent(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kInlineEntity);
} }
return result; return result;
@ -1464,7 +1463,7 @@ PRBool nsHTMLElement::IsInlineParent(eHTMLTags aTag){
*/ */
PRBool nsHTMLElement::IsFlowParent(eHTMLTags aTag){ PRBool nsHTMLElement::IsFlowParent(eHTMLTags aTag){
PRBool result=PR_FALSE; PRBool result=PR_FALSE;
if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_userdefined)){ if((aTag>=eHTMLTag_unknown) & (aTag<=eHTMLTag_xmp)){
result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity); result=TestBits(gHTMLElements[aTag].mInclusionBits,kFlowEntity);
} }
return result; return result;
@ -1731,7 +1730,7 @@ PRBool nsHTMLElement::CanContainSelf(void) const {
*/ */
PRBool nsHTMLElement::CanAutoCloseTag(eHTMLTags aTag) const{ PRBool nsHTMLElement::CanAutoCloseTag(eHTMLTags aTag) const{
PRBool result=PR_TRUE; PRBool result=PR_TRUE;
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)) { if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)) {
TagList* theTagList=gHTMLElements[mTagID].mDontAutocloseEnd; TagList* theTagList=gHTMLElements[mTagID].mDontAutocloseEnd;
if(theTagList) { if(theTagList) {
result=!FindTagInSet(aTag,theTagList->mTags,theTagList->mCount); result=!FindTagInSet(aTag,theTagList->mTags,theTagList->mCount);

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

@ -112,35 +112,35 @@ struct nsHTMLElement {
static PRBool IsBlockCloser(eHTMLTags aTag); static PRBool IsBlockCloser(eHTMLTags aTag);
inline PRBool IsBlock(void) { inline PRBool IsBlock(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kBlock); return TestBits(mParentBits,kBlock);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsBlockEntity(void) { inline PRBool IsBlockEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kBlockEntity); return TestBits(mParentBits,kBlockEntity);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsSpecialEntity(void) { inline PRBool IsSpecialEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kSpecial); return TestBits(mParentBits,kSpecial);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsPhraseEntity(void) { inline PRBool IsPhraseEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kPhrase); return TestBits(mParentBits,kPhrase);
} }
return PR_FALSE; return PR_FALSE;
} }
inline PRBool IsFontStyleEntity(void) { inline PRBool IsFontStyleEntity(void) {
if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_userdefined)){ if((mTagID>=eHTMLTag_unknown) & (mTagID<=eHTMLTag_xmp)){
return TestBits(mParentBits,kFontStyle); return TestBits(mParentBits,kFontStyle);
} }
return PR_FALSE; return PR_FALSE;

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

@ -92,12 +92,13 @@ nsHTMLTokenizer::FreeTokenRecycler(void) {
* @param nsIParser** ptr to newly instantiated parser * @param nsIParser** ptr to newly instantiated parser
* @return NS_xxx error result * @return NS_xxx error result
*/ */
NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult) {
NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult,PRInt32 aMode,PRBool aPlaintext) {
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) { if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
nsHTMLTokenizer* it = new nsHTMLTokenizer(); nsHTMLTokenizer* it = new nsHTMLTokenizer(aMode,aPlaintext);
if (nsnull == it) { if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }

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

@ -99,7 +99,7 @@ protected:
PRBool mPlainText; PRBool mPlainText;
}; };
extern NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult); extern NS_HTMLPARS nsresult NS_NewHTMLTokenizer(nsITokenizer** aInstancePtrResult,PRInt32 aMode,PRBool aPlaintext);
#endif #endif

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

@ -41,10 +41,7 @@
#include "nsIProgressEventSink.h" #include "nsIProgressEventSink.h"
#include "nsIBufferInputStream.h" #include "nsIBufferInputStream.h"
#undef rickgdebug //#define rickgdebug
#ifdef rickgdebug
#include "CRtfDTD.h"
#endif
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -1104,7 +1101,7 @@ nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext, const PRUnichar*
#ifdef rickgdebug #ifdef rickgdebug
#include <fstream.h> #include <fstream.h>
fstream* gDumpFile; fstream* gOutFile;
#endif #endif
/** /**
@ -1136,7 +1133,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
NS_ASSERTION(contentType, "parser needs a content type to find a dtd"); NS_ASSERTION(contentType, "parser needs a content type to find a dtd");
#ifdef rickgdebug #ifdef rickgdebug
gDumpFile = new fstream("c:/temp/out.file",ios::trunc); gOutFile= new fstream("c:/temp/out.file",ios::trunc);
#endif #endif
return NS_OK; return NS_OK;
@ -1323,7 +1320,10 @@ nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
mParserContext->mScanner->Append(mParserContext->mTransferBuffer,theNumRead); mParserContext->mScanner->Append(mParserContext->mTransferBuffer,theNumRead);
#ifdef rickgdebug #ifdef rickgdebug
(*gDumpFile) << mParserContext->mTransferBuffer; mParserContext->mTransferBuffer[theNumRead]=0;
mParserContext->mTransferBuffer[theNumRead+1]=0;
mParserContext->mTransferBuffer[theNumRead+2]=0;
(*gOutFile) << mParserContext->mTransferBuffer;
#endif #endif
} //if } //if
@ -1378,9 +1378,9 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
} }
#ifdef rickgdebug #ifdef rickgdebug
if(gDumpFile){ if(gOutFile){
gDumpFile->close(); gOutFile->close();
delete gDumpFile; delete gOutFile;
} }
#endif #endif

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

@ -468,7 +468,7 @@ nsresult CViewSourceHTML::Terminate(void) {
nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) { nsresult CViewSourceHTML::GetTokenizer(nsITokenizer*& aTokenizer) {
nsresult result=NS_OK; nsresult result=NS_OK;
if(!mTokenizer) { if(!mTokenizer) {
result=NS_NewHTMLTokenizer(&mTokenizer); result=NS_NewHTMLTokenizer(&mTokenizer,eParseMode_quirks,PR_TRUE);
} }
aTokenizer=mTokenizer; aTokenizer=mTokenizer;
return result; return result;