зеркало из https://github.com/mozilla/gecko-dev.git
Bug 212504. Removal of the default namespace arguments from CSSStyleSheet and CSSLoader.
r=bzbarsky@mit.edu, sr=dbaron@dbaron.org
This commit is contained in:
Родитель
9ed679232e
Коммит
7495519180
|
@ -33,7 +33,6 @@
|
||||||
#include "nsIDOMStyleSheet.h"
|
#include "nsIDOMStyleSheet.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
#include "nsIHTMLContentContainer.h"
|
#include "nsIHTMLContentContainer.h"
|
||||||
#include "nsINameSpaceManager.h"
|
|
||||||
#include "nsIUnicharInputStream.h"
|
#include "nsIUnicharInputStream.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
|
@ -310,13 +309,11 @@ nsStyleLinkElement::UpdateStyleSheet(nsIDocument *aOldDocument,
|
||||||
// Now that we have a url and a unicode input stream, parse the
|
// Now that we have a url and a unicode input stream, parse the
|
||||||
// style sheet.
|
// style sheet.
|
||||||
rv = loader->LoadInlineStyle(thisContent, uin, title, media,
|
rv = loader->LoadInlineStyle(thisContent, uin, title, media,
|
||||||
kNameSpaceID_Unknown,
|
|
||||||
((blockParser) ? parser.get() : nsnull),
|
((blockParser) ? parser.get() : nsnull),
|
||||||
doneLoading, aObserver);
|
doneLoading, aObserver);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rv = loader->LoadStyleLink(thisContent, uri, title, media,
|
rv = loader->LoadStyleLink(thisContent, uri, title, media,
|
||||||
kNameSpaceID_Unknown,
|
|
||||||
((blockParser) ? parser.get() : nsnull),
|
((blockParser) ? parser.get() : nsnull),
|
||||||
doneLoading, aObserver);
|
doneLoading, aObserver);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4876,7 +4876,6 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
|
||||||
|
|
||||||
PRBool doneLoading;
|
PRBool doneLoading;
|
||||||
result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia,
|
result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia,
|
||||||
kNameSpaceID_Unknown,
|
|
||||||
((blockParser) ? mParser : nsnull),
|
((blockParser) ? mParser : nsnull),
|
||||||
doneLoading,
|
doneLoading,
|
||||||
this);
|
this);
|
||||||
|
|
|
@ -87,7 +87,6 @@ public:
|
||||||
nsIUnicharInputStream* aStream,
|
nsIUnicharInputStream* aStream,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver) = 0;
|
nsICSSLoaderObserver* aObserver) = 0;
|
||||||
|
@ -101,7 +100,6 @@ public:
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver) = 0;
|
nsICSSLoaderObserver* aObserver) = 0;
|
||||||
|
@ -110,7 +108,6 @@ public:
|
||||||
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aRule) = 0;
|
nsICSSImportRule* aRule) = 0;
|
||||||
|
|
||||||
// Load a user agent or user sheet. The sheet is loaded
|
// Load a user agent or user sheet. The sheet is loaded
|
||||||
|
|
|
@ -87,8 +87,6 @@ public:
|
||||||
|
|
||||||
// get head of namespace chain for sheet
|
// get head of namespace chain for sheet
|
||||||
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
||||||
// set default namespace for sheet (may be overridden by @namespace)
|
|
||||||
NS_IMETHOD SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID) = 0;
|
|
||||||
|
|
||||||
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
||||||
nsICSSImportRule* aCloneOwnerRule,
|
nsICSSImportRule* aCloneOwnerRule,
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsINameSpaceManager.h"
|
|
||||||
#include "nsIUnicharInputStream.h"
|
#include "nsIUnicharInputStream.h"
|
||||||
#include "nsIConverterInputStream.h"
|
#include "nsIConverterInputStream.h"
|
||||||
#include "nsICharsetAlias.h"
|
#include "nsICharsetAlias.h"
|
||||||
|
@ -958,7 +957,6 @@ CSSLoaderImpl::CheckLoadAllowed(nsIURI* aSourceURI,
|
||||||
nsresult
|
nsresult
|
||||||
CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
||||||
nsIContent* aLinkingContent,
|
nsIContent* aLinkingContent,
|
||||||
PRUint32 aDefaultNameSpaceID,
|
|
||||||
PRBool aSyncLoad,
|
PRBool aSyncLoad,
|
||||||
StyleSheetState& aSheetState,
|
StyleSheetState& aSheetState,
|
||||||
nsICSSStyleSheet** aSheet)
|
nsICSSStyleSheet** aSheet)
|
||||||
|
@ -1039,8 +1037,6 @@ CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
||||||
rv = NS_NewCSSStyleSheet(aSheet); // Don't init the sheet here, but in
|
rv = NS_NewCSSStyleSheet(aSheet); // Don't init the sheet here, but in
|
||||||
// ParseSheet once we know the final URI
|
// ParseSheet once we know the final URI
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
(*aSheet)->SetDefaultNameSpaceID(aDefaultNameSpaceID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(*aSheet, "We should have a sheet by now!");
|
NS_ASSERTION(*aSheet, "We should have a sheet by now!");
|
||||||
|
@ -1563,7 +1559,6 @@ CSSLoaderImpl::LoadInlineStyle(nsIContent* aElement,
|
||||||
nsIUnicharInputStream* aStream,
|
nsIUnicharInputStream* aStream,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver)
|
nsICSSLoaderObserver* aObserver)
|
||||||
|
@ -1586,8 +1581,8 @@ CSSLoaderImpl::LoadInlineStyle(nsIContent* aElement,
|
||||||
|
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
nsresult rv = CreateSheet(nsnull, aElement, aDefaultNameSpaceID, PR_FALSE,
|
nsresult rv = CreateSheet(nsnull, aElement, PR_FALSE, state,
|
||||||
state, getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_ASSERTION(state == eSheetNeedsParser,
|
NS_ASSERTION(state == eSheetNeedsParser,
|
||||||
"Inline sheets should not be cached");
|
"Inline sheets should not be cached");
|
||||||
|
@ -1620,7 +1615,6 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver)
|
nsICSSLoaderObserver* aObserver)
|
||||||
|
@ -1651,7 +1645,7 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement,
|
||||||
|
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
rv = CreateSheet(aURL, aElement, aDefaultNameSpaceID, PR_FALSE, state,
|
rv = CreateSheet(aURL, aElement, PR_FALSE, state,
|
||||||
getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -1705,7 +1699,6 @@ NS_IMETHODIMP
|
||||||
CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aParentRule)
|
nsICSSImportRule* aParentRule)
|
||||||
{
|
{
|
||||||
LOG(("CSSLoaderImpl::LoadChildSheet"));
|
LOG(("CSSLoaderImpl::LoadChildSheet"));
|
||||||
|
@ -1761,7 +1754,7 @@ CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
// loop) do so
|
// loop) do so
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
rv = CreateSheet(aURL, nsnull, aDefaultNameSpaceID,
|
rv = CreateSheet(aURL, nsnull,
|
||||||
parentData ? parentData->mSyncLoad : PR_FALSE,
|
parentData ? parentData->mSyncLoad : PR_FALSE,
|
||||||
state, getter_AddRefs(sheet));
|
state, getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1833,8 +1826,8 @@ CSSLoaderImpl::InternalLoadAgentSheet(nsIURI* aURL,
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
PRBool syncLoad = (aObserver == nsnull);
|
PRBool syncLoad = (aObserver == nsnull);
|
||||||
|
|
||||||
nsresult rv = CreateSheet(aURL, nsnull, kNameSpaceID_Unknown, syncLoad,
|
nsresult rv = CreateSheet(aURL, nsnull, syncLoad, state,
|
||||||
state, getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
NS_NAMED_LITERAL_STRING(empty, "");
|
NS_NAMED_LITERAL_STRING(empty, "");
|
||||||
|
|
|
@ -260,7 +260,6 @@ public:
|
||||||
nsIUnicharInputStream* aIn,
|
nsIUnicharInputStream* aIn,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver);
|
nsICSSLoaderObserver* aObserver);
|
||||||
|
@ -269,7 +268,6 @@ public:
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver);
|
nsICSSLoaderObserver* aObserver);
|
||||||
|
@ -277,7 +275,6 @@ public:
|
||||||
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aRule);
|
nsICSSImportRule* aRule);
|
||||||
|
|
||||||
NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSStyleSheet** aSheet);
|
NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSStyleSheet** aSheet);
|
||||||
|
@ -312,7 +309,6 @@ private:
|
||||||
// must be non-null then.
|
// must be non-null then.
|
||||||
nsresult CreateSheet(nsIURI* aURI,
|
nsresult CreateSheet(nsIURI* aURI,
|
||||||
nsIContent* aLinkingContent,
|
nsIContent* aLinkingContent,
|
||||||
PRUint32 aDefaultNameSpaceID,
|
|
||||||
PRBool aSyncLoad,
|
PRBool aSyncLoad,
|
||||||
StyleSheetState& aSheetState,
|
StyleSheetState& aSheetState,
|
||||||
nsICSSStyleSheet** aSheet);
|
nsICSSStyleSheet** aSheet);
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ PRBool CSSParserImpl::ProcessImport(PRInt32& aErrorCode, const nsString& aURLSpe
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mChildLoader->LoadChildSheet(mSheet, url, aMedia, kNameSpaceID_Unknown, rule);
|
mChildLoader->LoadChildSheet(mSheet, url, aMedia, rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
|
@ -783,7 +783,6 @@ public:
|
||||||
nsISupportsArray* mOrderedRules;
|
nsISupportsArray* mOrderedRules;
|
||||||
|
|
||||||
nsCOMPtr<nsINameSpace> mNameSpace;
|
nsCOMPtr<nsINameSpace> mNameSpace;
|
||||||
PRInt32 mDefaultNameSpaceID;
|
|
||||||
PRPackedBool mComplete;
|
PRPackedBool mComplete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -858,7 +857,6 @@ public:
|
||||||
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const;
|
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const;
|
||||||
|
|
||||||
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const;
|
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const;
|
||||||
NS_IMETHOD SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID);
|
|
||||||
|
|
||||||
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
||||||
nsICSSImportRule* aCloneOwnerRule,
|
nsICSSImportRule* aCloneOwnerRule,
|
||||||
|
@ -1465,7 +1463,6 @@ CSSStyleSheetInner::CSSStyleSheetInner(nsICSSStyleSheet* aParentSheet)
|
||||||
: mSheets(),
|
: mSheets(),
|
||||||
mOrderedRules(nsnull),
|
mOrderedRules(nsnull),
|
||||||
mNameSpace(nsnull),
|
mNameSpace(nsnull),
|
||||||
mDefaultNameSpaceID(kNameSpaceID_None),
|
|
||||||
mComplete(PR_FALSE)
|
mComplete(PR_FALSE)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
||||||
|
@ -1491,7 +1488,6 @@ CSSStyleSheetInner::CSSStyleSheetInner(CSSStyleSheetInner& aCopy,
|
||||||
: mSheets(),
|
: mSheets(),
|
||||||
mURL(aCopy.mURL),
|
mURL(aCopy.mURL),
|
||||||
mNameSpace(nsnull),
|
mNameSpace(nsnull),
|
||||||
mDefaultNameSpaceID(aCopy.mDefaultNameSpaceID),
|
|
||||||
mComplete(aCopy.mComplete)
|
mComplete(aCopy.mComplete)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
||||||
|
@ -1586,14 +1582,7 @@ CSSStyleSheetInner::RebuildNameSpaces(void)
|
||||||
{
|
{
|
||||||
nsContentUtils::GetNSManagerWeakRef()->
|
nsContentUtils::GetNSManagerWeakRef()->
|
||||||
CreateRootNameSpace(getter_AddRefs(mNameSpace));
|
CreateRootNameSpace(getter_AddRefs(mNameSpace));
|
||||||
if (kNameSpaceID_Unknown != mDefaultNameSpaceID) {
|
|
||||||
nsCOMPtr<nsINameSpace> defaultNameSpace;
|
|
||||||
mNameSpace->CreateChildNameSpace(nsnull, mDefaultNameSpaceID,
|
|
||||||
getter_AddRefs(defaultNameSpace));
|
|
||||||
if (defaultNameSpace) {
|
|
||||||
mNameSpace = defaultNameSpace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mOrderedRules) {
|
if (mOrderedRules) {
|
||||||
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
||||||
}
|
}
|
||||||
|
@ -2243,17 +2232,6 @@ CSSStyleSheetImpl::GetNameSpace(nsINameSpace*& aNameSpace) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
CSSStyleSheetImpl::SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID)
|
|
||||||
{
|
|
||||||
if (mInner) {
|
|
||||||
mInner->mDefaultNameSpaceID = aDefaultNameSpaceID;
|
|
||||||
mInner->RebuildNameSpaces();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
CSSStyleSheetImpl::StyleSheetCount(PRInt32& aCount) const
|
CSSStyleSheetImpl::StyleSheetCount(PRInt32& aCount) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "nsIHTMLContentContainer.h"
|
#include "nsIHTMLContentContainer.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsXBLAtoms.h"
|
#include "nsXBLAtoms.h"
|
||||||
#include "nsINameSpaceManager.h"
|
|
||||||
#include "nsIFrameManager.h"
|
#include "nsIFrameManager.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "nsXBLPrototypeBinding.h"
|
#include "nsXBLPrototypeBinding.h"
|
||||||
|
@ -146,10 +145,11 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult)
|
||||||
|
|
||||||
// Always load chrome synchronously
|
// Always load chrome synchronously
|
||||||
PRBool chrome;
|
PRBool chrome;
|
||||||
|
nsresult rv;
|
||||||
if (NS_SUCCEEDED(url->SchemeIs("chrome", &chrome)) && chrome)
|
if (NS_SUCCEEDED(url->SchemeIs("chrome", &chrome)) && chrome)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
nsresult rv = cssLoader->LoadAgentSheet(url, getter_AddRefs(sheet));
|
rv = cssLoader->LoadAgentSheet(url, getter_AddRefs(sheet));
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
|
@ -161,8 +161,8 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult)
|
||||||
{
|
{
|
||||||
PRBool doneLoading;
|
PRBool doneLoading;
|
||||||
NS_NAMED_LITERAL_STRING(empty, "");
|
NS_NAMED_LITERAL_STRING(empty, "");
|
||||||
nsresult rv = cssLoader->LoadStyleLink(nsnull, url, empty, empty, kNameSpaceID_Unknown,
|
rv = cssLoader->LoadStyleLink(nsnull, url, empty, empty,
|
||||||
nsnull, doneLoading, this);
|
nsnull, doneLoading, this);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
|
||||||
|
|
||||||
if (!doneLoading)
|
if (!doneLoading)
|
||||||
|
|
|
@ -837,7 +837,7 @@ nsXMLContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||||
return NS_OK; // The URL is bad, move along, don't propagate the error (for now)
|
return NS_OK; // The URL is bad, move along, don't propagate the error (for now)
|
||||||
}
|
}
|
||||||
PRBool doneLoading;
|
PRBool doneLoading;
|
||||||
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
|
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia,
|
||||||
((!aAlternate) ? mParser : nsnull),
|
((!aAlternate) ? mParser : nsnull),
|
||||||
doneLoading,
|
doneLoading,
|
||||||
this);
|
this);
|
||||||
|
|
|
@ -562,7 +562,7 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
|
||||||
return NS_ERROR_FAILURE; // doc went away!
|
return NS_ERROR_FAILURE; // doc went away!
|
||||||
|
|
||||||
PRBool doneLoading;
|
PRBool doneLoading;
|
||||||
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
|
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia,
|
||||||
((blockParser) ? mParser : nsnull),
|
((blockParser) ? mParser : nsnull),
|
||||||
doneLoading, nsnull);
|
doneLoading, nsnull);
|
||||||
if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) {
|
if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) {
|
||||||
|
|
|
@ -1290,7 +1290,7 @@ protected:
|
||||||
|
|
||||||
nsresult GetSelectionForCopy(nsISelection** outSelection);
|
nsresult GetSelectionForCopy(nsISelection** outSelection);
|
||||||
|
|
||||||
nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintaina ref, may be null
|
nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintain a ref, may be null
|
||||||
PRUint32 mUpdateCount;
|
PRUint32 mUpdateCount;
|
||||||
// normal reflow commands
|
// normal reflow commands
|
||||||
nsVoidArray mReflowCommands;
|
nsVoidArray mReflowCommands;
|
||||||
|
@ -2210,7 +2210,7 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
|
||||||
printf("PrefStyleSheet removed\n");
|
printf("PrefStyleSheet removed\n");
|
||||||
#endif
|
#endif
|
||||||
// clear the sheet pointer: it is strictly historical now
|
// clear the sheet pointer: it is strictly historical now
|
||||||
NS_IF_RELEASE(mPrefStyleSheet);
|
NS_RELEASE(mPrefStyleSheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -2218,10 +2218,8 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
|
||||||
|
|
||||||
nsresult PresShell::CreatePreferenceStyleSheet(void)
|
nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mPrefStyleSheet==nsnull, "prefStyleSheet already exists");
|
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
|
||||||
nsresult result = NS_OK;
|
nsresult result = CallCreateInstance(kCSSStyleSheetCID, &mPrefStyleSheet);
|
||||||
|
|
||||||
result = nsComponentManager::CreateInstance(kCSSStyleSheetCID,nsnull,NS_GET_IID(nsICSSStyleSheet),(void**)&mPrefStyleSheet);
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
NS_ASSERTION(mPrefStyleSheet, "null but no error");
|
NS_ASSERTION(mPrefStyleSheet, "null but no error");
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
|
@ -2231,7 +2229,13 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
result = mPrefStyleSheet->Init(uri);
|
result = mPrefStyleSheet->Init(uri);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
mPrefStyleSheet->SetComplete();
|
mPrefStyleSheet->SetComplete();
|
||||||
mPrefStyleSheet->SetDefaultNameSpaceID(kNameSpaceID_XHTML);
|
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet));
|
||||||
|
if (sheet) {
|
||||||
|
PRUint32 index;
|
||||||
|
result = sheet->InsertRule(NS_LITERAL_STRING("@namespace url(http://www.w3.org/1999/xhtml);"),
|
||||||
|
0, &index);
|
||||||
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
}
|
||||||
mStyleSet->InsertUserStyleSheetBefore(mPrefStyleSheet, nsnull);
|
mStyleSet->InsertUserStyleSheetBefore(mPrefStyleSheet, nsnull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,6 +2250,11 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX We want these after the @namespace rule. Does order matter
|
||||||
|
// for these rules, or can we call nsICSSStyleRule::StyleRuleCount()
|
||||||
|
// and just "append"?
|
||||||
|
static PRUint32 sInsertPrefSheetRulesAt = 1;
|
||||||
|
|
||||||
nsresult PresShell::SetPrefColorRules(void)
|
nsresult PresShell::SetPrefColorRules(void)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
||||||
|
@ -2299,13 +2308,13 @@ nsresult PresShell::SetPrefColorRules(void)
|
||||||
NS_LITERAL_STRING("background:") +
|
NS_LITERAL_STRING("background:") +
|
||||||
strBackgroundColor +
|
strBackgroundColor +
|
||||||
NS_LITERAL_STRING(" !important; }"),
|
NS_LITERAL_STRING(" !important; }"),
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - everything else inherits the color, and has transparent background
|
// - everything else inherits the color, and has transparent background
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("* {color: inherit !important; border-color: -moz-use-text-color !important; background: transparent !important;} "),
|
result = sheet->InsertRule(NS_LITERAL_STRING("* {color: inherit !important; border-color: -moz-use-text-color !important; background: transparent !important;} "),
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2331,7 +2340,7 @@ PresShell::SetPrefNoScriptRule()
|
||||||
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet,&rv));
|
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet,&rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRUint32 index = 0;
|
PRUint32 index = 0;
|
||||||
rv = sheet->InsertRule(NS_LITERAL_STRING("noscript{display:block}"), 0, &index);
|
rv = sheet->InsertRule(NS_LITERAL_STRING("noscript{display:block}"), sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2381,35 +2390,35 @@ nsresult PresShell::SetPrefLinkRules(void)
|
||||||
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
|
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - links: '*:link {color: #RRGGBB [!important];}'
|
// - links: '*|*:link {color: #RRGGBB [!important];}'
|
||||||
ColorToString(linkColor,strColor);
|
ColorToString(linkColor,strColor);
|
||||||
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
|
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
|
||||||
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
|
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
|
||||||
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
|
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:link{color:") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
|
||||||
strColor +
|
strColor +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - visited links '*:visited {color: #RRGGBB [!important];}'
|
// - visited links '*|*:visited {color: #RRGGBB [!important];}'
|
||||||
ColorToString(visitedColor,strColor);
|
ColorToString(visitedColor,strColor);
|
||||||
// insert the rule
|
// insert the rule
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:visited{color:") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
|
||||||
strColor +
|
strColor +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - active links '*:-moz-any-link {color: red [!important];}'
|
// - active links '*|*:-moz-any-link {color: red [!important];}'
|
||||||
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
|
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
|
||||||
// because this entire stylesheet is at the user level (not UA level) and so
|
// because this entire stylesheet is at the user level (not UA level) and so
|
||||||
// the two rules above override the rule in the UA stylesheet regardless of the
|
// the two rules above override the rule in the UA stylesheet regardless of the
|
||||||
// weights of the respective rules.
|
// weights of the respective rules.
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:-moz-any-link:active{color:red") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:red") +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
@ -2429,17 +2438,17 @@ nsresult PresShell::SetPrefLinkRules(void)
|
||||||
printf (" - Creating rules for enabling link underlines\n");
|
printf (" - Creating rules for enabling link underlines\n");
|
||||||
#endif
|
#endif
|
||||||
// make a rule to make text-decoration: underline happen for links
|
// make a rule to make text-decoration: underline happen for links
|
||||||
strRule.Append(NS_LITERAL_STRING("*:-moz-any-link{text-decoration:underline}"));
|
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"));
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_attinasi
|
#ifdef DEBUG_attinasi
|
||||||
printf (" - Creating rules for disabling link underlines\n");
|
printf (" - Creating rules for disabling link underlines\n");
|
||||||
#endif
|
#endif
|
||||||
// make a rule to make text-decoration: none happen for links
|
// make a rule to make text-decoration: none happen for links
|
||||||
strRule.Append(NS_LITERAL_STRING("*:-moz-any-link{text-decoration:none}"));
|
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...now insert the rule
|
// ...now insert the rule
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,7 +2496,7 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
strRule.Append(strColor);
|
strRule.Append(strColor);
|
||||||
strRule.Append(NS_LITERAL_STRING(" !important; } "));
|
strRule.Append(NS_LITERAL_STRING(" !important; } "));
|
||||||
// insert the rules
|
// insert the rules
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
PRUint8 focusRingWidth = 1;
|
PRUint8 focusRingWidth = 1;
|
||||||
result = mPresContext->GetFocusRingWidth(&focusRingWidth);
|
result = mPresContext->GetFocusRingWidth(&focusRingWidth);
|
||||||
|
@ -2498,12 +2507,12 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
PRUint32 index = 0;
|
PRUint32 index = 0;
|
||||||
nsAutoString strRule;
|
nsAutoString strRule;
|
||||||
if (!focusRingOnAnything)
|
if (!focusRingOnAnything)
|
||||||
strRule.Append(NS_LITERAL_STRING(":link:focus, :visited")); // If we only want focus rings on the normal things like links
|
strRule.Append(NS_LITERAL_STRING("*|*:link:focus, *|*:visited")); // If we only want focus rings on the normal things like links
|
||||||
strRule.Append(NS_LITERAL_STRING(":focus {-moz-outline: ")); // For example 3px dotted WindowText (maximum 4)
|
strRule.Append(NS_LITERAL_STRING(":focus {-moz-outline: ")); // For example 3px dotted WindowText (maximum 4)
|
||||||
strRule.AppendInt(focusRingWidth);
|
strRule.AppendInt(focusRingWidth);
|
||||||
strRule.Append(NS_LITERAL_STRING("px dotted WindowText !important; } ")); // For example 3px dotted WindowText
|
strRule.Append(NS_LITERAL_STRING("px dotted WindowText !important; } ")); // For example 3px dotted WindowText
|
||||||
// insert the rules
|
// insert the rules
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
if (focusRingWidth != 1) {
|
if (focusRingWidth != 1) {
|
||||||
// If the focus ring width is different from the default, fix buttons with rings
|
// If the focus ring width is different from the default, fix buttons with rings
|
||||||
|
@ -2512,13 +2521,13 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
strRule.Append(NS_LITERAL_STRING("input[type=\"submit\"]::-moz-focus-inner { padding: 1px 2px 1px 2px; border: "));
|
strRule.Append(NS_LITERAL_STRING("input[type=\"submit\"]::-moz-focus-inner { padding: 1px 2px 1px 2px; border: "));
|
||||||
strRule.AppendInt(focusRingWidth);
|
strRule.AppendInt(focusRingWidth);
|
||||||
strRule.Append(NS_LITERAL_STRING("px dotted transparent !important; } "));
|
strRule.Append(NS_LITERAL_STRING("px dotted transparent !important; } "));
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
strRule.Assign(NS_LITERAL_STRING("button:focus::-moz-focus-inner, input[type=\"reset\"]:focus::-moz-focus-inner,"));
|
strRule.Assign(NS_LITERAL_STRING("button:focus::-moz-focus-inner, input[type=\"reset\"]:focus::-moz-focus-inner,"));
|
||||||
strRule.Append(NS_LITERAL_STRING("input[type=\"button\"]:focus::-moz-focus-inner, input[type=\"submit\"]:focus::-moz-focus-inner {"));
|
strRule.Append(NS_LITERAL_STRING("input[type=\"button\"]:focus::-moz-focus-inner, input[type=\"submit\"]:focus::-moz-focus-inner {"));
|
||||||
strRule.Append(NS_LITERAL_STRING("border-color: ButtonText !important; }"));
|
strRule.Append(NS_LITERAL_STRING("border-color: ButtonText !important; }"));
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1290,7 +1290,7 @@ protected:
|
||||||
|
|
||||||
nsresult GetSelectionForCopy(nsISelection** outSelection);
|
nsresult GetSelectionForCopy(nsISelection** outSelection);
|
||||||
|
|
||||||
nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintaina ref, may be null
|
nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintain a ref, may be null
|
||||||
PRUint32 mUpdateCount;
|
PRUint32 mUpdateCount;
|
||||||
// normal reflow commands
|
// normal reflow commands
|
||||||
nsVoidArray mReflowCommands;
|
nsVoidArray mReflowCommands;
|
||||||
|
@ -2210,7 +2210,7 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
|
||||||
printf("PrefStyleSheet removed\n");
|
printf("PrefStyleSheet removed\n");
|
||||||
#endif
|
#endif
|
||||||
// clear the sheet pointer: it is strictly historical now
|
// clear the sheet pointer: it is strictly historical now
|
||||||
NS_IF_RELEASE(mPrefStyleSheet);
|
NS_RELEASE(mPrefStyleSheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -2218,10 +2218,8 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
|
||||||
|
|
||||||
nsresult PresShell::CreatePreferenceStyleSheet(void)
|
nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mPrefStyleSheet==nsnull, "prefStyleSheet already exists");
|
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
|
||||||
nsresult result = NS_OK;
|
nsresult result = CallCreateInstance(kCSSStyleSheetCID, &mPrefStyleSheet);
|
||||||
|
|
||||||
result = nsComponentManager::CreateInstance(kCSSStyleSheetCID,nsnull,NS_GET_IID(nsICSSStyleSheet),(void**)&mPrefStyleSheet);
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
NS_ASSERTION(mPrefStyleSheet, "null but no error");
|
NS_ASSERTION(mPrefStyleSheet, "null but no error");
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
|
@ -2231,7 +2229,13 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
result = mPrefStyleSheet->Init(uri);
|
result = mPrefStyleSheet->Init(uri);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
mPrefStyleSheet->SetComplete();
|
mPrefStyleSheet->SetComplete();
|
||||||
mPrefStyleSheet->SetDefaultNameSpaceID(kNameSpaceID_XHTML);
|
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet));
|
||||||
|
if (sheet) {
|
||||||
|
PRUint32 index;
|
||||||
|
result = sheet->InsertRule(NS_LITERAL_STRING("@namespace url(http://www.w3.org/1999/xhtml);"),
|
||||||
|
0, &index);
|
||||||
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
}
|
||||||
mStyleSet->InsertUserStyleSheetBefore(mPrefStyleSheet, nsnull);
|
mStyleSet->InsertUserStyleSheetBefore(mPrefStyleSheet, nsnull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,6 +2250,11 @@ nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX We want these after the @namespace rule. Does order matter
|
||||||
|
// for these rules, or can we call nsICSSStyleRule::StyleRuleCount()
|
||||||
|
// and just "append"?
|
||||||
|
static PRUint32 sInsertPrefSheetRulesAt = 1;
|
||||||
|
|
||||||
nsresult PresShell::SetPrefColorRules(void)
|
nsresult PresShell::SetPrefColorRules(void)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
||||||
|
@ -2299,13 +2308,13 @@ nsresult PresShell::SetPrefColorRules(void)
|
||||||
NS_LITERAL_STRING("background:") +
|
NS_LITERAL_STRING("background:") +
|
||||||
strBackgroundColor +
|
strBackgroundColor +
|
||||||
NS_LITERAL_STRING(" !important; }"),
|
NS_LITERAL_STRING(" !important; }"),
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - everything else inherits the color, and has transparent background
|
// - everything else inherits the color, and has transparent background
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("* {color: inherit !important; border-color: -moz-use-text-color !important; background: transparent !important;} "),
|
result = sheet->InsertRule(NS_LITERAL_STRING("* {color: inherit !important; border-color: -moz-use-text-color !important; background: transparent !important;} "),
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2331,7 +2340,7 @@ PresShell::SetPrefNoScriptRule()
|
||||||
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet,&rv));
|
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet,&rv));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
PRUint32 index = 0;
|
PRUint32 index = 0;
|
||||||
rv = sheet->InsertRule(NS_LITERAL_STRING("noscript{display:block}"), 0, &index);
|
rv = sheet->InsertRule(NS_LITERAL_STRING("noscript{display:block}"), sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2381,35 +2390,35 @@ nsresult PresShell::SetPrefLinkRules(void)
|
||||||
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
|
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - links: '*:link {color: #RRGGBB [!important];}'
|
// - links: '*|*:link {color: #RRGGBB [!important];}'
|
||||||
ColorToString(linkColor,strColor);
|
ColorToString(linkColor,strColor);
|
||||||
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
|
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
|
||||||
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
|
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
|
||||||
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
|
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:link{color:") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
|
||||||
strColor +
|
strColor +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - visited links '*:visited {color: #RRGGBB [!important];}'
|
// - visited links '*|*:visited {color: #RRGGBB [!important];}'
|
||||||
ColorToString(visitedColor,strColor);
|
ColorToString(visitedColor,strColor);
|
||||||
// insert the rule
|
// insert the rule
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:visited{color:") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
|
||||||
strColor +
|
strColor +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// - active links '*:-moz-any-link {color: red [!important];}'
|
// - active links '*|*:-moz-any-link {color: red [!important];}'
|
||||||
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
|
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
|
||||||
// because this entire stylesheet is at the user level (not UA level) and so
|
// because this entire stylesheet is at the user level (not UA level) and so
|
||||||
// the two rules above override the rule in the UA stylesheet regardless of the
|
// the two rules above override the rule in the UA stylesheet regardless of the
|
||||||
// weights of the respective rules.
|
// weights of the respective rules.
|
||||||
result = sheet->InsertRule(NS_LITERAL_STRING("*:-moz-any-link:active{color:red") +
|
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:red") +
|
||||||
ruleClose,
|
ruleClose,
|
||||||
0,&index);
|
sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
@ -2429,17 +2438,17 @@ nsresult PresShell::SetPrefLinkRules(void)
|
||||||
printf (" - Creating rules for enabling link underlines\n");
|
printf (" - Creating rules for enabling link underlines\n");
|
||||||
#endif
|
#endif
|
||||||
// make a rule to make text-decoration: underline happen for links
|
// make a rule to make text-decoration: underline happen for links
|
||||||
strRule.Append(NS_LITERAL_STRING("*:-moz-any-link{text-decoration:underline}"));
|
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"));
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_attinasi
|
#ifdef DEBUG_attinasi
|
||||||
printf (" - Creating rules for disabling link underlines\n");
|
printf (" - Creating rules for disabling link underlines\n");
|
||||||
#endif
|
#endif
|
||||||
// make a rule to make text-decoration: none happen for links
|
// make a rule to make text-decoration: none happen for links
|
||||||
strRule.Append(NS_LITERAL_STRING("*:-moz-any-link{text-decoration:none}"));
|
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...now insert the rule
|
// ...now insert the rule
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,7 +2496,7 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
strRule.Append(strColor);
|
strRule.Append(strColor);
|
||||||
strRule.Append(NS_LITERAL_STRING(" !important; } "));
|
strRule.Append(NS_LITERAL_STRING(" !important; } "));
|
||||||
// insert the rules
|
// insert the rules
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
PRUint8 focusRingWidth = 1;
|
PRUint8 focusRingWidth = 1;
|
||||||
result = mPresContext->GetFocusRingWidth(&focusRingWidth);
|
result = mPresContext->GetFocusRingWidth(&focusRingWidth);
|
||||||
|
@ -2498,12 +2507,12 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
PRUint32 index = 0;
|
PRUint32 index = 0;
|
||||||
nsAutoString strRule;
|
nsAutoString strRule;
|
||||||
if (!focusRingOnAnything)
|
if (!focusRingOnAnything)
|
||||||
strRule.Append(NS_LITERAL_STRING(":link:focus, :visited")); // If we only want focus rings on the normal things like links
|
strRule.Append(NS_LITERAL_STRING("*|*:link:focus, *|*:visited")); // If we only want focus rings on the normal things like links
|
||||||
strRule.Append(NS_LITERAL_STRING(":focus {-moz-outline: ")); // For example 3px dotted WindowText (maximum 4)
|
strRule.Append(NS_LITERAL_STRING(":focus {-moz-outline: ")); // For example 3px dotted WindowText (maximum 4)
|
||||||
strRule.AppendInt(focusRingWidth);
|
strRule.AppendInt(focusRingWidth);
|
||||||
strRule.Append(NS_LITERAL_STRING("px dotted WindowText !important; } ")); // For example 3px dotted WindowText
|
strRule.Append(NS_LITERAL_STRING("px dotted WindowText !important; } ")); // For example 3px dotted WindowText
|
||||||
// insert the rules
|
// insert the rules
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
if (focusRingWidth != 1) {
|
if (focusRingWidth != 1) {
|
||||||
// If the focus ring width is different from the default, fix buttons with rings
|
// If the focus ring width is different from the default, fix buttons with rings
|
||||||
|
@ -2512,13 +2521,13 @@ nsresult PresShell::SetPrefFocusRules(void)
|
||||||
strRule.Append(NS_LITERAL_STRING("input[type=\"submit\"]::-moz-focus-inner { padding: 1px 2px 1px 2px; border: "));
|
strRule.Append(NS_LITERAL_STRING("input[type=\"submit\"]::-moz-focus-inner { padding: 1px 2px 1px 2px; border: "));
|
||||||
strRule.AppendInt(focusRingWidth);
|
strRule.AppendInt(focusRingWidth);
|
||||||
strRule.Append(NS_LITERAL_STRING("px dotted transparent !important; } "));
|
strRule.Append(NS_LITERAL_STRING("px dotted transparent !important; } "));
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
strRule.Assign(NS_LITERAL_STRING("button:focus::-moz-focus-inner, input[type=\"reset\"]:focus::-moz-focus-inner,"));
|
strRule.Assign(NS_LITERAL_STRING("button:focus::-moz-focus-inner, input[type=\"reset\"]:focus::-moz-focus-inner,"));
|
||||||
strRule.Append(NS_LITERAL_STRING("input[type=\"button\"]:focus::-moz-focus-inner, input[type=\"submit\"]:focus::-moz-focus-inner {"));
|
strRule.Append(NS_LITERAL_STRING("input[type=\"button\"]:focus::-moz-focus-inner, input[type=\"submit\"]:focus::-moz-focus-inner {"));
|
||||||
strRule.Append(NS_LITERAL_STRING("border-color: ButtonText !important; }"));
|
strRule.Append(NS_LITERAL_STRING("border-color: ButtonText !important; }"));
|
||||||
result = sheet->InsertRule(strRule,0,&index);
|
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,8 +534,13 @@ GetMathMLAttributeStyleSheet(nsIPresContext* aPresContext,
|
||||||
if (!cssSheet)
|
if (!cssSheet)
|
||||||
return;
|
return;
|
||||||
cssSheet->Init(uri);
|
cssSheet->Init(uri);
|
||||||
|
nsCOMPtr<nsIDOMCSSStyleSheet> domSheet(do_QueryInterface(cssSheet));
|
||||||
|
if (domSheet) {
|
||||||
|
PRUint32 index;
|
||||||
|
domSheet->InsertRule(NS_LITERAL_STRING("@namespace url(http://www.w3.org/1998/Math/MathML);"),
|
||||||
|
0, &index);
|
||||||
|
}
|
||||||
cssSheet->SetTitle(NS_ConvertASCIItoUCS2(kTitle));
|
cssSheet->SetTitle(NS_ConvertASCIItoUCS2(kTitle));
|
||||||
cssSheet->SetDefaultNameSpaceID(kNameSpaceID_MathML);
|
|
||||||
nsCOMPtr<nsIStyleSheet> sheet(do_QueryInterface(cssSheet));
|
nsCOMPtr<nsIStyleSheet> sheet(do_QueryInterface(cssSheet));
|
||||||
|
|
||||||
// all done, no further activity from the net involved, so we better do this
|
// all done, no further activity from the net involved, so we better do this
|
||||||
|
@ -666,7 +671,7 @@ nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext,
|
||||||
// insert the rule (note: when the sheet already has @namespace and
|
// insert the rule (note: when the sheet already has @namespace and
|
||||||
// friends, insert after them, e.g., at the end, otherwise it won't work)
|
// friends, insert after them, e.g., at the end, otherwise it won't work)
|
||||||
// For MathML 2, insert at the end to give it precedence
|
// For MathML 2, insert at the end to give it precedence
|
||||||
PRInt32 pos = (map->compatibility == kMathMLversion2) ? count : 0;
|
PRInt32 pos = (map->compatibility == kMathMLversion2) ? count : 1;
|
||||||
PRUint32 index;
|
PRUint32 index;
|
||||||
domSheet->InsertRule(cssRule, pos, &index);
|
domSheet->InsertRule(cssRule, pos, &index);
|
||||||
++ruleCount;
|
++ruleCount;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsINameSpaceManager.h"
|
|
||||||
#include "nsIUnicharInputStream.h"
|
#include "nsIUnicharInputStream.h"
|
||||||
#include "nsIConverterInputStream.h"
|
#include "nsIConverterInputStream.h"
|
||||||
#include "nsICharsetAlias.h"
|
#include "nsICharsetAlias.h"
|
||||||
|
@ -958,7 +957,6 @@ CSSLoaderImpl::CheckLoadAllowed(nsIURI* aSourceURI,
|
||||||
nsresult
|
nsresult
|
||||||
CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
||||||
nsIContent* aLinkingContent,
|
nsIContent* aLinkingContent,
|
||||||
PRUint32 aDefaultNameSpaceID,
|
|
||||||
PRBool aSyncLoad,
|
PRBool aSyncLoad,
|
||||||
StyleSheetState& aSheetState,
|
StyleSheetState& aSheetState,
|
||||||
nsICSSStyleSheet** aSheet)
|
nsICSSStyleSheet** aSheet)
|
||||||
|
@ -1039,8 +1037,6 @@ CSSLoaderImpl::CreateSheet(nsIURI* aURI,
|
||||||
rv = NS_NewCSSStyleSheet(aSheet); // Don't init the sheet here, but in
|
rv = NS_NewCSSStyleSheet(aSheet); // Don't init the sheet here, but in
|
||||||
// ParseSheet once we know the final URI
|
// ParseSheet once we know the final URI
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
(*aSheet)->SetDefaultNameSpaceID(aDefaultNameSpaceID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(*aSheet, "We should have a sheet by now!");
|
NS_ASSERTION(*aSheet, "We should have a sheet by now!");
|
||||||
|
@ -1563,7 +1559,6 @@ CSSLoaderImpl::LoadInlineStyle(nsIContent* aElement,
|
||||||
nsIUnicharInputStream* aStream,
|
nsIUnicharInputStream* aStream,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver)
|
nsICSSLoaderObserver* aObserver)
|
||||||
|
@ -1586,8 +1581,8 @@ CSSLoaderImpl::LoadInlineStyle(nsIContent* aElement,
|
||||||
|
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
nsresult rv = CreateSheet(nsnull, aElement, aDefaultNameSpaceID, PR_FALSE,
|
nsresult rv = CreateSheet(nsnull, aElement, PR_FALSE, state,
|
||||||
state, getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_ASSERTION(state == eSheetNeedsParser,
|
NS_ASSERTION(state == eSheetNeedsParser,
|
||||||
"Inline sheets should not be cached");
|
"Inline sheets should not be cached");
|
||||||
|
@ -1620,7 +1615,6 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver)
|
nsICSSLoaderObserver* aObserver)
|
||||||
|
@ -1651,7 +1645,7 @@ CSSLoaderImpl::LoadStyleLink(nsIContent* aElement,
|
||||||
|
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
rv = CreateSheet(aURL, aElement, aDefaultNameSpaceID, PR_FALSE, state,
|
rv = CreateSheet(aURL, aElement, PR_FALSE, state,
|
||||||
getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -1705,7 +1699,6 @@ NS_IMETHODIMP
|
||||||
CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aParentRule)
|
nsICSSImportRule* aParentRule)
|
||||||
{
|
{
|
||||||
LOG(("CSSLoaderImpl::LoadChildSheet"));
|
LOG(("CSSLoaderImpl::LoadChildSheet"));
|
||||||
|
@ -1761,7 +1754,7 @@ CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
// loop) do so
|
// loop) do so
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
StyleSheetState state;
|
StyleSheetState state;
|
||||||
rv = CreateSheet(aURL, nsnull, aDefaultNameSpaceID,
|
rv = CreateSheet(aURL, nsnull,
|
||||||
parentData ? parentData->mSyncLoad : PR_FALSE,
|
parentData ? parentData->mSyncLoad : PR_FALSE,
|
||||||
state, getter_AddRefs(sheet));
|
state, getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -1833,8 +1826,8 @@ CSSLoaderImpl::InternalLoadAgentSheet(nsIURI* aURL,
|
||||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||||
PRBool syncLoad = (aObserver == nsnull);
|
PRBool syncLoad = (aObserver == nsnull);
|
||||||
|
|
||||||
nsresult rv = CreateSheet(aURL, nsnull, kNameSpaceID_Unknown, syncLoad,
|
nsresult rv = CreateSheet(aURL, nsnull, syncLoad, state,
|
||||||
state, getter_AddRefs(sheet));
|
getter_AddRefs(sheet));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
NS_NAMED_LITERAL_STRING(empty, "");
|
NS_NAMED_LITERAL_STRING(empty, "");
|
||||||
|
|
|
@ -260,7 +260,6 @@ public:
|
||||||
nsIUnicharInputStream* aIn,
|
nsIUnicharInputStream* aIn,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver);
|
nsICSSLoaderObserver* aObserver);
|
||||||
|
@ -269,7 +268,6 @@ public:
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver);
|
nsICSSLoaderObserver* aObserver);
|
||||||
|
@ -277,7 +275,6 @@ public:
|
||||||
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aRule);
|
nsICSSImportRule* aRule);
|
||||||
|
|
||||||
NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSStyleSheet** aSheet);
|
NS_IMETHOD LoadAgentSheet(nsIURI* aURL, nsICSSStyleSheet** aSheet);
|
||||||
|
@ -312,7 +309,6 @@ private:
|
||||||
// must be non-null then.
|
// must be non-null then.
|
||||||
nsresult CreateSheet(nsIURI* aURI,
|
nsresult CreateSheet(nsIURI* aURI,
|
||||||
nsIContent* aLinkingContent,
|
nsIContent* aLinkingContent,
|
||||||
PRUint32 aDefaultNameSpaceID,
|
|
||||||
PRBool aSyncLoad,
|
PRBool aSyncLoad,
|
||||||
StyleSheetState& aSheetState,
|
StyleSheetState& aSheetState,
|
||||||
nsICSSStyleSheet** aSheet);
|
nsICSSStyleSheet** aSheet);
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ PRBool CSSParserImpl::ProcessImport(PRInt32& aErrorCode, const nsString& aURLSpe
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mChildLoader->LoadChildSheet(mSheet, url, aMedia, kNameSpaceID_Unknown, rule);
|
mChildLoader->LoadChildSheet(mSheet, url, aMedia, rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
|
@ -783,7 +783,6 @@ public:
|
||||||
nsISupportsArray* mOrderedRules;
|
nsISupportsArray* mOrderedRules;
|
||||||
|
|
||||||
nsCOMPtr<nsINameSpace> mNameSpace;
|
nsCOMPtr<nsINameSpace> mNameSpace;
|
||||||
PRInt32 mDefaultNameSpaceID;
|
|
||||||
PRPackedBool mComplete;
|
PRPackedBool mComplete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -858,7 +857,6 @@ public:
|
||||||
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const;
|
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const;
|
||||||
|
|
||||||
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const;
|
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const;
|
||||||
NS_IMETHOD SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID);
|
|
||||||
|
|
||||||
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
||||||
nsICSSImportRule* aCloneOwnerRule,
|
nsICSSImportRule* aCloneOwnerRule,
|
||||||
|
@ -1465,7 +1463,6 @@ CSSStyleSheetInner::CSSStyleSheetInner(nsICSSStyleSheet* aParentSheet)
|
||||||
: mSheets(),
|
: mSheets(),
|
||||||
mOrderedRules(nsnull),
|
mOrderedRules(nsnull),
|
||||||
mNameSpace(nsnull),
|
mNameSpace(nsnull),
|
||||||
mDefaultNameSpaceID(kNameSpaceID_None),
|
|
||||||
mComplete(PR_FALSE)
|
mComplete(PR_FALSE)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
||||||
|
@ -1491,7 +1488,6 @@ CSSStyleSheetInner::CSSStyleSheetInner(CSSStyleSheetInner& aCopy,
|
||||||
: mSheets(),
|
: mSheets(),
|
||||||
mURL(aCopy.mURL),
|
mURL(aCopy.mURL),
|
||||||
mNameSpace(nsnull),
|
mNameSpace(nsnull),
|
||||||
mDefaultNameSpaceID(aCopy.mDefaultNameSpaceID),
|
|
||||||
mComplete(aCopy.mComplete)
|
mComplete(aCopy.mComplete)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
MOZ_COUNT_CTOR(CSSStyleSheetInner);
|
||||||
|
@ -1586,14 +1582,7 @@ CSSStyleSheetInner::RebuildNameSpaces(void)
|
||||||
{
|
{
|
||||||
nsContentUtils::GetNSManagerWeakRef()->
|
nsContentUtils::GetNSManagerWeakRef()->
|
||||||
CreateRootNameSpace(getter_AddRefs(mNameSpace));
|
CreateRootNameSpace(getter_AddRefs(mNameSpace));
|
||||||
if (kNameSpaceID_Unknown != mDefaultNameSpaceID) {
|
|
||||||
nsCOMPtr<nsINameSpace> defaultNameSpace;
|
|
||||||
mNameSpace->CreateChildNameSpace(nsnull, mDefaultNameSpaceID,
|
|
||||||
getter_AddRefs(defaultNameSpace));
|
|
||||||
if (defaultNameSpace) {
|
|
||||||
mNameSpace = defaultNameSpace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mOrderedRules) {
|
if (mOrderedRules) {
|
||||||
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
||||||
}
|
}
|
||||||
|
@ -2243,17 +2232,6 @@ CSSStyleSheetImpl::GetNameSpace(nsINameSpace*& aNameSpace) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
CSSStyleSheetImpl::SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID)
|
|
||||||
{
|
|
||||||
if (mInner) {
|
|
||||||
mInner->mDefaultNameSpaceID = aDefaultNameSpaceID;
|
|
||||||
mInner->RebuildNameSpaces();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
CSSStyleSheetImpl::StyleSheetCount(PRInt32& aCount) const
|
CSSStyleSheetImpl::StyleSheetCount(PRInt32& aCount) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,6 @@ public:
|
||||||
nsIUnicharInputStream* aStream,
|
nsIUnicharInputStream* aStream,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver) = 0;
|
nsICSSLoaderObserver* aObserver) = 0;
|
||||||
|
@ -101,7 +100,6 @@ public:
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aTitle,
|
const nsAString& aTitle,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsIParser* aParserToUnblock,
|
nsIParser* aParserToUnblock,
|
||||||
PRBool& aCompleted,
|
PRBool& aCompleted,
|
||||||
nsICSSLoaderObserver* aObserver) = 0;
|
nsICSSLoaderObserver* aObserver) = 0;
|
||||||
|
@ -110,7 +108,6 @@ public:
|
||||||
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
NS_IMETHOD LoadChildSheet(nsICSSStyleSheet* aParentSheet,
|
||||||
nsIURI* aURL,
|
nsIURI* aURL,
|
||||||
const nsAString& aMedia,
|
const nsAString& aMedia,
|
||||||
PRInt32 aDefaultNameSpaceID,
|
|
||||||
nsICSSImportRule* aRule) = 0;
|
nsICSSImportRule* aRule) = 0;
|
||||||
|
|
||||||
// Load a user agent or user sheet. The sheet is loaded
|
// Load a user agent or user sheet. The sheet is loaded
|
||||||
|
|
|
@ -87,8 +87,6 @@ public:
|
||||||
|
|
||||||
// get head of namespace chain for sheet
|
// get head of namespace chain for sheet
|
||||||
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
NS_IMETHOD GetNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
||||||
// set default namespace for sheet (may be overridden by @namespace)
|
|
||||||
NS_IMETHOD SetDefaultNameSpaceID(PRInt32 aDefaultNameSpaceID) = 0;
|
|
||||||
|
|
||||||
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
|
||||||
nsICSSImportRule* aCloneOwnerRule,
|
nsICSSImportRule* aCloneOwnerRule,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче