fix bugs 8523, 9127, parially fix 8803

This commit is contained in:
rickg%netscape.com 1999-07-07 07:40:35 +00:00
Родитель 9a9455daeb
Коммит 7a884e73a4
36 изменённых файлов: 166 добавлений и 84 удалений

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

@ -40,7 +40,6 @@
#ifdef XP_PC
#include <direct.h> //this is here for debug reasons...
#include <iostream.h>
#endif
#include "prmem.h"
@ -476,7 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
mFilename=aFilename;
mHasOpenBody=PR_FALSE;
mHadBodyOrFrameset=PR_FALSE;
mHadBody=PR_FALSE;
mHadFrameset=PR_FALSE;
mLineNumber=1;
mHasOpenScript=PR_FALSE;
mSink=(nsIHTMLContentSink*)aSink;
@ -542,7 +542,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
nsresult result= NS_OK;
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
if((NS_OK==anErrorCode) && (!mHadBody) && (!mHadFrameset)) {
CStartToken theToken(eHTMLTag_body); //open the body container...
result=HandleStartToken(&theToken);
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
@ -625,6 +625,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
PRBool execSkipContent=PR_FALSE;
theToken->mRecycle=PR_TRUE; //assume every token coming into this system needs recycling.
/* ---------------------------------------------------------------------------------
To understand this little piece of code, you need to look below too.
In essence, this code caches "skipped content" until we find a given skiptarget.
@ -658,11 +660,12 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
if(!mHadBodyOrFrameset){
if((!mHadBody) && (!mHadFrameset)){
if(mHasOpenHead) {
//just fall through and handle current token
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
mMisplacedContent.Push(aToken);
aToken->mRecycle=PR_FALSE;
return result;
}
}
@ -695,7 +698,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
mParser=(nsParser*)aParser;
result=(*theHandler)(theToken,this);
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
gRecycler->RecycleToken(theToken);
if(theToken->mRecycle)
gRecycler->RecycleToken(theToken);
}
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
return result;
@ -755,10 +759,6 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
nsresult result=NS_OK;
switch(aChildTag){
case eHTMLTag_body:
case eHTMLTag_frameset:
mHadBodyOrFrameset=PR_TRUE;
break;
case eHTMLTag_pre:
case eHTMLTag_listing:
@ -1280,12 +1280,13 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
//of another section. If it is, the cache it for later.
// 1. Get the root node for the child. See if the ultimate node is the BODY, FRAMESET, HEAD or HTML
PRInt32 theTagCount = mBodyContext->GetCount();
PRInt32 attrCount = aToken->GetAttributeCount();
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
eHTMLTags theTag;
PRInt32 theBCIndex;
PRBool isNotWhiteSpace = PR_FALSE;
PRInt32 attrCount = aToken->GetAttributeCount();
while(theTagCount > 0) {
theTag = mBodyContext->TagAt(--theTagCount);
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
@ -1314,6 +1315,24 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
result=NS_ERROR_HTMLPARSER_MISPLACED;
}
}
if((aChildTag!=aParent) && (gHTMLElements[aParent].HasSpecialProperty(kSaveMisplaced))) {
mMisplacedContent.Push(aToken);
aToken->mRecycle=PR_FALSE;
// If the token is attributed then save those attributes too.
if(attrCount > 0) {
nsCParserNode* theAttrNode = (nsCParserNode*)&aNode;
while(attrCount > 0){
CToken* theToken=theAttrNode->PopAttributeToken();
if(theToken){
mMisplacedContent.Push(theToken);
theToken->mRecycle=PR_FALSE;
}
attrCount--;
}
}
}
return result;
}
@ -1356,7 +1375,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
return OpenContainer(attrNode,PR_FALSE);
break;
case eHTMLTag_head:
if(mHadBodyOrFrameset) {
if(mHadBody || mHadFrameset) {
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
if(result == NS_OK)
return result;
@ -1985,6 +2004,10 @@ PRBool CNavDTD::CanOmit(eHTMLTags aParent,eHTMLTags aChild) const {
}
}
if(gHTMLElements[aParent].HasSpecialProperty(kSaveMisplaced)) {
return PR_TRUE;
}
return PR_FALSE;
}
@ -2339,6 +2362,8 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult result=NS_OK;
mHadBody=PR_TRUE;
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
nsAutoString theEmpty;
@ -2463,9 +2488,11 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
*/
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
mHadFrameset=PR_TRUE;
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
mHadBodyOrFrameset=PR_TRUE;
mHadFrameset=PR_TRUE;
return result;
}

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

@ -509,7 +509,8 @@ protected:
PRBool mHasOpenMap;
PRInt32 mHasOpenHead;
PRBool mHasOpenBody;
PRBool mHadBodyOrFrameset;
PRBool mHadFrameset;
PRBool mHadBody;
nsString mFilename;
nsIDTDDebug* mDTDDebug;
PRInt32 mLineNumber;

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

@ -44,7 +44,6 @@
#include "prtypes.h"
#include "prio.h"
#include "plstr.h"
#include <fstream.h>
#ifdef XP_PC

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

@ -37,7 +37,6 @@
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
#endif
ofstream filelist("filelist.out");
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
PRBool result=PR_TRUE;
@ -131,7 +130,8 @@ void parseFile (const char* aFilename,int size)
int failpos=0;
if(!compareFiles(aFilename,filename,failpos)) {
filelist << "FAILED: " << aFilename << "[" << failpos << "]" << endl;
char buffer[100];
printf("FAILED: %s [%i]\n",aFilename,failpos);
}
}

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

@ -36,7 +36,6 @@
#include "prio.h"
#include "plstr.h"
#include "prstrm.h"
#include <fstream.h>
#include <time.h>
#include "prmem.h"
#include "nsQuickSort.h"

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

@ -549,6 +549,10 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
}
void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) {
#ifdef RICKG_DEBUG
#include <fstream.h>
const char* prefix=" ";
fstream out(aFilename,ios::out);
out << "==================================================" << endl;
@ -578,6 +582,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
}
else out<<"(not container)" << endl;
}
#endif
}

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

@ -34,7 +34,6 @@
#include "nsCRT.h"
#include "nsDeque.h"
#include "nsIDTD.h"
#include <fstream.h>
#include "nsITokenizer.h"
#include "nsString.h"
#include "nsIElementObserver.h"

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

@ -477,7 +477,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kNone,
/*parent,incl,exclgroups*/ kBlock, kSelf|kFlowEntity, kNone,
/*special props, prop-range*/ kOmitWS, kNoPropRange,
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
@ -623,7 +623,7 @@ nsHTMLElement gHTMLElements[] = {
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone,
/*special props, prop-range*/ kOmitEndTag|kOmitWS|kNoStyleLeaksIn, kDefaultPropRange,
/*special props, prop-range*/ kSaveMisplaced|kOmitEndTag|kOmitWS|kNoStyleLeaksIn, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown},
{ /*tag*/ eHTMLTag_i,
@ -1712,6 +1712,7 @@ PRBool nsHTMLElement::HasSpecialProperty(PRInt32 aProperty) const{
}
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
#ifdef RICKG_DEBUG
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
@ -1761,9 +1762,12 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
linenum++;
}
} //for
#endif
}
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
#ifdef RICKG_DEBUG
const char* prefix=" ";
const char* suffix=" ";
const char* shortSuffix=" ";
@ -1815,10 +1819,13 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
out << answer[gHTMLElements[eHTMLTags(i)].mParentBits==kPreformatted] << suffix << endl;
*/
} //for
out<<endl<<endl;
out<<endl<<endl;
#endif
}
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
#ifdef RICKG_DEBUG
const char* prefix=" ";
const char* suffix=" ";
const char* shortSuffix=" ";
@ -1857,5 +1864,6 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
out << answer[gHTMLElements[eHTMLTags(i)].CanContainType(kPreformatted)] << suffix << endl;
} //for
out<<endl<<endl;
out<<endl<<endl;
#endif
}

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

@ -145,6 +145,7 @@ static const int kBadContentWatch = 0x0020;
static const int kNoStyleLeaksIn = 0x0040;
static const int kNoStyleLeaksOut = 0x0080;
static const int kMustCloseSelf = 0x0100;
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
//*********************************************************************************************
// The following ints define the standard groups of HTML elements...

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

@ -30,7 +30,6 @@
#include "nsHTMLContentSinkStream.h"
#include "nsHTMLTokens.h"
#include <iostream.h>
#include <ctype.h>
#include "nsString.h"
#include "nsIParser.h"

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

@ -20,7 +20,6 @@
#include "nsHTMLTokens.h"
#include "nsIParser.h"
#include "prtypes.h"
#include <iostream.h>
#define VERBOSE_DEBUG

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

@ -29,7 +29,6 @@
#include "nsHTMLToTXTSinkStream.h"
#include "nsHTMLTokens.h"
#include <iostream.h>
#include "nsString.h"
#include "nsIParser.h"
#include "nsHTMLEntities.h"

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

@ -820,13 +820,15 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
aString+=aChar;
}
theRightChars.Truncate(0);
aString.Right(theRightChars,5);
theRightChars.StripChars(" ");
if(NS_OK==result){
theRightChars.Truncate(0);
aString.Right(theRightChars,5);
theRightChars.StripChars(" ");
findpos=theRightChars.RFind("-->");
if(kNotFound==findpos)
findpos=theRightChars.RFind("!>");
findpos=theRightChars.RFind("-->");
if(kNotFound==findpos)
findpos=theRightChars.RFind("!>");
}
} //while
return result;
} //if

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

@ -42,7 +42,6 @@
#include "nsToken.h"
#include "nsHTMLTags.h"
#include "nsParserError.h"
#include <iostream.h>
#include "nsString.h"
class nsScanner;

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

@ -25,7 +25,6 @@
#include "nsScanner.h"
#include "prenv.h" //this is here for debug reasons...
#include "plstr.h"
#include <fstream.h>
#include "nsIParserFilter.h"
#include "nshtmlpars.h"
#include "CNavDTD.h"
@ -711,13 +710,6 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
*/
nsresult nsParser::Parse(nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aVerifyEnabled,PRBool aLastCall){
#ifdef _rickgdebug
{
fstream out("c:/temp/parseout.file",ios::trunc);
aSourceBuffer.DebugDump(out);
}
#endif
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
@ -1024,6 +1016,7 @@ nsParser::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
}
#ifdef rickgdebug
#include <fstream.h>
fstream* gDumpFile;
#endif

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

