зеркало из https://github.com/mozilla/pjs.git
Fix for bugs
1312 - Mapped all HTML 4.0x FPIs to NOQUIRKS mode. 2749 - Tweaked strict comment handling code. -> r=rickg 17148 - Making sure that BeginContext() is ended only by EndContext() 17113, 1262 - Made AddLeaf(), in DTD, to be cautious in handling text tokens. Using bit-wise search for IsContainer() instead of looping. ( nsElementTable ) Fixed warnings. r=pollmann
This commit is contained in:
Родитель
d9e9f039be
Коммит
727a309c06
|
@ -1176,10 +1176,10 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
|
|||
if(attrCount > 0) {
|
||||
nsCParserNode* theAttrNode = (nsCParserNode*)&aNode;
|
||||
while(attrCount > 0){
|
||||
CToken* theToken=theAttrNode->PopAttributeToken();
|
||||
if(theToken){
|
||||
mMisplacedContent.Push(theToken);
|
||||
theToken->mRecycle=PR_FALSE;
|
||||
CToken* theAttrToken=theAttrNode->PopAttributeToken();
|
||||
if(theAttrToken){
|
||||
mMisplacedContent.Push(theAttrToken);
|
||||
theAttrToken->mRecycle=PR_FALSE;
|
||||
}
|
||||
attrCount--;
|
||||
}
|
||||
|
@ -1527,6 +1527,8 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
|
|||
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
|
||||
STOP_TIMER()
|
||||
// Pause the main context and switch to the new context.
|
||||
eHTMLTags theParentTag=mBodyContext->TagAt(theBadContentIndex);
|
||||
|
||||
mSink->BeginContext(theBadContentIndex);
|
||||
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
|
||||
START_TIMER()
|
||||
|
@ -1553,8 +1555,13 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
|
|||
mTokenizer->PushTokenFront(theAttrToken);
|
||||
}
|
||||
theBadTokenCount--;
|
||||
}
|
||||
result=HandleToken(theToken,mParser);
|
||||
}
|
||||
// Make sure that the BeginContext() is ended only by the call to
|
||||
// EndContext().
|
||||
if(theTag!=theParentTag || eToken_end!=theToken->GetTokenType())
|
||||
result=HandleToken(theToken,mParser);
|
||||
else
|
||||
gRecycler->RecycleToken(theToken);
|
||||
}
|
||||
}
|
||||
theBadTokenCount--;
|
||||
|
@ -2859,6 +2866,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
|
|||
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
PRBool done=PR_FALSE;
|
||||
eHTMLTags thePrevTag=theTag;
|
||||
nsCParserNode* theNode=CreateNode();
|
||||
CTokenRecycler* theRecycler=(CTokenRecycler*)mTokenizer->GetTokenRecycler();
|
||||
while(!done && NS_SUCCEEDED(result)) {
|
||||
|
@ -2884,13 +2892,15 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
|
|||
}
|
||||
else delete theToken;
|
||||
}
|
||||
|
||||
|
||||
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
thePrevTag=theTag;
|
||||
}
|
||||
break;
|
||||
case eHTMLTag_text:
|
||||
if(mHasOpenBody && (!mHasOpenHead)) {
|
||||
if((mHasOpenBody) && (!mHasOpenHead) &&
|
||||
!(nsHTMLElement::IsWhitespaceTag(thePrevTag))) {
|
||||
theToken=mTokenizer->PopToken();
|
||||
theNode->Init(theToken,mLineNumber);
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kOmitWS, 10,
|
||||
/*special props, prop-range*/ kOmitWS|kNonContainer, 10,
|
||||
/*special parents,kids,skip*/ 0,&gUnknownKids,eHTMLTag_unknown);
|
||||
|
||||
/*************************************************
|
||||
|
@ -307,7 +307,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gAreaParent,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kInlineEntity, kSelf,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gAreaParent,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -325,7 +325,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -334,7 +334,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, SPECIALTYPE, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -397,7 +397,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -451,7 +451,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gColParents,&gColParents,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoPropagate|kOmitWS,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNoPropagate|kOmitWS|kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gColParents,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -541,7 +541,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kBlockEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -586,7 +586,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInFrameset,&gInFrameset,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn, kNoPropRange,
|
||||
/*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn|kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInFrameset,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -668,7 +668,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ &gHRAutoClose,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kBlock, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -713,7 +713,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -722,7 +722,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -731,7 +731,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFormControl, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -749,7 +749,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ (kBlock|kHeadContent), kFlowEntity, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -767,7 +767,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -812,7 +812,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead,&gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -848,7 +848,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn, kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn|kNonContainer, kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -956,7 +956,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gParamParents, &gParamParents,
|
||||
/*autoclose starttags and endtags*/ &gPAutoClose,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gParamParents,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -974,7 +974,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kFlowEntity, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_html);
|
||||
|
||||
Initialize(
|
||||
|
@ -1075,7 +1075,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1115,7 +1115,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kPCDATA, kNone,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn, kNoPropRange,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn|kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_style);
|
||||
|
||||
Initialize(
|
||||
|
@ -1260,7 +1260,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1269,7 +1269,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kPreformatted, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_xmp);
|
||||
|
||||
Initialize(
|
||||
|
@ -1278,7 +1278,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1287,7 +1287,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1296,7 +1296,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1382,20 +1382,7 @@ PRBool nsHTMLElement::IsContainer(eHTMLTags aChild) {
|
|||
PRBool result=(eHTMLTag_unknown==aChild);
|
||||
|
||||
if(!result){
|
||||
static eHTMLTags gNonContainers[]={
|
||||
eHTMLTag_unknown,
|
||||
eHTMLTag_area, eHTMLTag_base, eHTMLTag_basefont,
|
||||
eHTMLTag_br, eHTMLTag_col, eHTMLTag_embed,
|
||||
eHTMLTag_frame, eHTMLTag_hr, eHTMLTag_img,
|
||||
eHTMLTag_image, eHTMLTag_input, eHTMLTag_keygen,
|
||||
eHTMLTag_link, eHTMLTag_isindex, eHTMLTag_meta,
|
||||
eHTMLTag_newline, eHTMLTag_param, eHTMLTag_plaintext,
|
||||
eHTMLTag_style, eHTMLTag_spacer, eHTMLTag_text,
|
||||
eHTMLTag_unknown, eHTMLTag_wbr, eHTMLTag_whitespace,
|
||||
eHTMLTag_xmp};
|
||||
|
||||
|
||||
result=!FindTagInSet(aChild,gNonContainers,sizeof(gNonContainers)/sizeof(eHTMLTag_unknown));
|
||||
result=!gHTMLElements[aChild].HasSpecialProperty(kNonContainer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ static const int kNoStyleLeaksIn = 0x0040;
|
|||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kNonContainer = 0x0400; //If set, then this tag is not a container.
|
||||
|
||||
//*********************************************************************************************
|
||||
// The following ints define the standard groups of HTML elements...
|
||||
|
|
|
@ -729,7 +729,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
if(kMinus==aChar) {
|
||||
//in this case, we're reading a long-form comment <-- xxx -->
|
||||
aString+=aChar;
|
||||
result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---'
|
||||
//result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---'
|
||||
if(NS_OK==result) {
|
||||
PRInt32 findpos=-1;
|
||||
nsAutoString temp("");
|
||||
|
|
|
@ -428,7 +428,8 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aCommand,nsStri
|
|||
nsIDTD* theDTD=0;
|
||||
|
||||
while((theDTDIndex<=gSharedObjects.mDTDDeque.GetSize()) && (aParserContext.mAutoDetectStatus!=ePrimaryDetect)){
|
||||
if(theDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(theDTDIndex++)) {
|
||||
theDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(theDTDIndex++);
|
||||
if(theDTD) {
|
||||
aParserContext.mAutoDetectStatus=theDTD->CanParse(aParserContext.mSourceType,aCommand,aBuffer,0);
|
||||
if((eValidDetect==aParserContext.mAutoDetectStatus) || (ePrimaryDetect==aParserContext.mAutoDetectStatus)) {
|
||||
theBestDTD=theDTD;
|
||||
|
@ -469,6 +470,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
const char* theModeStr= PR_GetEnv("PARSE_MODE");
|
||||
const char* other="other";
|
||||
|
||||
eParseMode result=eParseMode_unknown;
|
||||
nsScanner* theScanner=aParser.GetScanner();
|
||||
if(theScanner){
|
||||
nsAutoString theBufCopy;
|
||||
|
@ -487,47 +489,48 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
if(kNotFound<(theSubIndex=theBufCopy.Find("HTML4.0",PR_TRUE,theSubIndex+11))) {
|
||||
PRUnichar num=theBufCopy.CharAt(theSubIndex+7);
|
||||
if(num > '0' && num < '9') {
|
||||
if(theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)
|
||||
return eParseMode_noquirks; // XXX - investigate this more.
|
||||
result=eParseMode_noquirks; // XXX - investigate this more.
|
||||
}
|
||||
if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)||
|
||||
else if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)||
|
||||
(theBufCopy.Find("FRAMESET",PR_TRUE,theSubIndex+7)>kNotFound) ||
|
||||
(theBufCopy.Find("LATIN1", PR_TRUE,theSubIndex+7) >kNotFound) ||
|
||||
(theBufCopy.Find("SYMBOLS",PR_TRUE,theSubIndex+7) >kNotFound) ||
|
||||
(theBufCopy.Find("SPECIAL",PR_TRUE,theSubIndex+7) >kNotFound))
|
||||
return eParseMode_quirks; // XXX -HACK- Set the appropriate mode.
|
||||
result=eParseMode_quirks; // XXX -HACK- Set the appropriate mode.
|
||||
else
|
||||
return eParseMode_noquirks;
|
||||
}else
|
||||
if(kNotFound<(theSubIndex=theBufCopy.Find("XHTML",PR_TRUE,theSubIndex+11))) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
else if(kNotFound<(theSubIndex=theBufCopy.Find("XHTML",PR_TRUE,theSubIndex+11))) {
|
||||
if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex)>kNotFound)||
|
||||
(theBufCopy.Find("STRICT",PR_TRUE,theSubIndex) >kNotFound) ||
|
||||
(theBufCopy.Find("FRAMESET",PR_TRUE,theSubIndex) >kNotFound))
|
||||
return eParseMode_noquirks;
|
||||
result=eParseMode_noquirks;
|
||||
else
|
||||
return eParseMode_quirks;
|
||||
result=eParseMode_quirks;
|
||||
}
|
||||
}else
|
||||
if(kNotFound<(theSubIndex=theBufCopy.Find("ISO/IEC15445:1999",PR_TRUE,theIndex+8))) {
|
||||
}
|
||||
else if(kNotFound<(theSubIndex=theBufCopy.Find("ISO/IEC15445:1999",PR_TRUE,theIndex+8))) {
|
||||
theSubIndex=theBufCopy.Find("HTML",PR_TRUE,theSubIndex+18);
|
||||
if(kNotFound==theSubIndex)
|
||||
theSubIndex=theBufCopy.Find("HYPERTEXTMARKUPLANGUAGE",PR_TRUE,theSubIndex+18);
|
||||
return eParseMode_noquirks;
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
}
|
||||
else if(kNotFound<(theIndex=theBufCopy.Find("?XML",PR_TRUE))) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
else {
|
||||
theIndex=theBufCopy.Find("NOQUIRKS",PR_TRUE);
|
||||
if(kNotFound<theIndex) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
}else
|
||||
if(kNotFound<(theIndex=theBufCopy.Find("?XML",PR_TRUE)))
|
||||
return eParseMode_noquirks;
|
||||
|
||||
theIndex=theBufCopy.Find("NOQUIRKS",PR_TRUE);
|
||||
if(kNotFound<theIndex) {
|
||||
return eParseMode_noquirks;
|
||||
}
|
||||
}
|
||||
|
||||
if(theModeStr)
|
||||
if(0==nsCRT::strcasecmp(other,theModeStr))
|
||||
return eParseMode_other;
|
||||
return eParseMode_quirks;
|
||||
return (eParseMode_unknown==result)? eParseMode_quirks:result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1176,10 +1176,10 @@ nsresult CNavDTD::HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags
|
|||
if(attrCount > 0) {
|
||||
nsCParserNode* theAttrNode = (nsCParserNode*)&aNode;
|
||||
while(attrCount > 0){
|
||||
CToken* theToken=theAttrNode->PopAttributeToken();
|
||||
if(theToken){
|
||||
mMisplacedContent.Push(theToken);
|
||||
theToken->mRecycle=PR_FALSE;
|
||||
CToken* theAttrToken=theAttrNode->PopAttributeToken();
|
||||
if(theAttrToken){
|
||||
mMisplacedContent.Push(theAttrToken);
|
||||
theAttrToken->mRecycle=PR_FALSE;
|
||||
}
|
||||
attrCount--;
|
||||
}
|
||||
|
@ -1527,6 +1527,8 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
|
|||
RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
|
||||
STOP_TIMER()
|
||||
// Pause the main context and switch to the new context.
|
||||
eHTMLTags theParentTag=mBodyContext->TagAt(theBadContentIndex);
|
||||
|
||||
mSink->BeginContext(theBadContentIndex);
|
||||
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::HandleSavedTokensAbove(), this=%p\n", this));
|
||||
START_TIMER()
|
||||
|
@ -1553,8 +1555,13 @@ nsresult CNavDTD::HandleSavedTokensAbove(eHTMLTags aTag)
|
|||
mTokenizer->PushTokenFront(theAttrToken);
|
||||
}
|
||||
theBadTokenCount--;
|
||||
}
|
||||
result=HandleToken(theToken,mParser);
|
||||
}
|
||||
// Make sure that the BeginContext() is ended only by the call to
|
||||
// EndContext().
|
||||
if(theTag!=theParentTag || eToken_end!=theToken->GetTokenType())
|
||||
result=HandleToken(theToken,mParser);
|
||||
else
|
||||
gRecycler->RecycleToken(theToken);
|
||||
}
|
||||
}
|
||||
theBadTokenCount--;
|
||||
|
@ -2859,6 +2866,7 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
|
|||
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
PRBool done=PR_FALSE;
|
||||
eHTMLTags thePrevTag=theTag;
|
||||
nsCParserNode* theNode=CreateNode();
|
||||
CTokenRecycler* theRecycler=(CTokenRecycler*)mTokenizer->GetTokenRecycler();
|
||||
while(!done && NS_SUCCEEDED(result)) {
|
||||
|
@ -2884,13 +2892,15 @@ nsresult CNavDTD::AddLeaf(const nsIParserNode& aNode){
|
|||
}
|
||||
else delete theToken;
|
||||
}
|
||||
|
||||
|
||||
RAPTOR_STOPWATCH_DEBUGTRACE(("Start: Parse Time: CNavDTD::AddLeaf(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
thePrevTag=theTag;
|
||||
}
|
||||
break;
|
||||
case eHTMLTag_text:
|
||||
if(mHasOpenBody && (!mHasOpenHead)) {
|
||||
if((mHasOpenBody) && (!mHasOpenHead) &&
|
||||
!(nsHTMLElement::IsWhitespaceTag(thePrevTag))) {
|
||||
theToken=mTokenizer->PopToken();
|
||||
theNode->Init(theToken,mLineNumber);
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kOmitWS, 10,
|
||||
/*special props, prop-range*/ kOmitWS|kNonContainer, 10,
|
||||
/*special parents,kids,skip*/ 0,&gUnknownKids,eHTMLTag_unknown);
|
||||
|
||||
/*************************************************
|
||||
|
@ -307,7 +307,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gAreaParent,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kInlineEntity, kSelf,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gAreaParent,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -325,7 +325,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -334,7 +334,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, SPECIALTYPE, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -397,7 +397,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -451,7 +451,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gColParents,&gColParents,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoPropagate|kOmitWS,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNoPropagate|kOmitWS|kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gColParents,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -541,7 +541,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kBlockEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,&gContainsParam,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -586,7 +586,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInFrameset,&gInFrameset,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn, kNoPropRange,
|
||||
/*special props, prop-range*/ kNoPropagate|kNoStyleLeaksIn|kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInFrameset,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -668,7 +668,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ &gHRAutoClose,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kBlock, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -713,7 +713,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -722,7 +722,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kSpecial, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -731,7 +731,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFormControl, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -749,7 +749,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ (kBlock|kHeadContent), kFlowEntity, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInBody,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -767,7 +767,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -812,7 +812,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead,&gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -848,7 +848,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kNone, kNone,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn, kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn|kNonContainer, kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -956,7 +956,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gParamParents, &gParamParents,
|
||||
/*autoclose starttags and endtags*/ &gPAutoClose,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kNone, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gParamParents,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -974,7 +974,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kFlowEntity, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_html);
|
||||
|
||||
Initialize(
|
||||
|
@ -1075,7 +1075,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1115,7 +1115,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInHead, &gInHead,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kHeadMisc, kPCDATA, kNone,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn, kNoPropRange,
|
||||
/*special props, prop-range*/ kNoStyleLeaksIn|kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ &gInHead,0,eHTMLTag_style);
|
||||
|
||||
Initialize(
|
||||
|
@ -1260,7 +1260,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kExtensions, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1269,7 +1269,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kPreformatted, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kDefaultPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kDefaultPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_xmp);
|
||||
|
||||
Initialize(
|
||||
|
@ -1278,7 +1278,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1287,7 +1287,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0,kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer,kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1296,7 +1296,7 @@ void InitializeElementTable(void) {
|
|||
/*rootnodes,endrootnodes*/ &gInBody,&gInBody,
|
||||
/*autoclose starttags and endtags*/ 0,0,0,0,
|
||||
/*parent,incl,exclgroups*/ kFlowEntity, kNone, kNone,
|
||||
/*special props, prop-range*/ 0, kNoPropRange,
|
||||
/*special props, prop-range*/ kNonContainer, kNoPropRange,
|
||||
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
|
||||
|
||||
Initialize(
|
||||
|
@ -1382,20 +1382,7 @@ PRBool nsHTMLElement::IsContainer(eHTMLTags aChild) {
|
|||
PRBool result=(eHTMLTag_unknown==aChild);
|
||||
|
||||
if(!result){
|
||||
static eHTMLTags gNonContainers[]={
|
||||
eHTMLTag_unknown,
|
||||
eHTMLTag_area, eHTMLTag_base, eHTMLTag_basefont,
|
||||
eHTMLTag_br, eHTMLTag_col, eHTMLTag_embed,
|
||||
eHTMLTag_frame, eHTMLTag_hr, eHTMLTag_img,
|
||||
eHTMLTag_image, eHTMLTag_input, eHTMLTag_keygen,
|
||||
eHTMLTag_link, eHTMLTag_isindex, eHTMLTag_meta,
|
||||
eHTMLTag_newline, eHTMLTag_param, eHTMLTag_plaintext,
|
||||
eHTMLTag_style, eHTMLTag_spacer, eHTMLTag_text,
|
||||
eHTMLTag_unknown, eHTMLTag_wbr, eHTMLTag_whitespace,
|
||||
eHTMLTag_xmp};
|
||||
|
||||
|
||||
result=!FindTagInSet(aChild,gNonContainers,sizeof(gNonContainers)/sizeof(eHTMLTag_unknown));
|
||||
result=!gHTMLElements[aChild].HasSpecialProperty(kNonContainer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ static const int kNoStyleLeaksIn = 0x0040;
|
|||
static const int kNoStyleLeaksOut = 0x0080;
|
||||
static const int kMustCloseSelf = 0x0100;
|
||||
static const int kSaveMisplaced = 0x0200; //If set, then children this tag can't contain are pushed onto the misplaced stack
|
||||
static const int kNonContainer = 0x0400; //If set, then this tag is not a container.
|
||||
|
||||
//*********************************************************************************************
|
||||
// The following ints define the standard groups of HTML elements...
|
||||
|
|
|
@ -729,7 +729,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
if(kMinus==aChar) {
|
||||
//in this case, we're reading a long-form comment <-- xxx -->
|
||||
aString+=aChar;
|
||||
result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---'
|
||||
//result=aScanner.ReadWhile(aString,gMinus,PR_TRUE,PR_FALSE); //get all available '---'
|
||||
if(NS_OK==result) {
|
||||
PRInt32 findpos=-1;
|
||||
nsAutoString temp("");
|
||||
|
|
|
@ -428,7 +428,8 @@ PRBool FindSuitableDTD( CParserContext& aParserContext,nsString& aCommand,nsStri
|
|||
nsIDTD* theDTD=0;
|
||||
|
||||
while((theDTDIndex<=gSharedObjects.mDTDDeque.GetSize()) && (aParserContext.mAutoDetectStatus!=ePrimaryDetect)){
|
||||
if(theDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(theDTDIndex++)) {
|
||||
theDTD=(nsIDTD*)gSharedObjects.mDTDDeque.ObjectAt(theDTDIndex++);
|
||||
if(theDTD) {
|
||||
aParserContext.mAutoDetectStatus=theDTD->CanParse(aParserContext.mSourceType,aCommand,aBuffer,0);
|
||||
if((eValidDetect==aParserContext.mAutoDetectStatus) || (ePrimaryDetect==aParserContext.mAutoDetectStatus)) {
|
||||
theBestDTD=theDTD;
|
||||
|
@ -469,6 +470,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
const char* theModeStr= PR_GetEnv("PARSE_MODE");
|
||||
const char* other="other";
|
||||
|
||||
eParseMode result=eParseMode_unknown;
|
||||
nsScanner* theScanner=aParser.GetScanner();
|
||||
if(theScanner){
|
||||
nsAutoString theBufCopy;
|
||||
|
@ -487,47 +489,48 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
if(kNotFound<(theSubIndex=theBufCopy.Find("HTML4.0",PR_TRUE,theSubIndex+11))) {
|
||||
PRUnichar num=theBufCopy.CharAt(theSubIndex+7);
|
||||
if(num > '0' && num < '9') {
|
||||
if(theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)
|
||||
return eParseMode_noquirks; // XXX - investigate this more.
|
||||
result=eParseMode_noquirks; // XXX - investigate this more.
|
||||
}
|
||||
if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)||
|
||||
else if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex+7)>kNotFound)||
|
||||
(theBufCopy.Find("FRAMESET",PR_TRUE,theSubIndex+7)>kNotFound) ||
|
||||
(theBufCopy.Find("LATIN1", PR_TRUE,theSubIndex+7) >kNotFound) ||
|
||||
(theBufCopy.Find("SYMBOLS",PR_TRUE,theSubIndex+7) >kNotFound) ||
|
||||
(theBufCopy.Find("SPECIAL",PR_TRUE,theSubIndex+7) >kNotFound))
|
||||
return eParseMode_quirks; // XXX -HACK- Set the appropriate mode.
|
||||
result=eParseMode_quirks; // XXX -HACK- Set the appropriate mode.
|
||||
else
|
||||
return eParseMode_noquirks;
|
||||
}else
|
||||
if(kNotFound<(theSubIndex=theBufCopy.Find("XHTML",PR_TRUE,theSubIndex+11))) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
else if(kNotFound<(theSubIndex=theBufCopy.Find("XHTML",PR_TRUE,theSubIndex+11))) {
|
||||
if((theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex)>kNotFound)||
|
||||
(theBufCopy.Find("STRICT",PR_TRUE,theSubIndex) >kNotFound) ||
|
||||
(theBufCopy.Find("FRAMESET",PR_TRUE,theSubIndex) >kNotFound))
|
||||
return eParseMode_noquirks;
|
||||
result=eParseMode_noquirks;
|
||||
else
|
||||
return eParseMode_quirks;
|
||||
result=eParseMode_quirks;
|
||||
}
|
||||
}else
|
||||
if(kNotFound<(theSubIndex=theBufCopy.Find("ISO/IEC15445:1999",PR_TRUE,theIndex+8))) {
|
||||
}
|
||||
else if(kNotFound<(theSubIndex=theBufCopy.Find("ISO/IEC15445:1999",PR_TRUE,theIndex+8))) {
|
||||
theSubIndex=theBufCopy.Find("HTML",PR_TRUE,theSubIndex+18);
|
||||
if(kNotFound==theSubIndex)
|
||||
theSubIndex=theBufCopy.Find("HYPERTEXTMARKUPLANGUAGE",PR_TRUE,theSubIndex+18);
|
||||
return eParseMode_noquirks;
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
}
|
||||
else if(kNotFound<(theIndex=theBufCopy.Find("?XML",PR_TRUE))) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
else {
|
||||
theIndex=theBufCopy.Find("NOQUIRKS",PR_TRUE);
|
||||
if(kNotFound<theIndex) {
|
||||
result=eParseMode_noquirks;
|
||||
}
|
||||
}else
|
||||
if(kNotFound<(theIndex=theBufCopy.Find("?XML",PR_TRUE)))
|
||||
return eParseMode_noquirks;
|
||||
|
||||
theIndex=theBufCopy.Find("NOQUIRKS",PR_TRUE);
|
||||
if(kNotFound<theIndex) {
|
||||
return eParseMode_noquirks;
|
||||
}
|
||||
}
|
||||
|
||||
if(theModeStr)
|
||||
if(0==nsCRT::strcasecmp(other,theModeStr))
|
||||
return eParseMode_other;
|
||||
return eParseMode_quirks;
|
||||
return (eParseMode_unknown==result)? eParseMode_quirks:result;
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче