Split strict mode into almost-standards and full-standards mode, where the only quirk in almost standards mode is the quirky inline box model. Pull in parts from previous fix for bug 141261. Tweak mode detection to use almost-standards for XHTML Transitional, HTML 4.01 transitional with system ID, and for IBM system DOCTYPE. b=153032 r=karnaze, bzbarsky, harishd sr=waterson a=valeski, adt

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_0_BRANCH@124266 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu
2002-06-28 06:20:50 +00:00
parent d3e6e4734a
commit f21b437b1c
70 changed files with 557 additions and 539 deletions

View File

@@ -250,7 +250,7 @@ public:
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
NS_IMETHOD WillProcessTokens(void);
NS_IMETHOD DidProcessTokens(void);
NS_IMETHOD WillProcessAToken(void);
@@ -2650,7 +2650,22 @@ HTMLContentSink::WillBuildModel(void)
mScrolledToRefAlready = PR_FALSE;
if (mHTMLDocument) {
mHTMLDocument->SetDTDMode(mParser? mParser->GetParseMode():eDTDMode_quirks);
nsCompatibility mode = eCompatibility_NavQuirks;
if (mParser) {
nsDTDMode dtdMode = mParser->GetParseMode();
switch (dtdMode) {
case eDTDMode_full_standards:
mode = eCompatibility_FullStandards;
break;
case eDTDMode_almost_standards:
mode = eCompatibility_AlmostStandards;
break;
default:
mode = eCompatibility_NavQuirks;
break;
}
}
mHTMLDocument->SetCompatibilityMode(mode);
}
// Notify document that the load is beginning
@@ -3522,14 +3537,12 @@ nsresult HTMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode) {
*/
NS_IMETHODIMP
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
{
nsresult rv = NS_OK;
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
MOZ_TIMER_START(mWatch);
mHTMLDocument->SetDTDMode((nsDTDMode)aMode);
nsCOMPtr<nsIDOMDocument> doc(do_QueryInterface(mHTMLDocument));
if (!doc)
@@ -4452,11 +4465,11 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
nsAutoString params;
nsParserUtils::SplitMimeType(aType, mimeType, params);
nsDTDMode mode;
mHTMLDocument->GetDTDMode(mode);
nsCompatibility mode;
mHTMLDocument->GetCompatibilityMode(mode);
PRBool isStyleSheet = PR_FALSE; // see bug 18817
if (eDTDMode_strict== mode) {
if (eCompatibility_NavQuirks != mode) {
if (mimeType.EqualsIgnoreCase("text/css")) {
isStyleSheet = PR_TRUE; // strict mode + good mime type
}