@ -38,6 +38,8 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
mTypeID=aTag;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -50,6 +52,8 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
mTypeID=0;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -62,6 +66,8 @@ CToken::CToken(const char* aName) : mTextValue(aName) {
mTypeID=0;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -89,6 +95,8 @@ void CToken::Reinitialize(PRInt32 aTag, const nsString& aString){
mAttrCount=0;
mTypeID=aTag;
mAttrCount=0;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**

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

@ -37,7 +37,6 @@
#include "prtypes.h"
#include "nsString.h"
#include <iostream.h>
#include "nsError.h"
class nsScanner;
@ -55,6 +54,8 @@ class nsScanner;
class CToken {
public:
enum eTokenOrigin {eSource,eResidualStyle};
/**
* Default constructor
* @update gess7/21/98
@ -195,6 +196,9 @@ class CToken {
static int GetTokenCount();
eTokenOrigin mOrigin;
PRBool mRecycle;
protected:
PRInt32 mTypeID;
PRInt16 mAttrCount;

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

@ -35,7 +35,6 @@
#include "nsIContentSink.h"
#include "nsHTMLTokens.h"
#include "nsVoidArray.h"
#include <fstream.h>
#define NS_XIF_DTD_IID \

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

@ -40,7 +40,6 @@
#ifdef XP_PC
#include <direct.h> //this is here for debug reasons...
#include <iostream.h>
#endif
#include "prmem.h"
@ -476,7 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
mFilename=aFilename;
mHasOpenBody=PR_FALSE;
mHadBodyOrFrameset=PR_FALSE;
mHadBody=PR_FALSE;
mHadFrameset=PR_FALSE;
mLineNumber=1;
mHasOpenScript=PR_FALSE;
mSink=(nsIHTMLContentSink*)aSink;
@ -542,7 +542,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
nsresult result= NS_OK;
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
if((NS_OK==anErrorCode) && (!mHadBody) && (!mHadFrameset)) {
CStartToken theToken(eHTMLTag_body); //open the body container...
result=HandleStartToken(&theToken);
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
@ -625,6 +625,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
PRBool execSkipContent=PR_FALSE;
theToken->mRecycle=PR_TRUE; //assume every token coming into this system needs recycling.
/* ---------------------------------------------------------------------------------
To understand this little piece of code, you need to look below too.
In essence, this code caches "skipped content" until we find a given skiptarget.
@ -658,11 +660,12 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
if(!mHadBodyOrFrameset){
if((!mHadBody) && (!mHadFrameset)){
if(mHasOpenHead) {
//just fall through and handle current token
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
mMisplacedContent.Push(aToken);
aToken->mRecycle=PR_FALSE;
return result;
}
}
@ -695,7 +698,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
mParser=(nsParser*)aParser;
result=(*theHandler)(theToken,this);
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
gRecycler->RecycleToken(theToken);
if(theToken->mRecycle)
gRecycler->RecycleToken(theToken);
}
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
return result;
@ -755,10 +759,6 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
nsresult result=NS_OK;
switch(aChildTag){
case eHTMLTag_body:
case eHTMLTag_frameset:
mHadBodyOrFrameset=PR_TRUE;
break;
case eHTMLTag_pre:
case eHTMLTag_listing:
@ -1280,12 +1280,13 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
//of another section. If it is, the cache it for later.
// 1. Get the root node for the child. See if the ultimate node is the BODY, FRAMESET, HEAD or HTML
PRInt32 theTagCount = mBodyContext->GetCount();
PRInt32 attrCount = aToken->GetAttributeCount();
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
eHTMLTags theTag;
PRInt32 theBCIndex;
PRBool isNotWhiteSpace = PR_FALSE;
PRInt32 attrCount = aToken->GetAttributeCount();
while(theTagCount > 0) {
theTag = mBodyContext->TagAt(--theTagCount);
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
@ -1314,6 +1315,24 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
result=NS_ERROR_HTMLPARSER_MISPLACED;
}
}
if((aChildTag!=aParent) && (gHTMLElements[aParent].HasSpecialProperty(kSaveMisplaced))) {
mMisplacedContent.Push(aToken);
aToken->mRecycle=PR_FALSE;
// If the token is attributed then save those attributes too.
if(attrCount > 0) {
nsCParserNode* theAttrNode = (nsCParserNode*)&aNode;
while(attrCount > 0){
CToken* theToken=theAttrNode->PopAttributeToken();
if(theToken){
mMisplacedContent.Push(theToken);
theToken->mRecycle=PR_FALSE;
}
attrCount--;
}
}
}
return result;
}
@ -1356,7 +1375,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
return OpenContainer(attrNode,PR_FALSE);
break;
case eHTMLTag_head:
if(mHadBodyOrFrameset) {
if(mHadBody || mHadFrameset) {
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
if(result == NS_OK)
return result;
@ -1985,6 +2004,10 @@ PRBool CNavDTD::CanOmit(eHTMLTags aParent,eHTMLTags aChild) const {
}
}
if(gHTMLElements[aParent].HasSpecialProperty(kSaveMisplaced)) {
return PR_TRUE;
}
return PR_FALSE;
}
@ -2339,6 +2362,8 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
nsresult result=NS_OK;
mHadBody=PR_TRUE;
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
nsAutoString theEmpty;
@ -2463,9 +2488,11 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
*/
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
mHadFrameset=PR_TRUE;
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
mHadBodyOrFrameset=PR_TRUE;
mHadFrameset=PR_TRUE;
return result;
}

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

@ -509,7 +509,8 @@ protected:
PRBool mHasOpenMap;
PRInt32 mHasOpenHead;
PRBool mHasOpenBody;
PRBool mHadBodyOrFrameset;
PRBool mHadFrameset;
PRBool mHadBody;
nsString mFilename;
nsIDTDDebug* mDTDDebug;
PRInt32 mLineNumber;

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

@ -44,7 +44,6 @@
#include "prtypes.h"
#include "prio.h"
#include "plstr.h"
#include <fstream.h>
#ifdef XP_PC

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

@ -37,7 +37,6 @@
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
#endif
ofstream filelist("filelist.out");
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
PRBool result=PR_TRUE;
@ -131,7 +130,8 @@ void parseFile (const char* aFilename,int size)
int failpos=0;
if(!compareFiles(aFilename,filename,failpos)) {
filelist << "FAILED: " << aFilename << "[" << failpos << "]" << endl;
char buffer[100];
printf("FAILED: %s [%i]\n",aFilename,failpos);
}
}

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

@ -36,7 +36,6 @@
#include "prio.h"
#include "plstr.h"
#include "prstrm.h"
#include <fstream.h>
#include <time.h>
#include "prmem.h"
#include "nsQuickSort.h"

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

@ -549,6 +549,10 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
}
void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) {
#ifdef RICKG_DEBUG
#include <fstream.h>
const char* prefix=" ";
fstream out(aFilename,ios::out);
out << "==================================================" << endl;
@ -578,6 +582,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
}
else out<<"(not container)" << endl;
}
#endif
}

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

@ -34,7 +34,6 @@
#include "nsCRT.h"
#include "nsDeque.h"
#include "nsIDTD.h"
#include <fstream.h>
#include "nsITokenizer.h"
#include "nsString.h"
#include "nsIElementObserver.h"

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

@ -477,7 +477,7 @@ nsHTMLElement gHTMLElements[] = {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kNone,
/*parent,incl,exclgroups*/ kBlock, kSelf|kFlowEntity, kNone,
/*special props, prop-range*/ kOmitWS, kNoPropRange,
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
@ -623,7 +623,7 @@ nsHTMLElement gHTMLElements[] = {
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
/*autoclose starttags and endtags*/ 0,0,0,
/*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone,
/*special props, prop-range*/ kOmitEndTag|kOmitWS|kNoStyleLeaksIn, kDefaultPropRange,
/*special props, prop-range*/ kSaveMisplaced|kOmitEndTag|kOmitWS|kNoStyleLeaksIn, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown},
{ /*tag*/ eHTMLTag_i,
@ -1712,6 +1712,7 @@ PRBool nsHTMLElement::HasSpecialProperty(PRInt32 aProperty) const{
}
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
#ifdef RICKG_DEBUG
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
@ -1761,9 +1762,12 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
linenum++;
}
} //for
#endif
}
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
#ifdef RICKG_DEBUG
const char* prefix=" ";
const char* suffix=" ";
const char* shortSuffix=" ";
@ -1815,10 +1819,13 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
out << answer[gHTMLElements[eHTMLTags(i)].mParentBits==kPreformatted] << suffix << endl;
*/
} //for
out<<endl<<endl;
out<<endl<<endl;
#endif
}
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
#ifdef RICKG_DEBUG
const char* prefix=" ";
const char* suffix=" ";
const char* shortSuffix=" ";
@ -1857,5 +1864,6 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
out << answer[gHTMLElements[eHTMLTags(i)].CanContainType(kPreformatted)] << suffix << endl;
} //for
out<<endl<<endl;
out<<endl<<endl;
#endif
}

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

