removed warnings; retry landing Strict DTD. r=harishd

This commit is contained in:
rickg%netscape.com 2000-04-19 08:08:28 +00:00
Родитель e4b10a0922
Коммит 29386ec285
20 изменённых файлов: 438 добавлений и 196 удалений

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

@ -1,4 +1,4 @@
#if 0
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Netscape Public
@ -20,9 +20,9 @@
*
* Contributor(s):
*/
//#define ENABLE_CRC
//#define RICKG_DEBUG
//#define RICKG_DEBUG
#ifdef RICKG_DEBUG
@ -70,9 +70,9 @@ static char* kVerificationDir = "c:/temp";
static char gShowCRC;
#endif
#ifdef MOZ_PERF_METRICS
#ifdef MOZ_PERF_METRICS
# define START_TIMER() \
if(mParser) MOZ_TIMER_START(mParser->mParseTime); \
if(mParser) MOZ_TIMER_START(mParser->mDTDTime);
@ -190,14 +190,14 @@ nsCParserNode* COtherDTD::CreateNode(void) {
}
else{
result=new nsCParserNode();
#ifdef NS_DEBUG
#ifdef NS_DEBUG
#if 1
gNodeCount++;
gNodeCount++;
#endif
#endif
}
return result;
}
}
/**
@ -2032,5 +2032,3 @@ nsresult COtherDTD::WillInterruptParse(void){
return result;
}
#endif

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

@ -231,7 +231,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -250,21 +257,12 @@ public:
class CDeprecatedElement: public CElement {
public:
static CGroupMembers& GetGroup(void) {
static CGroupMembers theGroup={0};
return theGroup;
}
static CGroupMembers& GetContainedGroups(void) {
static CGroupMembers theContainedGroups={0};
return theContainedGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
anElement.mGroup.mAllBits=0;
anElement.mContainsGroups.mAllBits=0;
}
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
@ -305,7 +303,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -336,7 +341,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aContainsGroup){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
@ -370,7 +382,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -400,7 +419,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -433,7 +459,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -463,15 +496,15 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
CFontStyleElement(eHTMLTags aTag) : CElement(aTag) {
Initialize(*this,aTag,GetGroup(),GetContainedGroups());
Initialize(*this,aTag);
}
};
@ -494,7 +527,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aContainsGroup){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
@ -527,7 +567,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -559,7 +606,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -589,7 +643,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -620,7 +681,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -639,27 +707,18 @@ public:
class CFrameElement: public CElement {
public:
static CGroupMembers& GetGroup(void) {
static CGroupMembers theGroup={0};
theGroup.mBits.mFrame=1;
return theGroup;
}
static CGroupMembers& GetContainedGroups(void) {
static CGroupMembers theGroup={0};
theGroup.mBits.mFrame=1;
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
anElement.mGroup.mAllBits=0;
anElement.mGroup.mBits.mFrame=1;
anElement.mContainsGroups.mAllBits=0;
anElement.mContainsGroups.mBits.mFrame=1;
}
CFrameElement(eHTMLTags aTag) : CElement(aTag) {
Initialize(*this,aTag,GetGroup(),GetContainedGroups());
Initialize(*this,aTag);
}
};
@ -716,7 +775,14 @@ public:
return theGroupsContainedByHead;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -806,7 +872,14 @@ public:
return theContainedGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -866,11 +939,12 @@ public:
class CTitleElement : public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
CTitleElement() : CTextContainer(eHTMLTag_title), mText("") {
@ -923,6 +997,10 @@ public:
class CStyleElement: public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=CTextContainer::GetGroup(), CGroupMembers& aGroupContains=CTextContainer::GetContainedGroups()){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
@ -940,6 +1018,10 @@ public:
class CScriptElement: public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=CTextContainer::GetGroup(), CGroupMembers& aGroupContains=CTextContainer::GetContainedGroups()){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
@ -970,7 +1052,15 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -1337,7 +1427,7 @@ void CElementTable::InitializeElements() {
mDfltElements[eHTMLTag_form].mIncludeKids=kFormKids;
mDfltElements[eHTMLTag_form].mExcludeKids=kFormExcludeKids;
CLeafElement::Initialize( mDfltElements[eHTMLTag_frame], eHTMLTag_frame, CFrameElement::GetGroup(), CLeafElement::GetContainedGroups());
CFrameElement::Initialize( mDfltElements[eHTMLTag_frame], eHTMLTag_frame);
CFrameElement::Initialize( mDfltElements[eHTMLTag_frameset], eHTMLTag_frameset);
mDfltElements[eHTMLTag_frameset].mIncludeKids=kFramesetKids;
@ -1358,9 +1448,9 @@ void CElementTable::InitializeElements() {
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
CLeafElement::Initialize( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
CLeafElement::Initialize( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
CPhraseElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
CLeafElement::Initialize( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
CPhraseElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
@ -1413,7 +1503,7 @@ void CElementTable::InitializeElements() {
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mBits.mLeaf=1;
CBlockElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
CLeafElement::Initialize( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);

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

@ -141,6 +141,41 @@ void CParserContext::SetMimeType(const nsString& aMimeType){
else if(mMimeType.EqualsWithConversion(kXIFTextContentType))
mDocType=eXMLText;
}
/*************************************************************************************************
First, let's define our modalities:
1. compatibility-mode: behave as much like nav4 as possible (unless it's too broken to bother)
2. standard-mode: do html as well as you can per spec, and throw out navigator quirks
3. strict-mode: adhere to the strict DTD specificiation to the highest degree possible
Assume the doctype is in the following form:
<!DOCTYPE [Top Level Element] [Availability] "[Registration]// [Owner-ID] // [Type] [desc-text] // [Language]" "URI|text-identifier">
[HTML] [PUBLIC|...] [+|-] [W3C|IETF|...] [DTD] "..." [EN]|...] "..."
Here are the new rules for DTD handling; comments welcome:
- strict dtd's enable strict-mode (and naturally our strict DTD):
- example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
- example: <!DOCTYPE \"ISO/IEC 15445:1999//DTD HTML//EN\">
- XHTML and XML documents are always strict:
- example: <!DOCTYPE \"-//W3C//DTD XHTML 1.0 Strict//EN\">
- transitional, frameset, etc. without URI enables compatibility-mode:
- example: <!DOCTYPE \"-//W3C//DTD HTML 4.01 Transitional//EN\">
- unless the URI points to the strict.dtd, then we use strict:
- example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
- doctypes with systemID's or internal subset are handled in strict:
- example: <!DOCTYPE HTML PUBLIC PublicID SystemID>
- example: <!DOCTYPE HTML (PUBLIC PublicID SystemID? | SYSTEM SystemID) [ Internal-SS ]>
- all other doctypes are handled in compatibility-mode
*****************************************************************************************************/
/**
* This is called when it's time to find out
@ -155,20 +190,16 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
mParseMode = eParseMode_unknown;
PRInt32 theIndex=theBuffer.Find("<!",PR_FALSE,-1);
if(kNotFound<theIndex)
theIndex=theBuffer.Find("DOCTYPE",PR_TRUE,theIndex+1,10);
PRInt32 theIndex=theBuffer.Find("DOCTYPE",PR_TRUE,0,10);
if(kNotFound<theIndex) {
//good, we found "DOCTYPE" -- now go find it's end delimiter '>'
PRInt32 theGTPos=theBuffer.FindChar(kGreaterThan,theIndex+1);
PRInt32 theEnd=(kNotFound==theGTPos) ? 512 : MinInt(512,theGTPos);
PRInt32 theSubIndex=theBuffer.Find("//DTD",PR_TRUE,theIndex+8,theEnd-(theIndex+8));
PRInt32 theSubIndex=theBuffer.Find("//DTD",PR_TRUE,theIndex+8,theEnd-(theIndex+8)); //skip to the type and desc-text...
PRInt32 theErr=0;
PRInt32 theMajorVersion=3;
//note that if we don't find '>', then we just scan the first 512 bytes.
if(0<=theSubIndex) {
@ -199,7 +230,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
theMajorVersion=3;
}
else {
theSubIndex=theBuffer.Find("HYPERTEXT MARKUP LANGUAGE",PR_TRUE,theStartPos,theCount);
theSubIndex=theBuffer.Find("HYPERTEXT MARKUP",PR_TRUE,theStartPos,theCount);
if(0<=theSubIndex) {
mDocType=eHTML3Text;
mParseMode=eParseMode_quirks;
@ -214,15 +245,16 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
theCount=theEnd-theStartPos;
nsAutoString theNum;
//get the next substring from the buffer, which should be a number.
//now see what the version number is...
theStartPos=theBuffer.FindCharInSet("123456789",theStartPos);
if(0<=theStartPos) {
theBuffer.Mid(theNum,theStartPos-1,3);
theMajorVersion=theNum.ToInteger(&theErr);
}
//get the next substring from the buffer, which should be a number.
//now see what the version number is...
//now see what the
theStartPos+=3;
theCount=theEnd-theStartPos;
if((theBuffer.Find("TRANSITIONAL",PR_TRUE,theStartPos,theCount)>kNotFound)||
@ -231,7 +263,17 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
(theBuffer.Find("LATIN1", PR_TRUE,theStartPos,theCount) >kNotFound) ||
(theBuffer.Find("SYMBOLS",PR_TRUE,theStartPos,theCount) >kNotFound) ||
(theBuffer.Find("SPECIAL",PR_TRUE,theStartPos,theCount) >kNotFound)) {
mParseMode=eParseMode_noquirks;
mParseMode=eParseMode_quirks;
}
//one last thing: look for a URI that specifies the strict.dtd
theStartPos+=6;
theCount=theEnd-theStartPos;
theSubIndex=theBuffer.Find("STRICT.DTD",PR_TRUE,theStartPos,theCount);
if(0<theSubIndex) {
//Since we found it, regardless of what's in the descr-text, kick into strict mode.
mParseMode=eParseMode_strict;
mDocType=eHTML4Text;
}
if(eXHTMLText!=mDocType) {
@ -252,7 +294,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
} //switch
}
}
} //if
else {
PRInt32 thePos=theBuffer.Find("HTML",PR_TRUE,1,50);
@ -266,15 +308,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
}
}
else if(kNotFound<(theIndex=theBuffer.Find("?XML",PR_TRUE,0,128))) {
mParseMode=eParseMode_noquirks;
}
else {
//this is debug only, and will go away by the time we ship...
theIndex=theBuffer.Find("NOQUIRKS",PR_TRUE,0,128);
mDocType=eHTML4Text;
if(kNotFound<theIndex) {
mParseMode=eParseMode_noquirks;
}
mParseMode=eParseMode_strict;
}
if(theModeStr) {

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

@ -67,6 +67,9 @@ public:
CParserContext* mPrevContext;
eParseMode mParseMode;
eParserDocType mDocType;
nsAutoString mMimeType;
eStreamState mStreamListenerState; //this is really only here for debug purposes.
PRBool mMultipart;
eContextType mContextType;
@ -74,9 +77,6 @@ public:
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
nsIChannel* mChannel; // provided by necko to differnciate different input streams
nsAutoString mMimeType;
eParserDocType mDocType;
nsScanner* mScanner;
nsIDTD* mDTD;

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

@ -341,7 +341,7 @@ nsExpatTokenizer::AddErrorMessageTokens(nsParserError* aError)
mState->tokenRecycler->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown);
nsString& key = attrToken->GetKey();
key.AssignWithConversion("xmlns");
attrToken->SetStringValue(kHTMLNameSpaceURI);
attrToken->SetCStringValue(kHTMLNameSpaceURI);
newToken->SetAttributeCount(1);
newToken = (CToken*) attrToken;
AddToken(newToken, NS_OK, mState->tokenDeque, mState->tokenRecycler);

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

@ -70,7 +70,7 @@ CHTMLToken::CHTMLToken(eHTMLTags aTag) : CToken(aTag) {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
void CHTMLToken::SetStringValue(const char* name){
void CHTMLToken::SetCStringValue(const char* name){
if(name) {
mTextValue.AssignWithConversion(name);
mTypeID = nsHTMLTags::LookupTag(mTextValue);
@ -324,7 +324,7 @@ void CStartToken::AppendSource(nsString& anOutputString){
* @return
*/
CEndToken::CEndToken(eHTMLTags aTag) : CHTMLToken(aTag) {
SetStringValue(GetTagName(aTag));
SetCStringValue(GetTagName(aTag));
}

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

