зеркало из https://github.com/mozilla/gecko-dev.git
fix bugs 8523, 9127, parially fix 8803
This commit is contained in:
Родитель
9a9455daeb
Коммит
7a884e73a4
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#ifdef XP_PC
|
#ifdef XP_PC
|
||||||
#include <direct.h> //this is here for debug reasons...
|
#include <direct.h> //this is here for debug reasons...
|
||||||
#include <iostream.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
|
|
||||||
|
@ -476,7 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
|
||||||
|
|
||||||
mFilename=aFilename;
|
mFilename=aFilename;
|
||||||
mHasOpenBody=PR_FALSE;
|
mHasOpenBody=PR_FALSE;
|
||||||
mHadBodyOrFrameset=PR_FALSE;
|
mHadBody=PR_FALSE;
|
||||||
|
mHadFrameset=PR_FALSE;
|
||||||
mLineNumber=1;
|
mLineNumber=1;
|
||||||
mHasOpenScript=PR_FALSE;
|
mHasOpenScript=PR_FALSE;
|
||||||
mSink=(nsIHTMLContentSink*)aSink;
|
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 CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
|
||||||
nsresult result= NS_OK;
|
nsresult result= NS_OK;
|
||||||
|
|
||||||
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
|
if((NS_OK==anErrorCode) && (!mHadBody) && (!mHadFrameset)) {
|
||||||
CStartToken theToken(eHTMLTag_body); //open the body container...
|
CStartToken theToken(eHTMLTag_body); //open the body container...
|
||||||
result=HandleStartToken(&theToken);
|
result=HandleStartToken(&theToken);
|
||||||
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
||||||
|
@ -625,6 +625,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||||
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
||||||
PRBool execSkipContent=PR_FALSE;
|
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.
|
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.
|
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};
|
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
|
||||||
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
||||||
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
||||||
if(!mHadBodyOrFrameset){
|
if((!mHadBody) && (!mHadFrameset)){
|
||||||
if(mHasOpenHead) {
|
if(mHasOpenHead) {
|
||||||
//just fall through and handle current token
|
//just fall through and handle current token
|
||||||
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
|
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
|
||||||
mMisplacedContent.Push(aToken);
|
mMisplacedContent.Push(aToken);
|
||||||
|
aToken->mRecycle=PR_FALSE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,6 +698,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||||
mParser=(nsParser*)aParser;
|
mParser=(nsParser*)aParser;
|
||||||
result=(*theHandler)(theToken,this);
|
result=(*theHandler)(theToken,this);
|
||||||
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
|
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
|
||||||
|
if(theToken->mRecycle)
|
||||||
gRecycler->RecycleToken(theToken);
|
gRecycler->RecycleToken(theToken);
|
||||||
}
|
}
|
||||||
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
|
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
|
||||||
|
@ -755,10 +759,6 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
|
||||||
nsresult result=NS_OK;
|
nsresult result=NS_OK;
|
||||||
|
|
||||||
switch(aChildTag){
|
switch(aChildTag){
|
||||||
case eHTMLTag_body:
|
|
||||||
case eHTMLTag_frameset:
|
|
||||||
mHadBodyOrFrameset=PR_TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eHTMLTag_pre:
|
case eHTMLTag_pre:
|
||||||
case eHTMLTag_listing:
|
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.
|
//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
|
// 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 theTagCount = mBodyContext->GetCount();
|
||||||
|
PRInt32 attrCount = aToken->GetAttributeCount();
|
||||||
|
|
||||||
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
|
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
|
||||||
eHTMLTags theTag;
|
eHTMLTags theTag;
|
||||||
PRInt32 theBCIndex;
|
PRInt32 theBCIndex;
|
||||||
PRBool isNotWhiteSpace = PR_FALSE;
|
PRBool isNotWhiteSpace = PR_FALSE;
|
||||||
PRInt32 attrCount = aToken->GetAttributeCount();
|
|
||||||
while(theTagCount > 0) {
|
while(theTagCount > 0) {
|
||||||
theTag = mBodyContext->TagAt(--theTagCount);
|
theTag = mBodyContext->TagAt(--theTagCount);
|
||||||
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
|
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
|
||||||
|
@ -1314,6 +1315,24 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
|
||||||
result=NS_ERROR_HTMLPARSER_MISPLACED;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1356,7 +1375,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
|
||||||
return OpenContainer(attrNode,PR_FALSE);
|
return OpenContainer(attrNode,PR_FALSE);
|
||||||
break;
|
break;
|
||||||
case eHTMLTag_head:
|
case eHTMLTag_head:
|
||||||
if(mHadBodyOrFrameset) {
|
if(mHadBody || mHadFrameset) {
|
||||||
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
|
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
|
||||||
if(result == NS_OK)
|
if(result == NS_OK)
|
||||||
return result;
|
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;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2339,6 +2362,8 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
|
||||||
|
|
||||||
nsresult result=NS_OK;
|
nsresult result=NS_OK;
|
||||||
|
|
||||||
|
mHadBody=PR_TRUE;
|
||||||
|
|
||||||
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
|
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
|
||||||
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
|
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
|
||||||
nsAutoString theEmpty;
|
nsAutoString theEmpty;
|
||||||
|
@ -2463,9 +2488,11 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
|
||||||
*/
|
*/
|
||||||
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
|
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
|
||||||
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
|
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
|
||||||
|
|
||||||
|
mHadFrameset=PR_TRUE;
|
||||||
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
|
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
|
||||||
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
|
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
|
||||||
mHadBodyOrFrameset=PR_TRUE;
|
mHadFrameset=PR_TRUE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,8 @@ protected:
|
||||||
PRBool mHasOpenMap;
|
PRBool mHasOpenMap;
|
||||||
PRInt32 mHasOpenHead;
|
PRInt32 mHasOpenHead;
|
||||||
PRBool mHasOpenBody;
|
PRBool mHasOpenBody;
|
||||||
PRBool mHadBodyOrFrameset;
|
PRBool mHadFrameset;
|
||||||
|
PRBool mHadBody;
|
||||||
nsString mFilename;
|
nsString mFilename;
|
||||||
nsIDTDDebug* mDTDDebug;
|
nsIDTDDebug* mDTDDebug;
|
||||||
PRInt32 mLineNumber;
|
PRInt32 mLineNumber;
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include "prio.h"
|
#include "prio.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include <fstream.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XP_PC
|
#ifdef XP_PC
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
|
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ofstream filelist("filelist.out");
|
|
||||||
|
|
||||||
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
||||||
PRBool result=PR_TRUE;
|
PRBool result=PR_TRUE;
|
||||||
|
@ -131,7 +130,8 @@ void parseFile (const char* aFilename,int size)
|
||||||
int failpos=0;
|
int failpos=0;
|
||||||
|
|
||||||
if(!compareFiles(aFilename,filename,failpos)) {
|
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 "prio.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "prstrm.h"
|
#include "prstrm.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsQuickSort.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) {
|
void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) {
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
|
#include <fstream.h>
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
fstream out(aFilename,ios::out);
|
fstream out(aFilename,ios::out);
|
||||||
out << "==================================================" << endl;
|
out << "==================================================" << endl;
|
||||||
|
@ -578,6 +582,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
||||||
}
|
}
|
||||||
else out<<"(not container)" << endl;
|
else out<<"(not container)" << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsDeque.h"
|
#include "nsDeque.h"
|
||||||
#include "nsIDTD.h"
|
#include "nsIDTD.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include "nsITokenizer.h"
|
#include "nsITokenizer.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIElementObserver.h"
|
#include "nsIElementObserver.h"
|
||||||
|
|
|
@ -477,7 +477,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||||
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
|
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
|
||||||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||||
/*autoclose starttags and endtags*/ 0,0,0,
|
/*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 props, prop-range*/ kOmitWS, kNoPropRange,
|
||||||
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
|
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||||
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
|
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
|
||||||
/*autoclose starttags and endtags*/ 0,0,0,
|
/*autoclose starttags and endtags*/ 0,0,0,
|
||||||
/*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone,
|
/*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},
|
/*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown},
|
||||||
|
|
||||||
{ /*tag*/ eHTMLTag_i,
|
{ /*tag*/ eHTMLTag_i,
|
||||||
|
@ -1712,6 +1712,7 @@ PRBool nsHTMLElement::HasSpecialProperty(PRInt32 aProperty) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
|
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
|
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
|
||||||
|
|
||||||
|
@ -1761,9 +1762,12 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
||||||
linenum++;
|
linenum++;
|
||||||
}
|
}
|
||||||
} //for
|
} //for
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
const char* suffix=" ";
|
const char* suffix=" ";
|
||||||
const char* shortSuffix=" ";
|
const char* shortSuffix=" ";
|
||||||
|
@ -1816,9 +1820,12 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
||||||
*/
|
*/
|
||||||
} //for
|
} //for
|
||||||
out<<endl<<endl;
|
out<<endl<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
const char* suffix=" ";
|
const char* suffix=" ";
|
||||||
const char* shortSuffix=" ";
|
const char* shortSuffix=" ";
|
||||||
|
@ -1858,4 +1865,5 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
||||||
|
|
||||||
} //for
|
} //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 kNoStyleLeaksIn = 0x0040;
|
||||||
static const int kNoStyleLeaksOut = 0x0080;
|
static const int kNoStyleLeaksOut = 0x0080;
|
||||||
static const int kMustCloseSelf = 0x0100;
|
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...
|
// The following ints define the standard groups of HTML elements...
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include "nsHTMLContentSinkStream.h"
|
#include "nsHTMLContentSinkStream.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include <iostream.h>
|
|
||||||
|
|
||||||
#define VERBOSE_DEBUG
|
#define VERBOSE_DEBUG
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include "nsHTMLToTXTSinkStream.h"
|
#include "nsHTMLToTXTSinkStream.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "nsHTMLEntities.h"
|
#include "nsHTMLEntities.h"
|
||||||
|
|
|
@ -820,6 +820,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||||
aString+=aChar;
|
aString+=aChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(NS_OK==result){
|
||||||
theRightChars.Truncate(0);
|
theRightChars.Truncate(0);
|
||||||
aString.Right(theRightChars,5);
|
aString.Right(theRightChars,5);
|
||||||
theRightChars.StripChars(" ");
|
theRightChars.StripChars(" ");
|
||||||
|
@ -827,6 +828,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||||
findpos=theRightChars.RFind("-->");
|
findpos=theRightChars.RFind("-->");
|
||||||
if(kNotFound==findpos)
|
if(kNotFound==findpos)
|
||||||
findpos=theRightChars.RFind("!>");
|
findpos=theRightChars.RFind("!>");
|
||||||
|
}
|
||||||
} //while
|
} //while
|
||||||
return result;
|
return result;
|
||||||
} //if
|
} //if
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "nsToken.h"
|
#include "nsToken.h"
|
||||||
#include "nsHTMLTags.h"
|
#include "nsHTMLTags.h"
|
||||||
#include "nsParserError.h"
|
#include "nsParserError.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
class nsScanner;
|
class nsScanner;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "nsScanner.h"
|
#include "nsScanner.h"
|
||||||
#include "prenv.h" //this is here for debug reasons...
|
#include "prenv.h" //this is here for debug reasons...
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include "nsIParserFilter.h"
|
#include "nsIParserFilter.h"
|
||||||
#include "nshtmlpars.h"
|
#include "nshtmlpars.h"
|
||||||
#include "CNavDTD.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){
|
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
|
//NOTE: Make sure that updates to this method don't cause
|
||||||
// bug #2361 to break again!
|
// bug #2361 to break again!
|
||||||
|
|
||||||
|
@ -1024,6 +1016,7 @@ nsParser::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef rickgdebug
|
#ifdef rickgdebug
|
||||||
|
#include <fstream.h>
|
||||||
fstream* gDumpFile;
|
fstream* gDumpFile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
|
||||||
mTypeID=aTag;
|
mTypeID=aTag;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +52,8 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
|
||||||
mTypeID=0;
|
mTypeID=0;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,6 +66,8 @@ CToken::CToken(const char* aName) : mTextValue(aName) {
|
||||||
mTypeID=0;
|
mTypeID=0;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +95,8 @@ void CToken::Reinitialize(PRInt32 aTag, const nsString& aString){
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
mTypeID=aTag;
|
mTypeID=aTag;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
|
|
||||||
class nsScanner;
|
class nsScanner;
|
||||||
|
@ -55,6 +54,8 @@ class nsScanner;
|
||||||
class CToken {
|
class CToken {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum eTokenOrigin {eSource,eResidualStyle};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
* @update gess7/21/98
|
* @update gess7/21/98
|
||||||
|
@ -195,6 +196,9 @@ class CToken {
|
||||||
|
|
||||||
static int GetTokenCount();
|
static int GetTokenCount();
|
||||||
|
|
||||||
|
eTokenOrigin mOrigin;
|
||||||
|
PRBool mRecycle;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PRInt32 mTypeID;
|
PRInt32 mTypeID;
|
||||||
PRInt16 mAttrCount;
|
PRInt16 mAttrCount;
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "nsIContentSink.h"
|
#include "nsIContentSink.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include <fstream.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define NS_XIF_DTD_IID \
|
#define NS_XIF_DTD_IID \
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#ifdef XP_PC
|
#ifdef XP_PC
|
||||||
#include <direct.h> //this is here for debug reasons...
|
#include <direct.h> //this is here for debug reasons...
|
||||||
#include <iostream.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
|
|
||||||
|
@ -476,7 +475,8 @@ nsresult CNavDTD::WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString
|
||||||
|
|
||||||
mFilename=aFilename;
|
mFilename=aFilename;
|
||||||
mHasOpenBody=PR_FALSE;
|
mHasOpenBody=PR_FALSE;
|
||||||
mHadBodyOrFrameset=PR_FALSE;
|
mHadBody=PR_FALSE;
|
||||||
|
mHadFrameset=PR_FALSE;
|
||||||
mLineNumber=1;
|
mLineNumber=1;
|
||||||
mHasOpenScript=PR_FALSE;
|
mHasOpenScript=PR_FALSE;
|
||||||
mSink=(nsIHTMLContentSink*)aSink;
|
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 CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
|
||||||
nsresult result= NS_OK;
|
nsresult result= NS_OK;
|
||||||
|
|
||||||
if((NS_OK==anErrorCode) && (!mHadBodyOrFrameset)) {
|
if((NS_OK==anErrorCode) && (!mHadBody) && (!mHadFrameset)) {
|
||||||
CStartToken theToken(eHTMLTag_body); //open the body container...
|
CStartToken theToken(eHTMLTag_body); //open the body container...
|
||||||
result=HandleStartToken(&theToken);
|
result=HandleStartToken(&theToken);
|
||||||
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
||||||
|
@ -625,6 +625,8 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||||
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
||||||
PRBool execSkipContent=PR_FALSE;
|
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.
|
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.
|
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};
|
static eHTMLTags passThru[]= {eHTMLTag_html,eHTMLTag_comment,eHTMLTag_newline,eHTMLTag_whitespace,eHTMLTag_script};
|
||||||
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
if(!FindTagInSet(theTag,passThru,sizeof(passThru)/sizeof(eHTMLTag_unknown))){
|
||||||
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
if(!gHTMLElements[eHTMLTag_html].SectionContains(theTag,PR_FALSE)) {
|
||||||
if(!mHadBodyOrFrameset){
|
if((!mHadBody) && (!mHadFrameset)){
|
||||||
if(mHasOpenHead) {
|
if(mHasOpenHead) {
|
||||||
//just fall through and handle current token
|
//just fall through and handle current token
|
||||||
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
|
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag)){
|
||||||
mMisplacedContent.Push(aToken);
|
mMisplacedContent.Push(aToken);
|
||||||
|
aToken->mRecycle=PR_FALSE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,6 +698,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
||||||
mParser=(nsParser*)aParser;
|
mParser=(nsParser*)aParser;
|
||||||
result=(*theHandler)(theToken,this);
|
result=(*theHandler)(theToken,this);
|
||||||
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
|
if(NS_SUCCEEDED(result) || (NS_ERROR_HTMLPARSER_BLOCK==result)) {
|
||||||
|
if(theToken->mRecycle)
|
||||||
gRecycler->RecycleToken(theToken);
|
gRecycler->RecycleToken(theToken);
|
||||||
}
|
}
|
||||||
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
|
else if(result==NS_ERROR_HTMLPARSER_STOPPARSING)
|
||||||
|
@ -755,10 +759,6 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
|
||||||
nsresult result=NS_OK;
|
nsresult result=NS_OK;
|
||||||
|
|
||||||
switch(aChildTag){
|
switch(aChildTag){
|
||||||
case eHTMLTag_body:
|
|
||||||
case eHTMLTag_frameset:
|
|
||||||
mHadBodyOrFrameset=PR_TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eHTMLTag_pre:
|
case eHTMLTag_pre:
|
||||||
case eHTMLTag_listing:
|
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.
|
//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
|
// 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 theTagCount = mBodyContext->GetCount();
|
||||||
|
PRInt32 attrCount = aToken->GetAttributeCount();
|
||||||
|
|
||||||
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
|
if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
|
||||||
eHTMLTags theTag;
|
eHTMLTags theTag;
|
||||||
PRInt32 theBCIndex;
|
PRInt32 theBCIndex;
|
||||||
PRBool isNotWhiteSpace = PR_FALSE;
|
PRBool isNotWhiteSpace = PR_FALSE;
|
||||||
PRInt32 attrCount = aToken->GetAttributeCount();
|
|
||||||
while(theTagCount > 0) {
|
while(theTagCount > 0) {
|
||||||
theTag = mBodyContext->TagAt(--theTagCount);
|
theTag = mBodyContext->TagAt(--theTagCount);
|
||||||
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
|
if(!gHTMLElements[theTag].HasSpecialProperty(kBadContentWatch)) {
|
||||||
|
@ -1314,6 +1315,24 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
|
||||||
result=NS_ERROR_HTMLPARSER_MISPLACED;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1356,7 +1375,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
|
||||||
return OpenContainer(attrNode,PR_FALSE);
|
return OpenContainer(attrNode,PR_FALSE);
|
||||||
break;
|
break;
|
||||||
case eHTMLTag_head:
|
case eHTMLTag_head:
|
||||||
if(mHadBodyOrFrameset) {
|
if(mHadBody || mHadFrameset) {
|
||||||
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
|
result=HandleOmittedTag(aToken,theChildTag,theParent,attrNode);
|
||||||
if(result == NS_OK)
|
if(result == NS_OK)
|
||||||
return result;
|
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;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2339,6 +2362,8 @@ nsresult CNavDTD::OpenBody(const nsIParserNode& aNode){
|
||||||
|
|
||||||
nsresult result=NS_OK;
|
nsresult result=NS_OK;
|
||||||
|
|
||||||
|
mHadBody=PR_TRUE;
|
||||||
|
|
||||||
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
|
PRInt32 theHTMLPos=GetTopmostIndexOf(eHTMLTag_html);
|
||||||
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
|
if(kNotFound==theHTMLPos){ //someone forgot to open HTML. Let's do it for them.
|
||||||
nsAutoString theEmpty;
|
nsAutoString theEmpty;
|
||||||
|
@ -2463,9 +2488,11 @@ nsresult CNavDTD::CloseMap(const nsIParserNode& aNode){
|
||||||
*/
|
*/
|
||||||
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
|
nsresult CNavDTD::OpenFrameset(const nsIParserNode& aNode){
|
||||||
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
|
NS_PRECONDITION(mBodyContext->GetCount() >= 0, kInvalidTagStackPos);
|
||||||
|
|
||||||
|
mHadFrameset=PR_TRUE;
|
||||||
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
|
nsresult result=(mSink) ? mSink->OpenFrameset(aNode) : NS_OK;
|
||||||
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
|
mBodyContext->Push((eHTMLTags)aNode.GetNodeType());
|
||||||
mHadBodyOrFrameset=PR_TRUE;
|
mHadFrameset=PR_TRUE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,8 @@ protected:
|
||||||
PRBool mHasOpenMap;
|
PRBool mHasOpenMap;
|
||||||
PRInt32 mHasOpenHead;
|
PRInt32 mHasOpenHead;
|
||||||
PRBool mHasOpenBody;
|
PRBool mHasOpenBody;
|
||||||
PRBool mHadBodyOrFrameset;
|
PRBool mHadFrameset;
|
||||||
|
PRBool mHadBody;
|
||||||
nsString mFilename;
|
nsString mFilename;
|
||||||
nsIDTDDebug* mDTDDebug;
|
nsIDTDDebug* mDTDDebug;
|
||||||
PRInt32 mLineNumber;
|
PRInt32 mLineNumber;
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include "prio.h"
|
#include "prio.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include <fstream.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XP_PC
|
#ifdef XP_PC
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
|
#define PARSER_DLL "libraptorhtmlpars"MOZ_DLL_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ofstream filelist("filelist.out");
|
|
||||||
|
|
||||||
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
PRBool compareFiles(const char* file1,const char* file2,int& failpos) {
|
||||||
PRBool result=PR_TRUE;
|
PRBool result=PR_TRUE;
|
||||||
|
@ -131,7 +130,8 @@ void parseFile (const char* aFilename,int size)
|
||||||
int failpos=0;
|
int failpos=0;
|
||||||
|
|
||||||
if(!compareFiles(aFilename,filename,failpos)) {
|
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 "prio.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "prstrm.h"
|
#include "prstrm.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsQuickSort.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) {
|
void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) {
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
|
#include <fstream.h>
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
fstream out(aFilename,ios::out);
|
fstream out(aFilename,ios::out);
|
||||||
out << "==================================================" << endl;
|
out << "==================================================" << endl;
|
||||||
|
@ -578,6 +582,7 @@ void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char*
|
||||||
}
|
}
|
||||||
else out<<"(not container)" << endl;
|
else out<<"(not container)" << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsDeque.h"
|
#include "nsDeque.h"
|
||||||
#include "nsIDTD.h"
|
#include "nsIDTD.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include "nsITokenizer.h"
|
#include "nsITokenizer.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIElementObserver.h"
|
#include "nsIElementObserver.h"
|
||||||
|
|
|
@ -477,7 +477,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||||
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
|
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
|
||||||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||||
/*autoclose starttags and endtags*/ 0,0,0,
|
/*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 props, prop-range*/ kOmitWS, kNoPropRange,
|
||||||
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
|
/*special parents,kids,skip*/ 0,&gDLKids,eHTMLTag_unknown},
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ nsHTMLElement gHTMLElements[] = {
|
||||||
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
|
/*rootnodes,endrootnodes*/ &gHTMLRootTags, &gHTMLRootTags,
|
||||||
/*autoclose starttags and endtags*/ 0,0,0,
|
/*autoclose starttags and endtags*/ 0,0,0,
|
||||||
/*parent,incl,exclgroups*/ kNone, kHTMLContent, kNone,
|
/*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},
|
/*special parents,kids,skip*/ 0,&gHtmlKids,eHTMLTag_unknown},
|
||||||
|
|
||||||
{ /*tag*/ eHTMLTag_i,
|
{ /*tag*/ eHTMLTag_i,
|
||||||
|
@ -1712,6 +1712,7 @@ PRBool nsHTMLElement::HasSpecialProperty(PRInt32 aProperty) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
|
void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
|
PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object);
|
||||||
|
|
||||||
|
@ -1761,9 +1762,12 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl
|
||||||
linenum++;
|
linenum++;
|
||||||
}
|
}
|
||||||
} //for
|
} //for
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
const char* suffix=" ";
|
const char* suffix=" ";
|
||||||
const char* shortSuffix=" ";
|
const char* shortSuffix=" ";
|
||||||
|
@ -1816,9 +1820,12 @@ void nsHTMLElement::DebugDumpMembership(const char* aFilename){
|
||||||
*/
|
*/
|
||||||
} //for
|
} //for
|
||||||
out<<endl<<endl;
|
out<<endl<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
||||||
|
#ifdef RICKG_DEBUG
|
||||||
|
|
||||||
const char* prefix=" ";
|
const char* prefix=" ";
|
||||||
const char* suffix=" ";
|
const char* suffix=" ";
|
||||||
const char* shortSuffix=" ";
|
const char* shortSuffix=" ";
|
||||||
|
@ -1858,4 +1865,5 @@ void nsHTMLElement::DebugDumpContainType(const char* aFilename){
|
||||||
|
|
||||||
} //for
|
} //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 kNoStyleLeaksIn = 0x0040;
|
||||||
static const int kNoStyleLeaksOut = 0x0080;
|
static const int kNoStyleLeaksOut = 0x0080;
|
||||||
static const int kMustCloseSelf = 0x0100;
|
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...
|
// The following ints define the standard groups of HTML elements...
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include "nsHTMLContentSinkStream.h"
|
#include "nsHTMLContentSinkStream.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include <iostream.h>
|
|
||||||
|
|
||||||
#define VERBOSE_DEBUG
|
#define VERBOSE_DEBUG
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include "nsHTMLToTXTSinkStream.h"
|
#include "nsHTMLToTXTSinkStream.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "nsHTMLEntities.h"
|
#include "nsHTMLEntities.h"
|
||||||
|
|
|
@ -820,6 +820,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||||
aString+=aChar;
|
aString+=aChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(NS_OK==result){
|
||||||
theRightChars.Truncate(0);
|
theRightChars.Truncate(0);
|
||||||
aString.Right(theRightChars,5);
|
aString.Right(theRightChars,5);
|
||||||
theRightChars.StripChars(" ");
|
theRightChars.StripChars(" ");
|
||||||
|
@ -827,6 +828,7 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
|
||||||
findpos=theRightChars.RFind("-->");
|
findpos=theRightChars.RFind("-->");
|
||||||
if(kNotFound==findpos)
|
if(kNotFound==findpos)
|
||||||
findpos=theRightChars.RFind("!>");
|
findpos=theRightChars.RFind("!>");
|
||||||
|
}
|
||||||
} //while
|
} //while
|
||||||
return result;
|
return result;
|
||||||
} //if
|
} //if
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "nsToken.h"
|
#include "nsToken.h"
|
||||||
#include "nsHTMLTags.h"
|
#include "nsHTMLTags.h"
|
||||||
#include "nsParserError.h"
|
#include "nsParserError.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
class nsScanner;
|
class nsScanner;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "nsScanner.h"
|
#include "nsScanner.h"
|
||||||
#include "prenv.h" //this is here for debug reasons...
|
#include "prenv.h" //this is here for debug reasons...
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include <fstream.h>
|
|
||||||
#include "nsIParserFilter.h"
|
#include "nsIParserFilter.h"
|
||||||
#include "nshtmlpars.h"
|
#include "nshtmlpars.h"
|
||||||
#include "CNavDTD.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){
|
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
|
//NOTE: Make sure that updates to this method don't cause
|
||||||
// bug #2361 to break again!
|
// bug #2361 to break again!
|
||||||
|
|
||||||
|
@ -1024,6 +1016,7 @@ nsParser::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef rickgdebug
|
#ifdef rickgdebug
|
||||||
|
#include <fstream.h>
|
||||||
fstream* gDumpFile;
|
fstream* gDumpFile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
|
||||||
mTypeID=aTag;
|
mTypeID=aTag;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +52,8 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
|
||||||
mTypeID=0;
|
mTypeID=0;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,6 +66,8 @@ CToken::CToken(const char* aName) : mTextValue(aName) {
|
||||||
mTypeID=0;
|
mTypeID=0;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
TokenCount++;
|
TokenCount++;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +95,8 @@ void CToken::Reinitialize(PRInt32 aTag, const nsString& aString){
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
mTypeID=aTag;
|
mTypeID=aTag;
|
||||||
mAttrCount=0;
|
mAttrCount=0;
|
||||||
|
mOrigin=eSource;
|
||||||
|
mRecycle=PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include <iostream.h>
|
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
|
|
||||||
class nsScanner;
|
class nsScanner;
|
||||||
|
@ -55,6 +54,8 @@ class nsScanner;
|
||||||
class CToken {
|
class CToken {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum eTokenOrigin {eSource,eResidualStyle};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
* @update gess7/21/98
|
* @update gess7/21/98
|
||||||
|
@ -195,6 +196,9 @@ class CToken {
|
||||||
|
|
||||||
static int GetTokenCount();
|
static int GetTokenCount();
|
||||||
|
|
||||||
|
eTokenOrigin mOrigin;
|
||||||
|
PRBool mRecycle;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PRInt32 mTypeID;
|
PRInt32 mTypeID;
|
||||||
PRInt16 mAttrCount;
|
PRInt16 mAttrCount;
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "nsIContentSink.h"
|
#include "nsIContentSink.h"
|
||||||
#include "nsHTMLTokens.h"
|
#include "nsHTMLTokens.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include <fstream.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define NS_XIF_DTD_IID \
|
#define NS_XIF_DTD_IID \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче