Split strict mode into almost-standards and full-standards mode, where the only quirk in almost standards mode is the quirky inline box model. Remove previous fix for bug 151620. 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
git-svn-id: svn://10.0.0.236/trunk@124017 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -300,7 +300,7 @@ nsHTMLDocument::nsHTMLDocument()
|
||||
mAnchors = nsnull;
|
||||
mLayers = nsnull;
|
||||
mParser = nsnull;
|
||||
mDTDMode = eDTDMode_quirks;
|
||||
mCompatMode = eCompatibility_NavQuirks;
|
||||
mCSSLoader = nsnull;
|
||||
|
||||
mForms = nsnull;
|
||||
@@ -495,7 +495,7 @@ nsHTMLDocument::CreateShell(nsIPresContext* aContext,
|
||||
nsIPresShell** aInstancePtrResult)
|
||||
{
|
||||
return doCreateShell(aContext, aViewManager, aStyleSet,
|
||||
eDTDMode_strict != mDTDMode, aInstancePtrResult);
|
||||
mCompatMode, aInstancePtrResult);
|
||||
}
|
||||
|
||||
// The following Try*Charset will return PR_FALSE only if the charset source
|
||||
@@ -1332,7 +1332,7 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
}
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetCaseSensitive(PR_FALSE);
|
||||
mCSSLoader->SetQuirkMode(PRBool(eDTDMode_strict!= mDTDMode));
|
||||
mCSSLoader->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
NS_IF_ADDREF(aLoader);
|
||||
@@ -1341,27 +1341,25 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetDTDMode(nsDTDMode& aMode)
|
||||
nsHTMLDocument::GetCompatibilityMode(nsCompatibility& aMode)
|
||||
{
|
||||
aMode = mDTDMode;
|
||||
aMode = mCompatMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetDTDMode(nsDTDMode aMode)
|
||||
nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
|
||||
{
|
||||
mDTDMode = aMode;
|
||||
mCompatMode = aMode;
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetQuirkMode(PRBool(eDTDMode_strict!= mDTDMode));
|
||||
mCSSLoader->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell = (nsIPresShell*)mPresShells.SafeElementAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> pc;
|
||||
shell->GetPresContext(getter_AddRefs(pc));
|
||||
if (pc) {
|
||||
pc->SetCompatibilityMode(((eDTDMode_strict== mDTDMode) ?
|
||||
eCompatibility_Standard :
|
||||
eCompatibility_NavQuirks));
|
||||
pc->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3328,17 +3326,19 @@ nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
|
||||
}
|
||||
|
||||
// readonly attribute DOMString compatMode;
|
||||
// Returns "BackCompat" if we are in quirks mode,
|
||||
// "CSS1Compat" if we are in strict mode. See bug 105640.
|
||||
// This was implemented to match MSIE's compatMode property
|
||||
// Returns "BackCompat" if we are in quirks mode, "CSS1Compat" if we are
|
||||
// in almost standards or full standards mode. See bug 105640. This was
|
||||
// implemented to match MSIE's compatMode property
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetCompatMode(nsAString& aCompatMode)
|
||||
{
|
||||
aCompatMode.Truncate();
|
||||
NS_ASSERTION((mDTDMode == eDTDMode_quirks) || (mDTDMode == eDTDMode_strict),
|
||||
"mDTDMode is neither quirks nor strict for this document");
|
||||
NS_ASSERTION(mCompatMode == eCompatibility_NavQuirks ||
|
||||
mCompatMode == eCompatibility_AlmostStandards ||
|
||||
mCompatMode == eCompatibility_FullStandards,
|
||||
"mCompatMode is neither quirks nor strict for this document");
|
||||
|
||||
if (mDTDMode == eDTDMode_quirks) {
|
||||
if (mCompatMode == eCompatibility_NavQuirks) {
|
||||
aCompatMode.Assign(NS_LITERAL_STRING("BackCompat"));
|
||||
} else {
|
||||
aCompatMode.Assign(NS_LITERAL_STRING("CSS1Compat"));
|
||||
|
||||
Reference in New Issue
Block a user