@ -100,7 +100,7 @@ public:
CHTMLToken(eHTMLTags aTag);
CHTMLToken(const nsString& aString,eHTMLTags aTag=eHTMLTag_unknown);
virtual void SetStringValue(const char* name);
virtual void SetCStringValue(const char* name);
virtual nsString& GetStringValueXXX(void);
protected:

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

@ -97,7 +97,7 @@ public:
nsIDTD* theDTD;
NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD...
mDTDDeque.Push(theDTD);
#if 0
#if 1
NS_NewOtherHTMLDTD(&theDTD); //do this as the default DTD for strict documents...
mDTDDeque.Push(theDTD);
#endif

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

@ -164,15 +164,14 @@ void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
void CToken::SetStringValue(const char* name){
void CToken::SetCStringValue(const char* name){
mTextValue.AssignWithConversion(name);
}
/**
* Setter method for the string value of this token
*/
void CToken::SetStringValue(nsString& aStr)
{
void CToken::SetStringValue(nsString& aStr) {
mTextValue = aStr;
}

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

@ -124,7 +124,7 @@ class CToken {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
virtual void SetStringValue(const char* name);
virtual void SetCStringValue(const char* name);
/**
* Setter method for the string value of this token

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

@ -1,4 +1,4 @@
#if 0
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Netscape Public
@ -20,9 +20,9 @@
*
* Contributor(s):
*/
//#define ENABLE_CRC
//#define RICKG_DEBUG
//#define RICKG_DEBUG
#ifdef RICKG_DEBUG
@ -70,9 +70,9 @@ static char* kVerificationDir = "c:/temp";
static char gShowCRC;
#endif
#ifdef MOZ_PERF_METRICS
#ifdef MOZ_PERF_METRICS
# define START_TIMER() \
if(mParser) MOZ_TIMER_START(mParser->mParseTime); \
if(mParser) MOZ_TIMER_START(mParser->mDTDTime);
@ -190,14 +190,14 @@ nsCParserNode* COtherDTD::CreateNode(void) {
}
else{
result=new nsCParserNode();
#ifdef NS_DEBUG
#ifdef NS_DEBUG
#if 1
gNodeCount++;
gNodeCount++;
#endif
#endif
}
return result;
}
}
/**
@ -2032,5 +2032,3 @@ nsresult COtherDTD::WillInterruptParse(void){
return result;
}
#endif

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

@ -231,7 +231,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -250,21 +257,12 @@ public:
class CDeprecatedElement: public CElement {
public:
static CGroupMembers& GetGroup(void) {
static CGroupMembers theGroup={0};
return theGroup;
}
static CGroupMembers& GetContainedGroups(void) {
static CGroupMembers theContainedGroups={0};
return theContainedGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=0;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
anElement.mGroup.mAllBits=0;
anElement.mContainsGroups.mAllBits=0;
}
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
@ -305,7 +303,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -336,7 +341,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aContainsGroup){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
@ -370,7 +382,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -400,7 +419,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -433,7 +459,14 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -463,15 +496,15 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
CFontStyleElement(eHTMLTags aTag) : CElement(aTag) {
Initialize(*this,aTag,GetGroup(),GetContainedGroups());
Initialize(*this,aTag);
}
};
@ -494,7 +527,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aContainsGroup=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aContainsGroup){
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aContainsGroup.mAllBits;
@ -527,7 +567,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -559,7 +606,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -589,7 +643,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -620,7 +681,14 @@ public:
return theGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -639,27 +707,18 @@ public:
class CFrameElement: public CElement {
public:
static CGroupMembers& GetGroup(void) {
static CGroupMembers theGroup={0};
theGroup.mBits.mFrame=1;
return theGroup;
}
static CGroupMembers& GetContainedGroups(void) {
static CGroupMembers theGroup={0};
theGroup.mBits.mFrame=1;
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
anElement.mGroup.mAllBits=0;
anElement.mGroup.mBits.mFrame=1;
anElement.mContainsGroups.mAllBits=0;
anElement.mContainsGroups.mBits.mFrame=1;
}
CFrameElement(eHTMLTags aTag) : CElement(aTag) {
Initialize(*this,aTag,GetGroup(),GetContainedGroups());
Initialize(*this,aTag);
}
};
@ -716,7 +775,14 @@ public:
return theGroupsContainedByHead;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -806,7 +872,14 @@ public:
return theContainedGroups;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -866,11 +939,12 @@ public:
class CTitleElement : public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
anElement.mContainsGroups.mAllBits=aGroupContains.mAllBits;
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
CTitleElement() : CTextContainer(eHTMLTag_title), mText("") {
@ -923,6 +997,10 @@ public:
class CStyleElement: public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=CTextContainer::GetGroup(), CGroupMembers& aGroupContains=CTextContainer::GetContainedGroups()){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
@ -940,6 +1018,10 @@ public:
class CScriptElement: public CTextContainer {
public:
static void Initialize(CElement& anElement,eHTMLTags aTag){
CTextContainer::Initialize(anElement,aTag);
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=CTextContainer::GetGroup(), CGroupMembers& aGroupContains=CTextContainer::GetContainedGroups()){
CTextContainer::Initialize(anElement,aTag,aGroup,aGroupContains);
}
@ -970,7 +1052,15 @@ public:
return theGroup;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup=GetGroup(), CGroupMembers& aGroupContains=GetContainedGroups()){
static void Initialize(CElement& anElement,eHTMLTags aTag){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=GetGroup().mAllBits;
anElement.mContainsGroups.mAllBits=GetContainedGroups().mAllBits;
}
static void Initialize(CElement& anElement,eHTMLTags aTag,CGroupMembers& aGroup, CGroupMembers& aGroupContains){
anElement.mProperties.mIsContainer=1;
anElement.mTag=aTag;
anElement.mGroup.mAllBits=aGroup.mAllBits;
@ -1337,7 +1427,7 @@ void CElementTable::InitializeElements() {
mDfltElements[eHTMLTag_form].mIncludeKids=kFormKids;
mDfltElements[eHTMLTag_form].mExcludeKids=kFormExcludeKids;
CLeafElement::Initialize( mDfltElements[eHTMLTag_frame], eHTMLTag_frame, CFrameElement::GetGroup(), CLeafElement::GetContainedGroups());
CFrameElement::Initialize( mDfltElements[eHTMLTag_frame], eHTMLTag_frame);
CFrameElement::Initialize( mDfltElements[eHTMLTag_frameset], eHTMLTag_frameset);
mDfltElements[eHTMLTag_frameset].mIncludeKids=kFramesetKids;
@ -1358,9 +1448,9 @@ void CElementTable::InitializeElements() {
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
CLeafElement::Initialize( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
CLeafElement::Initialize( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
CPhraseElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
CLeafElement::Initialize( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
CPhraseElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
@ -1413,7 +1503,7 @@ void CElementTable::InitializeElements() {
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mBits.mLeaf=1;
CBlockElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
CLeafElement::Initialize( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup());
CLeafElement::Initialize( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);

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

@ -141,6 +141,41 @@ void CParserContext::SetMimeType(const nsString& aMimeType){
else if(mMimeType.EqualsWithConversion(kXIFTextContentType))
mDocType=eXMLText;
}
/*************************************************************************************************
First, let's define our modalities:
1. compatibility-mode: behave as much like nav4 as possible (unless it's too broken to bother)
2. standard-mode: do html as well as you can per spec, and throw out navigator quirks
3. strict-mode: adhere to the strict DTD specificiation to the highest degree possible
Assume the doctype is in the following form:
<!DOCTYPE [Top Level Element] [Availability] "[Registration]// [Owner-ID] // [Type] [desc-text] // [Language]" "URI|text-identifier">
[HTML] [PUBLIC|...] [+|-] [W3C|IETF|...] [DTD] "..." [EN]|...] "..."
Here are the new rules for DTD handling; comments welcome:
- strict dtd's enable strict-mode (and naturally our strict DTD):
- example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
- example: <!DOCTYPE \"ISO/IEC 15445:1999//DTD HTML//EN\">
- XHTML and XML documents are always strict:
- example: <!DOCTYPE \"-//W3C//DTD XHTML 1.0 Strict//EN\">
- transitional, frameset, etc. without URI enables compatibility-mode:
- example: <!DOCTYPE \"-//W3C//DTD HTML 4.01 Transitional//EN\">
- unless the URI points to the strict.dtd, then we use strict:
- example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
- doctypes with systemID's or internal subset are handled in strict:
- example: <!DOCTYPE HTML PUBLIC PublicID SystemID>
- example: <!DOCTYPE HTML (PUBLIC PublicID SystemID? | SYSTEM SystemID) [ Internal-SS ]>
- all other doctypes are handled in compatibility-mode
*****************************************************************************************************/
/**
* This is called when it's time to find out
@ -155,20 +190,16 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
mParseMode = eParseMode_unknown;
PRInt32 theIndex=theBuffer.Find("<!",PR_FALSE,-1);
if(kNotFound<theIndex)
theIndex=theBuffer.Find("DOCTYPE",PR_TRUE,theIndex+1,10);
PRInt32 theIndex=theBuffer.Find("DOCTYPE",PR_TRUE,0,10);
if(kNotFound<theIndex) {
//good, we found "DOCTYPE" -- now go find it's end delimiter '>'
PRInt32 theGTPos=theBuffer.FindChar(kGreaterThan,theIndex+1);
PRInt32 theEnd=(kNotFound==theGTPos) ? 512 : MinInt(512,theGTPos);
PRInt32 theSubIndex=theBuffer.Find("//DTD",PR_TRUE,theIndex+8,theEnd-(theIndex+8));
PRInt32 theSubIndex=theBuffer.Find("//DTD",PR_TRUE,theIndex+8,theEnd-(theIndex+8)); //skip to the type and desc-text...
PRInt32 theErr=0;
PRInt32 theMajorVersion=3;
//note that if we don't find '>', then we just scan the first 512 bytes.
if(0<=theSubIndex) {
@ -199,7 +230,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
theMajorVersion=3;
}
else {
theSubIndex=theBuffer.Find("HYPERTEXT MARKUP LANGUAGE",PR_TRUE,theStartPos,theCount);
theSubIndex=theBuffer.Find("HYPERTEXT MARKUP",PR_TRUE,theStartPos,theCount);
if(0<=theSubIndex) {
mDocType=eHTML3Text;
mParseMode=eParseMode_quirks;
@ -214,15 +245,16 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
theCount=theEnd-theStartPos;
nsAutoString theNum;
//get the next substring from the buffer, which should be a number.
//now see what the version number is...
theStartPos=theBuffer.FindCharInSet("123456789",theStartPos);
if(0<=theStartPos) {
theBuffer.Mid(theNum,theStartPos-1,3);
theMajorVersion=theNum.ToInteger(&theErr);
}
//get the next substring from the buffer, which should be a number.
//now see what the version number is...
//now see what the
theStartPos+=3;
theCount=theEnd-theStartPos;
if((theBuffer.Find("TRANSITIONAL",PR_TRUE,theStartPos,theCount)>kNotFound)||
@ -231,7 +263,17 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
(theBuffer.Find("LATIN1", PR_TRUE,theStartPos,theCount) >kNotFound) ||
(theBuffer.Find("SYMBOLS",PR_TRUE,theStartPos,theCount) >kNotFound) ||
(theBuffer.Find("SPECIAL",PR_TRUE,theStartPos,theCount) >kNotFound)) {
mParseMode=eParseMode_noquirks;
mParseMode=eParseMode_quirks;
}
//one last thing: look for a URI that specifies the strict.dtd
theStartPos+=6;
theCount=theEnd-theStartPos;
theSubIndex=theBuffer.Find("STRICT.DTD",PR_TRUE,theStartPos,theCount);
if(0<theSubIndex) {
//Since we found it, regardless of what's in the descr-text, kick into strict mode.
mParseMode=eParseMode_strict;
mDocType=eHTML4Text;
}
if(eXHTMLText!=mDocType) {
@ -252,7 +294,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
} //switch
}
}
} //if
else {
PRInt32 thePos=theBuffer.Find("HTML",PR_TRUE,1,50);
@ -266,15 +308,7 @@ eParseMode CParserContext::DetermineParseMode(const nsString& theBuffer) {
}
}
else if(kNotFound<(theIndex=theBuffer.Find("?XML",PR_TRUE,0,128))) {
mParseMode=eParseMode_noquirks;
}
else {
//this is debug only, and will go away by the time we ship...
theIndex=theBuffer.Find("NOQUIRKS",PR_TRUE,0,128);
mDocType=eHTML4Text;
if(kNotFound<theIndex) {
mParseMode=eParseMode_noquirks;
}
mParseMode=eParseMode_strict;
}
if(theModeStr) {

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

@ -67,6 +67,9 @@ public:
CParserContext* mPrevContext;
eParseMode mParseMode;
eParserDocType mDocType;
nsAutoString mMimeType;
eStreamState mStreamListenerState; //this is really only here for debug purposes.
PRBool mMultipart;
eContextType mContextType;
@ -74,9 +77,6 @@ public:
eParserCommands mParserCommand; //tells us to viewcontent/viewsource/viewerrors...
nsIChannel* mChannel; // provided by necko to differnciate different input streams
nsAutoString mMimeType;
eParserDocType mDocType;
nsScanner* mScanner;
nsIDTD* mDTD;

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

@ -341,7 +341,7 @@ nsExpatTokenizer::AddErrorMessageTokens(nsParserError* aError)
mState->tokenRecycler->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown);
nsString& key = attrToken->GetKey();
key.AssignWithConversion("xmlns");
attrToken->SetStringValue(kHTMLNameSpaceURI);
attrToken->SetCStringValue(kHTMLNameSpaceURI);
newToken->SetAttributeCount(1);
newToken = (CToken*) attrToken;
AddToken(newToken, NS_OK, mState->tokenDeque, mState->tokenRecycler);

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

@ -70,7 +70,7 @@ CHTMLToken::CHTMLToken(eHTMLTags aTag) : CToken(aTag) {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
void CHTMLToken::SetStringValue(const char* name){
void CHTMLToken::SetCStringValue(const char* name){
if(name) {
mTextValue.AssignWithConversion(name);
mTypeID = nsHTMLTags::LookupTag(mTextValue);
@ -324,7 +324,7 @@ void CStartToken::AppendSource(nsString& anOutputString){
* @return
*/
CEndToken::CEndToken(eHTMLTags aTag) : CHTMLToken(aTag) {
SetStringValue(GetTagName(aTag));
SetCStringValue(GetTagName(aTag));
}

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

@ -100,7 +100,7 @@ public:
CHTMLToken(eHTMLTags aTag);
CHTMLToken(const nsString& aString,eHTMLTags aTag=eHTMLTag_unknown);
virtual void SetStringValue(const char* name);
virtual void SetCStringValue(const char* name);
virtual nsString& GetStringValueXXX(void);
protected:

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

@ -97,7 +97,7 @@ public:
nsIDTD* theDTD;
NS_NewNavHTMLDTD(&theDTD); //do this as a default HTML DTD...
mDTDDeque.Push(theDTD);
#if 0
#if 1
NS_NewOtherHTMLDTD(&theDTD); //do this as the default DTD for strict documents...
mDTDDeque.Push(theDTD);
#endif

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

@ -164,15 +164,14 @@ void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
void CToken::SetStringValue(const char* name){
void CToken::SetCStringValue(const char* name){
mTextValue.AssignWithConversion(name);
}
/**
* Setter method for the string value of this token
*/
void CToken::SetStringValue(nsString& aStr)
{
void CToken::SetStringValue(nsString& aStr) {
mTextValue = aStr;
}

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

@ -124,7 +124,7 @@ class CToken {
* @update gess5/11/98
* @param name is a char* value containing new string value
*/
virtual void SetStringValue(const char* name);
virtual void SetCStringValue(const char* name);
/**
* Setter method for the string value of this token