зеркало из https://github.com/mozilla/pjs.git
Bug 577002 Part 2: Remove nsICSSImportRule. r=bzbarsky
--HG-- rename : layout/style/nsICSSImportRule.h => layout/style/ImportRule.h
This commit is contained in:
Родитель
8bb0fba53b
Коммит
435a97bcbe
|
@ -35,38 +35,71 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* internal interface for CSS @import rules */
|
||||
/* class for CSS @import rules */
|
||||
|
||||
#ifndef nsICSSImportRule_h
|
||||
#define nsICSSImportRule_h
|
||||
#ifndef mozilla_css_ImportRule_h__
|
||||
#define mozilla_css_ImportRule_h__
|
||||
|
||||
#include "nsICSSRule.h"
|
||||
#include "nsCSSRule.h"
|
||||
#include "nsIDOMCSSImportRule.h"
|
||||
#include "nsCSSRules.h"
|
||||
|
||||
class nsMediaList;
|
||||
class nsString;
|
||||
|
||||
#define NS_ICSS_IMPORT_RULE_IID \
|
||||
{ 0x07bd9b80, 0x721e, 0x4566, \
|
||||
{ 0xb7, 0x90, 0xed, 0x25, 0x10, 0xed, 0x99, 0xde } }
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
|
||||
class nsICSSImportRule : public nsICSSRule {
|
||||
class NS_FINAL_CLASS ImportRule : public nsCSSRule,
|
||||
public nsICSSRule,
|
||||
public nsIDOMCSSImportRule
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSS_IMPORT_RULE_IID)
|
||||
ImportRule(nsMediaList* aMedia);
|
||||
private:
|
||||
// for |Clone|
|
||||
ImportRule(const ImportRule& aCopy);
|
||||
~ImportRule();
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD SetURLSpec(const nsString& aURLSpec) = 0;
|
||||
NS_IMETHOD GetURLSpec(nsString& aURLSpec) const = 0;
|
||||
DECL_STYLE_RULE_INHERIT
|
||||
|
||||
NS_IMETHOD SetMedia(const nsString& aMedia) = 0;
|
||||
NS_IMETHOD GetMedia(nsString& aMedia) const = 0;
|
||||
// nsIStyleRule methods
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD SetSheet(nsCSSStyleSheet*) = 0;
|
||||
// nsICSSRule methods
|
||||
virtual PRInt32 GetType() const;
|
||||
virtual already_AddRefed<nsICSSRule> Clone() const;
|
||||
|
||||
NS_IMETHOD SetURLSpec(const nsString& aURLSpec);
|
||||
NS_IMETHOD GetURLSpec(nsString& aURLSpec) const;
|
||||
|
||||
NS_IMETHOD SetMedia(const nsString& aMedia);
|
||||
NS_IMETHOD GetMedia(nsString& aMedia) const;
|
||||
|
||||
NS_IMETHOD SetSheet(nsCSSStyleSheet*);
|
||||
|
||||
// nsIDOMCSSRule interface
|
||||
NS_DECL_NSIDOMCSSRULE
|
||||
|
||||
// nsIDOMCSSImportRule interface
|
||||
NS_DECL_NSIDOMCSSIMPORTRULE
|
||||
|
||||
private:
|
||||
nsString mURLSpec;
|
||||
nsRefPtr<nsMediaList> mMedia;
|
||||
nsRefPtr<nsCSSStyleSheet> mChildSheet;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSImportRule, NS_ICSS_IMPORT_RULE_IID)
|
||||
} // namespace css
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewCSSImportRule(nsICSSImportRule** aInstancePtrResult,
|
||||
NS_NewCSSImportRule(mozilla::css::ImportRule** aInstancePtrResult,
|
||||
const nsString& aURLSpec, nsMediaList* aMedia);
|
||||
|
||||
#endif /* nsICSSImportRule_h */
|
||||
#endif /* mozilla_css_ImportRule_h__ */
|
|
@ -81,7 +81,7 @@
|
|||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
#include "mozilla/css/ImportRule.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsDocShellCID.h"
|
||||
|
@ -93,7 +93,6 @@
|
|||
#include "nsIMediaList.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsIDOMCSSImportRule.h"
|
||||
#include "nsContentErrors.h"
|
||||
|
||||
#include "nsIChannelPolicy.h"
|
||||
|
@ -1343,7 +1342,7 @@ Loader::InsertSheetInDoc(nsCSSStyleSheet* aSheet,
|
|||
nsresult
|
||||
Loader::InsertChildSheet(nsCSSStyleSheet* aSheet,
|
||||
nsCSSStyleSheet* aParentSheet,
|
||||
nsICSSImportRule* aParentRule)
|
||||
ImportRule* aParentRule)
|
||||
{
|
||||
LOG(("css::Loader::InsertChildSheet"));
|
||||
NS_PRECONDITION(aSheet, "Nothing to insert");
|
||||
|
@ -1980,7 +1979,7 @@ nsresult
|
|||
Loader::LoadChildSheet(nsCSSStyleSheet* aParentSheet,
|
||||
nsIURI* aURL,
|
||||
nsMediaList* aMedia,
|
||||
nsICSSImportRule* aParentRule)
|
||||
ImportRule* aParentRule)
|
||||
{
|
||||
LOG(("css::Loader::LoadChildSheet"));
|
||||
NS_PRECONDITION(aURL, "Must have a URI to load");
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "nsURIHashKey.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsICSSImportRule;
|
||||
class nsICSSLoaderObserver;
|
||||
class nsCSSStyleSheet;
|
||||
class nsIContent;
|
||||
|
@ -126,6 +125,7 @@ protected:
|
|||
namespace css {
|
||||
|
||||
class SheetLoadData;
|
||||
class ImportRule;
|
||||
|
||||
/***********************************************************************
|
||||
* Enum that describes the state of the sheet returned by CreateSheet. *
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
nsresult LoadChildSheet(nsCSSStyleSheet* aParentSheet,
|
||||
nsIURI* aURL,
|
||||
nsMediaList* aMedia,
|
||||
nsICSSImportRule* aRule);
|
||||
ImportRule* aRule);
|
||||
|
||||
/**
|
||||
* Synchronously load and return the stylesheet at aURL. Any child sheets
|
||||
|
@ -408,7 +408,7 @@ private:
|
|||
|
||||
nsresult InsertChildSheet(nsCSSStyleSheet* aSheet,
|
||||
nsCSSStyleSheet* aParentSheet,
|
||||
nsICSSImportRule* aParentRule);
|
||||
ImportRule* aParentRule);
|
||||
|
||||
nsresult InternalLoadNonDocumentSheet(nsIURI* aURL,
|
||||
PRBool aAllowUnsafeRules,
|
||||
|
|
|
@ -74,7 +74,6 @@ EXPORTS = \
|
|||
nsDOMCSSDeclaration.h \
|
||||
nsICSSDeclaration.h \
|
||||
nsICSSGroupRule.h \
|
||||
nsICSSImportRule.h \
|
||||
nsICSSLoaderObserver.h \
|
||||
nsICSSPseudoComparator.h \
|
||||
nsICSSRule.h \
|
||||
|
@ -101,6 +100,7 @@ EXPORTS = \
|
|||
|
||||
EXPORTS_mozilla/css = \
|
||||
Declaration.h \
|
||||
ImportRule.h \
|
||||
Loader.h \
|
||||
NameSpaceRule.h \
|
||||
StyleRule.h \
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nsCSSScanner.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
#include "mozilla/css/ImportRule.h"
|
||||
#include "nsCSSRules.h"
|
||||
#include "mozilla/css/NameSpaceRule.h"
|
||||
#include "nsIUnicharInputStream.h"
|
||||
|
@ -1930,7 +1930,7 @@ CSSParserImpl::ProcessImport(const nsString& aURLSpec,
|
|||
RuleAppendFunc aAppendFunc,
|
||||
void* aData)
|
||||
{
|
||||
nsCOMPtr<nsICSSImportRule> rule;
|
||||
nsRefPtr<css::ImportRule> rule;
|
||||
nsresult rv = NS_NewCSSImportRule(getter_AddRefs(rule), aURLSpec, aMedia);
|
||||
if (NS_FAILED(rv)) { // out of memory
|
||||
mScanner.SetLowLevelError(rv);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "nsCSSRules.h"
|
||||
#include "nsCSSValue.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
#include "mozilla/css/ImportRule.h"
|
||||
#include "mozilla/css/NameSpaceRule.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
@ -52,7 +52,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsIDOMCSSImportRule.h"
|
||||
#include "nsIDOMCSSMediaRule.h"
|
||||
#include "nsIDOMCSSMozDocumentRule.h"
|
||||
#include "nsIDOMCSSCharsetRule.h"
|
||||
|
@ -355,51 +354,6 @@ CSSCharsetRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule)
|
|||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
class NS_FINAL_CLASS ImportRule : public nsCSSRule,
|
||||
public nsICSSImportRule,
|
||||
public nsIDOMCSSImportRule
|
||||
{
|
||||
public:
|
||||
ImportRule(nsMediaList* aMedia);
|
||||
ImportRule(const ImportRule& aCopy);
|
||||
private:
|
||||
~ImportRule();
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DECL_STYLE_RULE_INHERIT
|
||||
|
||||
// nsIStyleRule methods
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
// nsICSSRule methods
|
||||
virtual PRInt32 GetType() const;
|
||||
virtual already_AddRefed<nsICSSRule> Clone() const;
|
||||
|
||||
// nsICSSImportRule methods
|
||||
NS_IMETHOD SetURLSpec(const nsString& aURLSpec);
|
||||
NS_IMETHOD GetURLSpec(nsString& aURLSpec) const;
|
||||
|
||||
NS_IMETHOD SetMedia(const nsString& aMedia);
|
||||
NS_IMETHOD GetMedia(nsString& aMedia) const;
|
||||
|
||||
NS_IMETHOD SetSheet(nsCSSStyleSheet*);
|
||||
|
||||
// nsIDOMCSSRule interface
|
||||
NS_DECL_NSIDOMCSSRULE
|
||||
|
||||
// nsIDOMCSSImportRule interface
|
||||
NS_DECL_NSIDOMCSSIMPORTRULE
|
||||
|
||||
protected:
|
||||
nsString mURLSpec;
|
||||
nsRefPtr<nsMediaList> mMedia;
|
||||
nsRefPtr<nsCSSStyleSheet> mChildSheet;
|
||||
};
|
||||
|
||||
ImportRule::ImportRule(nsMediaList* aMedia)
|
||||
: nsCSSRule()
|
||||
, mURLSpec()
|
||||
|
@ -434,12 +388,11 @@ NS_IMPL_RELEASE(ImportRule)
|
|||
|
||||
// QueryInterface implementation for ImportRule
|
||||
NS_INTERFACE_MAP_BEGIN(ImportRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSImportRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSImportRule)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICSSImportRule)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICSSRule)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSImportRule)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -613,7 +566,7 @@ ImportRule::GetStyleSheet(nsIDOMCSSStyleSheet * *aStyleSheet)
|
|||
DOMCI_DATA(CSSImportRule, css::ImportRule)
|
||||
|
||||
nsresult
|
||||
NS_NewCSSImportRule(nsICSSImportRule** aInstancePtrResult,
|
||||
NS_NewCSSImportRule(css::ImportRule** aInstancePtrResult,
|
||||
const nsString& aURLSpec,
|
||||
nsMediaList* aMedia)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "nsCSSRuleProcessor.h"
|
||||
#include "mozilla/css/NameSpaceRule.h"
|
||||
#include "nsICSSGroupRule.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
#include "mozilla/css/ImportRule.h"
|
||||
#include "nsIMediaList.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -56,7 +56,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsIDOMCSSImportRule.h"
|
||||
#include "nsICSSRuleList.h"
|
||||
#include "nsIDOMMediaList.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -862,7 +861,7 @@ nsCSSStyleSheet::RebuildChildList(nsICSSRule* aRule, void* aBuilder)
|
|||
static_cast<ChildSheetListBuilder*>(aBuilder);
|
||||
|
||||
// XXXbz We really need to decomtaminate all this stuff. Is there a reason
|
||||
// that I can't just QI to nsICSSImportRule and get an nsCSSStyleSheet
|
||||
// that I can't just QI to ImportRule and get an nsCSSStyleSheet
|
||||
// directly from it?
|
||||
nsCOMPtr<nsIDOMCSSImportRule> importRule(do_QueryInterface(aRule));
|
||||
NS_ASSERTION(importRule, "GetType lied");
|
||||
|
@ -1013,7 +1012,7 @@ nsCSSStyleSheet::nsCSSStyleSheet()
|
|||
|
||||
nsCSSStyleSheet::nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
|
||||
nsCSSStyleSheet* aParentToUse,
|
||||
nsICSSImportRule* aOwnerRuleToUse,
|
||||
css::ImportRule* aOwnerRuleToUse,
|
||||
nsIDocument* aDocumentToUse,
|
||||
nsIDOMNode* aOwningNodeToUse)
|
||||
: mTitle(aCopy.mTitle),
|
||||
|
@ -1462,7 +1461,7 @@ nsCSSStyleSheet::AppendAllChildSheets(nsTArray<nsCSSStyleSheet*>& aArray)
|
|||
|
||||
already_AddRefed<nsCSSStyleSheet>
|
||||
nsCSSStyleSheet::Clone(nsCSSStyleSheet* aCloneParent,
|
||||
nsICSSImportRule* aCloneOwnerRule,
|
||||
css::ImportRule* aCloneOwnerRule,
|
||||
nsIDocument* aCloneDocument,
|
||||
nsIDOMNode* aCloneOwningNode) const
|
||||
{
|
||||
|
@ -2070,13 +2069,13 @@ nsCSSStyleSheet::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
|
|||
"We are being notified of a sheet load for a sheet that is not our child!");
|
||||
|
||||
if (mDocument && NS_SUCCEEDED(aStatus)) {
|
||||
nsCOMPtr<nsICSSImportRule> ownerRule = aSheet->GetOwnerRule();
|
||||
nsRefPtr<css::ImportRule> ownerRule = aSheet->GetOwnerRule();
|
||||
|
||||
mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, PR_TRUE);
|
||||
|
||||
// XXXldb @import rules shouldn't even implement nsIStyleRule (but
|
||||
// they do)!
|
||||
nsCOMPtr<nsIStyleRule> styleRule(do_QueryInterface(ownerRule));
|
||||
nsIStyleRule* styleRule = ownerRule;
|
||||
|
||||
mDocument->StyleRuleAdded(this, styleRule);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ class nsXMLNameSpaceMap;
|
|||
class nsCSSRuleProcessor;
|
||||
class nsMediaList;
|
||||
class nsICSSGroupRule;
|
||||
class nsICSSImportRule;
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
class nsMediaList;
|
||||
|
@ -66,6 +65,12 @@ class nsCSSStyleSheet;
|
|||
class nsPresContext;
|
||||
template<class E, class A> class nsTArray;
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
class ImportRule;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
// CSS Style Sheet Inner Data Container
|
||||
//
|
||||
|
@ -194,13 +199,13 @@ public:
|
|||
void SetMedia(nsMediaList* aMedia);
|
||||
void SetOwningNode(nsIDOMNode* aOwningNode) { mOwningNode = aOwningNode; /* Not ref counted */ }
|
||||
|
||||
void SetOwnerRule(nsICSSImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
|
||||
nsICSSImportRule* GetOwnerRule() const { return mOwnerRule; }
|
||||
void SetOwnerRule(mozilla::css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
|
||||
mozilla::css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
|
||||
|
||||
nsXMLNameSpaceMap* GetNameSpaceMap() const { return mInner->mNameSpaceMap; }
|
||||
|
||||
already_AddRefed<nsCSSStyleSheet> Clone(nsCSSStyleSheet* aCloneParent,
|
||||
nsICSSImportRule* aCloneOwnerRule,
|
||||
mozilla::css::ImportRule* aCloneOwnerRule,
|
||||
nsIDocument* aCloneDocument,
|
||||
nsIDOMNode* aCloneOwningNode) const;
|
||||
|
||||
|
@ -255,7 +260,7 @@ public:
|
|||
private:
|
||||
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
|
||||
nsCSSStyleSheet* aParentToUse,
|
||||
nsICSSImportRule* aOwnerRuleToUse,
|
||||
mozilla::css::ImportRule* aOwnerRuleToUse,
|
||||
nsIDocument* aDocumentToUse,
|
||||
nsIDOMNode* aOwningNodeToUse);
|
||||
|
||||
|
@ -284,7 +289,7 @@ protected:
|
|||
nsRefPtr<nsMediaList> mMedia;
|
||||
nsRefPtr<nsCSSStyleSheet> mNext;
|
||||
nsCSSStyleSheet* mParent; // weak ref
|
||||
nsICSSImportRule* mOwnerRule; // weak ref
|
||||
mozilla::css::ImportRule* mOwnerRule; // weak ref
|
||||
|
||||
CSSRuleListImpl* mRuleCollection;
|
||||
nsIDocument* mDocument; // weak ref; parents maintain this for their children
|
||||
|
|
|
@ -47,6 +47,7 @@ class nsCSSStyleSheet;
|
|||
class nsICSSGroupRule;
|
||||
class nsAString;
|
||||
template<class T> struct already_AddRefed;
|
||||
class nsIStyleSheet;
|
||||
|
||||
// IID for the nsICSSRule interface
|
||||
#define NS_ICSS_RULE_IID \
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsIContent;
|
||||
struct nsRuleData;
|
||||
|
||||
// IID for the nsIStyleRule interface {f75f3f70-435d-43a6-a01b-65970489ca26}
|
||||
|
|
Загрузка…
Ссылка в новой задаче