diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index a050eef008d9..d1ec6ecdbc81 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -137,7 +137,7 @@ nsHTMLDocument::nsHTMLDocument() mNamedItems = nsnull; mParser = nsnull; nsHTMLAtoms::AddrefAtoms(); - mDTDMode = eDTDMode_NoQuirks; + mDTDMode = eDTDMode_Nav; mCSSLoader = nsnull; // Find/Search Init @@ -299,6 +299,25 @@ nsHTMLDocument::GetContentType(nsString& aContentType) const return NS_OK; } +NS_IMETHODIMP +nsHTMLDocument::CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult) +{ + nsresult result = nsMarkupDocument::CreateShell(aContext, + aViewManager, + aStyleSet, + aInstancePtrResult); + + if (NS_SUCCEEDED(result)) { + aContext->SetCompatibilityMode(((eDTDMode_NoQuirks == mDTDMode) ? + eCompatibility_Standard : + eCompatibility_NavQuirks)); + } + return result; +} + NS_IMETHODIMP nsHTMLDocument::StartDocumentLoad(nsIURI *aURL, nsIContentViewerContainer* aContainer, @@ -631,6 +650,10 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader) if (! mCSSLoader) { result = NS_NewCSSLoader(this, &mCSSLoader); } + if (mCSSLoader) { + mCSSLoader->SetCaseSensitive(PR_FALSE); + mCSSLoader->SetQuirkMode(PRBool(eDTDMode_NoQuirks != mDTDMode)); + } aLoader = mCSSLoader; NS_IF_ADDREF(aLoader); return result; @@ -648,6 +671,9 @@ NS_IMETHODIMP nsHTMLDocument::SetDTDMode(nsDTDMode aMode) { mDTDMode = aMode; + if (mCSSLoader) { + mCSSLoader->SetQuirkMode(PRBool(eDTDMode_NoQuirks != mDTDMode)); + } return NS_OK; } diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index d71964725cb0..a3aaa4eff2b9 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -54,6 +54,11 @@ public: NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult); + NS_IMETHOD StartDocumentLoad(nsIURI* aUrl, nsIContentViewerContainer* aContainer, nsIStreamListener** aDocListener, diff --git a/layout/html/document/src/nsHTMLDocument.cpp b/layout/html/document/src/nsHTMLDocument.cpp index a050eef008d9..d1ec6ecdbc81 100644 --- a/layout/html/document/src/nsHTMLDocument.cpp +++ b/layout/html/document/src/nsHTMLDocument.cpp @@ -137,7 +137,7 @@ nsHTMLDocument::nsHTMLDocument() mNamedItems = nsnull; mParser = nsnull; nsHTMLAtoms::AddrefAtoms(); - mDTDMode = eDTDMode_NoQuirks; + mDTDMode = eDTDMode_Nav; mCSSLoader = nsnull; // Find/Search Init @@ -299,6 +299,25 @@ nsHTMLDocument::GetContentType(nsString& aContentType) const return NS_OK; } +NS_IMETHODIMP +nsHTMLDocument::CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult) +{ + nsresult result = nsMarkupDocument::CreateShell(aContext, + aViewManager, + aStyleSet, + aInstancePtrResult); + + if (NS_SUCCEEDED(result)) { + aContext->SetCompatibilityMode(((eDTDMode_NoQuirks == mDTDMode) ? + eCompatibility_Standard : + eCompatibility_NavQuirks)); + } + return result; +} + NS_IMETHODIMP nsHTMLDocument::StartDocumentLoad(nsIURI *aURL, nsIContentViewerContainer* aContainer, @@ -631,6 +650,10 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader) if (! mCSSLoader) { result = NS_NewCSSLoader(this, &mCSSLoader); } + if (mCSSLoader) { + mCSSLoader->SetCaseSensitive(PR_FALSE); + mCSSLoader->SetQuirkMode(PRBool(eDTDMode_NoQuirks != mDTDMode)); + } aLoader = mCSSLoader; NS_IF_ADDREF(aLoader); return result; @@ -648,6 +671,9 @@ NS_IMETHODIMP nsHTMLDocument::SetDTDMode(nsDTDMode aMode) { mDTDMode = aMode; + if (mCSSLoader) { + mCSSLoader->SetQuirkMode(PRBool(eDTDMode_NoQuirks != mDTDMode)); + } return NS_OK; } diff --git a/layout/html/document/src/nsHTMLDocument.h b/layout/html/document/src/nsHTMLDocument.h index d71964725cb0..a3aaa4eff2b9 100644 --- a/layout/html/document/src/nsHTMLDocument.h +++ b/layout/html/document/src/nsHTMLDocument.h @@ -54,6 +54,11 @@ public: NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD CreateShell(nsIPresContext* aContext, + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult); + NS_IMETHOD StartDocumentLoad(nsIURI* aUrl, nsIContentViewerContainer* aContainer, nsIStreamListener** aDocListener,