@ -145,6 +145,7 @@ static const int kBadContentWatch = 0x0020;
static const int kNoStyleLeaksIn = 0x0040;
static const int kNoStyleLeaksOut = 0x0080;
static const int kMustCloseSelf = 0x0100;
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
//*********************************************************************************************
// The following ints define the standard groups of HTML elements...

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

@ -30,7 +30,6 @@
#include "nsHTMLContentSinkStream.h"
#include "nsHTMLTokens.h"
#include <iostream.h>
#include <ctype.h>
#include "nsString.h"
#include "nsIParser.h"

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

@ -20,7 +20,6 @@
#include "nsHTMLTokens.h"
#include "nsIParser.h"
#include "prtypes.h"
#include <iostream.h>
#define VERBOSE_DEBUG

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

@ -29,7 +29,6 @@
#include "nsHTMLToTXTSinkStream.h"
#include "nsHTMLTokens.h"
#include <iostream.h>
#include "nsString.h"
#include "nsIParser.h"
#include "nsHTMLEntities.h"

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

@ -820,13 +820,15 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
aString+=aChar;
}
theRightChars.Truncate(0);
aString.Right(theRightChars,5);
theRightChars.StripChars(" ");
if(NS_OK==result){
theRightChars.Truncate(0);
aString.Right(theRightChars,5);
theRightChars.StripChars(" ");
findpos=theRightChars.RFind("-->");
if(kNotFound==findpos)
findpos=theRightChars.RFind("!>");
findpos=theRightChars.RFind("-->");
if(kNotFound==findpos)
findpos=theRightChars.RFind("!>");
}
} //while
return result;
} //if

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

@ -42,7 +42,6 @@
#include "nsToken.h"
#include "nsHTMLTags.h"
#include "nsParserError.h"
#include <iostream.h>
#include "nsString.h"
class nsScanner;

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

@ -25,7 +25,6 @@
#include "nsScanner.h"
#include "prenv.h" //this is here for debug reasons...
#include "plstr.h"
#include <fstream.h>
#include "nsIParserFilter.h"
#include "nshtmlpars.h"
#include "CNavDTD.h"
@ -711,13 +710,6 @@ nsresult nsParser::Parse(nsIInputStream& aStream,PRBool aVerifyEnabled, void* aK
*/
nsresult nsParser::Parse(nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aVerifyEnabled,PRBool aLastCall){
#ifdef _rickgdebug
{
fstream out("c:/temp/parseout.file",ios::trunc);
aSourceBuffer.DebugDump(out);
}
#endif
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
@ -1024,6 +1016,7 @@ nsParser::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
}
#ifdef rickgdebug
#include <fstream.h>
fstream* gDumpFile;
#endif

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

@ -38,6 +38,8 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
mTypeID=aTag;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -50,6 +52,8 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
mTypeID=0;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -62,6 +66,8 @@ CToken::CToken(const char* aName) : mTextValue(aName) {
mTypeID=0;
mAttrCount=0;
TokenCount++;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**
@ -89,6 +95,8 @@ void CToken::Reinitialize(PRInt32 aTag, const nsString& aString){
mAttrCount=0;
mTypeID=aTag;
mAttrCount=0;
mOrigin=eSource;
mRecycle=PR_TRUE;
}
/**

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

@ -37,7 +37,6 @@
#include "prtypes.h"
#include "nsString.h"
#include <iostream.h>
#include "nsError.h"
class nsScanner;
@ -55,6 +54,8 @@ class nsScanner;
class CToken {
public:
enum eTokenOrigin {eSource,eResidualStyle};
/**
* Default constructor
* @update gess7/21/98
@ -195,6 +196,9 @@ class CToken {
static int GetTokenCount();
eTokenOrigin mOrigin;
PRBool mRecycle;
protected:
PRInt32 mTypeID;
PRInt16 mAttrCount;

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

@ -35,7 +35,6 @@
#include "nsIContentSink.h"
#include "nsHTMLTokens.h"
#include "nsVoidArray.h"
#include <fstream.h>
#define NS_XIF_DTD_IID \