Adding support for DOCTYPE.

Also, fix for bug 13566.
This commit is contained in:
harishd@netscape.com
1999-09-15 17:54:23 +00:00
parent 79899c289a
commit 52cc26003f
26 changed files with 346 additions and 56 deletions
+14 -8
View File
@@ -444,23 +444,29 @@ eParseMode DetermineParseMode(nsParser& aParser) {
nsAutoString theBufCopy;
nsString& theBuffer=theScanner->GetBuffer();
theBuffer.Left(theBufCopy,125);
theBufCopy.ToUpperCase();
PRInt32 theIndex=theBufCopy.Find("<!DOCTYPE");
if(kNotFound==theIndex){
theIndex=theBufCopy.Find("<DOCTYPE");
}
PRInt32 theIndex=theBufCopy.Find("<!");
if(theIndex!=kNotFound)
theIndex=theBufCopy.Find("DOCTYPE",PR_TRUE,2);
if(kNotFound<theIndex) {
//good, we found "DOCTYPE" -- now go find it's end delimiter '>'
PRInt32 theSubIndex=theBufCopy.FindChar(kGreaterThan,theIndex+1);
theBufCopy.Truncate(theSubIndex);
theSubIndex=theBufCopy.Find("HTML 4.0");
theSubIndex=theBufCopy.Find("HTML 4.0",PR_TRUE,theIndex+8);
if(kNotFound<theSubIndex) {
return eParseMode_raptor;
if(theBufCopy.Find("TRANSITIONAL",PR_TRUE,theSubIndex)>kNotFound)
return eParseMode_navigator;
else if((theBufCopy.Find("FRAMESET",PR_TRUE,theSubIndex)>kNotFound) ||
(theBufCopy.Find("LATIN1", PR_TRUE,theSubIndex) >kNotFound) ||
(theBufCopy.Find("SYMBOLS",PR_TRUE,theSubIndex) >kNotFound) ||
(theBufCopy.Find("SPECIAL",PR_TRUE,theSubIndex) >kNotFound))
return eParseMode_navigator; // XXX -HACK- Set the appropriate mode.
else
return eParseMode_noquirks;
}
}
theIndex=theBufCopy.Find("NOQUIRKS");
theIndex=theBufCopy.Find("NOQUIRKS",PR_TRUE);
if(kNotFound<theIndex) {
return eParseMode_noquirks;
}