2004-08-04 03:27:28 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
// vim:cindent:tabstop=2:expandtab:shiftwidth=2:
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2006-03-25 05:47:31 +00:00
|
|
|
/* representation of a CSS style sheet */
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
#ifndef nsCSSStyleSheet_h_
|
|
|
|
#define nsCSSStyleSheet_h_
|
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2013-01-08 23:25:47 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2011-11-21 06:21:16 +00:00
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2005-02-18 19:18:37 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2010-05-11 20:41:47 +00:00
|
|
|
#include "nsIStyleSheet.h"
|
2004-08-04 03:27:28 +00:00
|
|
|
#include "nsIDOMCSSStyleSheet.h"
|
|
|
|
#include "nsICSSLoaderObserver.h"
|
2005-10-15 20:21:20 +00:00
|
|
|
#include "nsCOMArray.h"
|
2011-10-28 07:35:45 +00:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2012-08-28 17:10:08 +00:00
|
|
|
#include "mozilla/CORSMode.h"
|
2012-10-08 02:39:08 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2013-03-17 14:42:09 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
class nsXMLNameSpaceMap;
|
|
|
|
class nsCSSRuleProcessor;
|
|
|
|
class nsIPrincipal;
|
2004-08-04 03:27:28 +00:00
|
|
|
class nsIURI;
|
2005-03-30 00:36:57 +00:00
|
|
|
class nsMediaList;
|
2008-07-26 16:14:48 +00:00
|
|
|
class nsMediaQueryResultCacheKey;
|
2008-09-09 18:08:11 +00:00
|
|
|
class nsCSSStyleSheet;
|
2010-04-10 20:10:12 +00:00
|
|
|
class nsPresContext;
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
2011-04-08 01:23:46 +00:00
|
|
|
class Rule;
|
2010-08-08 05:28:33 +00:00
|
|
|
class GroupRule;
|
2011-03-17 17:41:52 +00:00
|
|
|
class ImportRule;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
// -------------------------------
|
|
|
|
// CSS Style Sheet Inner Data Container
|
|
|
|
//
|
|
|
|
|
|
|
|
class nsCSSStyleSheetInner {
|
|
|
|
public:
|
2010-01-07 13:51:16 +00:00
|
|
|
friend class nsCSSStyleSheet;
|
|
|
|
friend class nsCSSRuleProcessor;
|
|
|
|
private:
|
2012-08-28 17:10:08 +00:00
|
|
|
nsCSSStyleSheetInner(nsCSSStyleSheet* aPrimarySheet,
|
|
|
|
mozilla::CORSMode aCORSMode);
|
2008-09-09 18:32:27 +00:00
|
|
|
nsCSSStyleSheetInner(nsCSSStyleSheetInner& aCopy,
|
|
|
|
nsCSSStyleSheet* aPrimarySheet);
|
2008-10-15 20:24:45 +00:00
|
|
|
~nsCSSStyleSheetInner();
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2008-10-15 20:24:45 +00:00
|
|
|
nsCSSStyleSheetInner* CloneFor(nsCSSStyleSheet* aPrimarySheet);
|
2010-05-11 20:41:47 +00:00
|
|
|
void AddSheet(nsCSSStyleSheet* aSheet);
|
|
|
|
void RemoveSheet(nsCSSStyleSheet* aSheet);
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2008-10-15 20:24:45 +00:00
|
|
|
void RebuildNameSpaces();
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2008-10-15 20:23:21 +00:00
|
|
|
// Create a new namespace map
|
|
|
|
nsresult CreateNamespaceMap();
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
nsAutoTArray<nsCSSStyleSheet*, 8> mSheets;
|
2004-09-10 06:45:59 +00:00
|
|
|
nsCOMPtr<nsIURI> mSheetURI; // for error reports, etc.
|
2007-10-23 21:56:41 +00:00
|
|
|
nsCOMPtr<nsIURI> mOriginalSheetURI; // for GetHref. Can be null.
|
2004-09-10 06:45:59 +00:00
|
|
|
nsCOMPtr<nsIURI> mBaseURI; // for resolving relative URIs
|
2007-05-01 19:26:15 +00:00
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2011-04-08 01:23:46 +00:00
|
|
|
nsCOMArray<mozilla::css::Rule> mOrderedRules;
|
2005-02-19 00:10:38 +00:00
|
|
|
nsAutoPtr<nsXMLNameSpaceMap> mNameSpaceMap;
|
2008-09-09 18:08:11 +00:00
|
|
|
// Linked list of child sheets. This is al fundamentally broken, because
|
|
|
|
// each of the child sheets has a unique parent... We can only hope (and
|
|
|
|
// currently this is the case) that any time page JS can get ts hands on a
|
|
|
|
// child sheet that means we've already ensured unique inners throughout its
|
|
|
|
// parent chain and things are good.
|
|
|
|
nsRefPtr<nsCSSStyleSheet> mFirstChild;
|
2012-08-28 17:10:08 +00:00
|
|
|
mozilla::CORSMode mCORSMode;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mComplete;
|
2007-05-01 19:26:15 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mPrincipalSet;
|
2007-05-01 19:26:15 +00:00
|
|
|
#endif
|
2004-08-04 03:27:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------
|
|
|
|
// CSS Style Sheet
|
|
|
|
//
|
|
|
|
|
|
|
|
class CSSRuleListImpl;
|
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
// CID for the nsCSSStyleSheet class
|
2010-05-18 04:00:39 +00:00
|
|
|
// ca926f30-2a7e-477e-8467-803fb32af20a
|
2010-05-11 20:41:47 +00:00
|
|
|
#define NS_CSS_STYLE_SHEET_IMPL_CID \
|
2010-05-18 04:00:39 +00:00
|
|
|
{ 0xca926f30, 0x2a7e, 0x477e, \
|
|
|
|
{ 0x84, 0x67, 0x80, 0x3f, 0xb3, 0x2a, 0xf2, 0x0a } }
|
2010-05-11 20:41:47 +00:00
|
|
|
|
|
|
|
|
2011-12-19 18:48:15 +00:00
|
|
|
class nsCSSStyleSheet MOZ_FINAL : public nsIStyleSheet,
|
|
|
|
public nsIDOMCSSStyleSheet,
|
2013-03-17 14:42:09 +00:00
|
|
|
public nsICSSLoaderObserver,
|
|
|
|
public nsWrapperCache
|
2004-08-04 03:27:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-08-28 17:10:08 +00:00
|
|
|
nsCSSStyleSheet(mozilla::CORSMode aCORSMode);
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2012-10-08 02:39:08 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2013-03-17 14:42:09 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSStyleSheet,
|
|
|
|
nsIStyleSheet)
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_STYLE_SHEET_IMPL_CID)
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
// nsIStyleSheet interface
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsIURI* GetSheetURI() const MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsIURI* GetBaseURI() const MOZ_OVERRIDE;
|
|
|
|
virtual void GetTitle(nsString& aTitle) const MOZ_OVERRIDE;
|
|
|
|
virtual void GetType(nsString& aType) const MOZ_OVERRIDE;
|
|
|
|
virtual bool HasRules() const MOZ_OVERRIDE;
|
|
|
|
virtual bool IsApplicable() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetEnabled(bool aEnabled) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsComplete() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetComplete() MOZ_OVERRIDE;
|
|
|
|
virtual nsIStyleSheet* GetParentSheet() const MOZ_OVERRIDE; // may be null
|
|
|
|
virtual nsIDocument* GetOwningDocument() const MOZ_OVERRIDE; // may be null
|
|
|
|
virtual void SetOwningDocument(nsIDocument* aDocument) MOZ_OVERRIDE;
|
2010-12-20 16:21:59 +00:00
|
|
|
|
2011-08-24 20:44:35 +00:00
|
|
|
// Find the ID of the owner inner window.
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t FindOwningWindowInnerID() const;
|
2004-08-04 03:27:28 +00:00
|
|
|
#ifdef DEBUG
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2004-08-04 03:27:28 +00:00
|
|
|
#endif
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2010-05-11 20:41:48 +00:00
|
|
|
void AppendStyleSheet(nsCSSStyleSheet* aSheet);
|
2012-08-22 15:56:38 +00:00
|
|
|
void InsertStyleSheetAt(nsCSSStyleSheet* aSheet, int32_t aIndex);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
// XXX do these belong here or are they generic?
|
2011-04-08 01:23:46 +00:00
|
|
|
void PrependStyleRule(mozilla::css::Rule* aRule);
|
|
|
|
void AppendStyleRule(mozilla::css::Rule* aRule);
|
|
|
|
void ReplaceStyleRule(mozilla::css::Rule* aOld, mozilla::css::Rule* aNew);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t StyleRuleCount() const;
|
2013-07-07 20:23:13 +00:00
|
|
|
mozilla::css::Rule* GetStyleRuleAt(int32_t aIndex) const;
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult DeleteRuleFromGroup(mozilla::css::GroupRule* aGroup, uint32_t aIndex);
|
|
|
|
nsresult InsertRuleIntoGroup(const nsAString& aRule, mozilla::css::GroupRule* aGroup, uint32_t aIndex, uint32_t* _retval);
|
2011-04-08 01:23:46 +00:00
|
|
|
nsresult ReplaceRuleInGroup(mozilla::css::GroupRule* aGroup, mozilla::css::Rule* aOld, mozilla::css::Rule* aNew);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t StyleSheetCount() const;
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SetURIs must be called on all sheets before parsing into them.
|
|
|
|
* SetURIs may only be called while the sheet is 1) incomplete and 2)
|
|
|
|
* has no rules in it
|
|
|
|
*/
|
2010-05-11 20:41:48 +00:00
|
|
|
void SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI, nsIURI* aBaseURI);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SetPrincipal should be called on all sheets before parsing into them.
|
|
|
|
* This can only be called once with a non-null principal. Calling this with
|
|
|
|
* a null pointer is allowed and is treated as a no-op.
|
|
|
|
*/
|
2010-05-11 20:41:48 +00:00
|
|
|
void SetPrincipal(nsIPrincipal* aPrincipal);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
// Principal() never returns a null pointer.
|
2010-05-18 04:00:39 +00:00
|
|
|
nsIPrincipal* Principal() const { return mInner->mPrincipal; }
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2012-08-06 02:14:52 +00:00
|
|
|
// The document this style sheet is associated with. May be null
|
|
|
|
nsIDocument* GetDocument() const { return mDocument; }
|
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
void SetTitle(const nsAString& aTitle) { mTitle = aTitle; }
|
2010-05-11 20:41:48 +00:00
|
|
|
void SetMedia(nsMediaList* aMedia);
|
2013-03-17 14:42:59 +00:00
|
|
|
void SetOwningNode(nsINode* aOwningNode) { mOwningNode = aOwningNode; /* Not ref counted */ }
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
void SetOwnerRule(mozilla::css::ImportRule* aOwnerRule) { mOwnerRule = aOwnerRule; /* Not ref counted */ }
|
|
|
|
mozilla::css::ImportRule* GetOwnerRule() const { return mOwnerRule; }
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2010-05-18 04:00:39 +00:00
|
|
|
nsXMLNameSpaceMap* GetNameSpaceMap() const { return mInner->mNameSpaceMap; }
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2010-05-11 20:41:48 +00:00
|
|
|
already_AddRefed<nsCSSStyleSheet> Clone(nsCSSStyleSheet* aCloneParent,
|
2011-03-17 17:41:52 +00:00
|
|
|
mozilla::css::ImportRule* aCloneOwnerRule,
|
2010-05-11 20:41:48 +00:00
|
|
|
nsIDocument* aCloneDocument,
|
2013-03-17 14:42:59 +00:00
|
|
|
nsINode* aCloneOwningNode) const;
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsModified() const { return mDirty; }
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
void SetModifiedByChildRule() {
|
|
|
|
NS_ASSERTION(mDirty,
|
|
|
|
"sheet must be marked dirty before handing out child rules");
|
|
|
|
DidDirty();
|
|
|
|
}
|
2010-05-11 20:59:25 +00:00
|
|
|
|
2010-05-11 20:41:48 +00:00
|
|
|
nsresult AddRuleProcessor(nsCSSRuleProcessor* aProcessor);
|
|
|
|
nsresult DropRuleProcessor(nsCSSRuleProcessor* aProcessor);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Like the DOM insertRule() method, but doesn't do any security checks
|
|
|
|
*/
|
2010-05-11 20:41:48 +00:00
|
|
|
nsresult InsertRuleInternal(const nsAString& aRule,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aIndex, uint32_t* aReturn);
|
2010-05-11 20:59:25 +00:00
|
|
|
|
|
|
|
/* Get the URI this sheet was originally loaded from, if any. Can
|
|
|
|
return null */
|
2010-05-11 20:41:47 +00:00
|
|
|
virtual nsIURI* GetOriginalURI() const;
|
2004-08-04 03:27:28 +00:00
|
|
|
|
|
|
|
// nsICSSLoaderObserver interface
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
|
2013-05-14 16:33:23 +00:00
|
|
|
nsresult aStatus) MOZ_OVERRIDE;
|
2009-12-31 15:56:33 +00:00
|
|
|
|
|
|
|
enum EnsureUniqueInnerResult {
|
|
|
|
// No work was needed to ensure a unique inner.
|
|
|
|
eUniqueInner_AlreadyUnique,
|
|
|
|
// A clone was done to ensure a unique inner (which means the style
|
|
|
|
// rules in this sheet have changed).
|
2013-11-11 08:00:18 +00:00
|
|
|
eUniqueInner_ClonedInner
|
2009-12-31 15:56:33 +00:00
|
|
|
};
|
|
|
|
EnsureUniqueInnerResult EnsureUniqueInner();
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2013-11-11 07:59:58 +00:00
|
|
|
// Append all of this sheet's child sheets to aArray.
|
|
|
|
void AppendAllChildSheets(nsTArray<nsCSSStyleSheet*>& aArray);
|
2009-12-31 15:56:33 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool UseForPresentation(nsPresContext* aPresContext,
|
2008-07-26 16:14:48 +00:00
|
|
|
nsMediaQueryResultCacheKey& aKey) const;
|
|
|
|
|
2012-06-03 16:54:38 +00:00
|
|
|
nsresult ParseSheet(const nsAString& aInput);
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
// nsIDOMStyleSheet interface
|
|
|
|
NS_DECL_NSIDOMSTYLESHEET
|
|
|
|
|
|
|
|
// nsIDOMCSSStyleSheet interface
|
|
|
|
NS_DECL_NSIDOMCSSSTYLESHEET
|
|
|
|
|
2009-05-26 19:40:49 +00:00
|
|
|
// Function used as a callback to rebuild our inner's child sheet
|
|
|
|
// list after we clone a unique inner for ourselves.
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool RebuildChildList(mozilla::css::Rule* aRule, void* aBuilder);
|
2009-05-26 19:40:49 +00:00
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2012-08-28 17:10:08 +00:00
|
|
|
// Get this style sheet's CORS mode
|
|
|
|
mozilla::CORSMode GetCORSMode() const { return mInner->mCORSMode; }
|
|
|
|
|
2013-01-08 23:25:47 +00:00
|
|
|
mozilla::dom::Element* GetScopeElement() const { return mScopeElement; }
|
|
|
|
void SetScopeElement(mozilla::dom::Element* aScopeElement)
|
|
|
|
{
|
|
|
|
mScopeElement = aScopeElement;
|
|
|
|
}
|
|
|
|
|
2013-03-17 14:42:59 +00:00
|
|
|
// WebIDL StyleSheet API
|
|
|
|
// Our nsIStyleSheet::GetType is a const method, so it ends up
|
|
|
|
// ambiguous with with the XPCOM version. Just disambiguate.
|
|
|
|
void GetType(nsString& aType) {
|
|
|
|
const_cast<const nsCSSStyleSheet*>(this)->GetType(aType);
|
|
|
|
}
|
|
|
|
// Our XPCOM GetHref is fine for WebIDL
|
|
|
|
nsINode* GetOwnerNode() const { return mOwningNode; }
|
|
|
|
nsCSSStyleSheet* GetParentStyleSheet() const { return mParent; }
|
|
|
|
// Our nsIStyleSheet::GetTitle is a const method, so it ends up
|
|
|
|
// ambiguous with with the XPCOM version. Just disambiguate.
|
|
|
|
void GetTitle(nsString& aTitle) {
|
|
|
|
const_cast<const nsCSSStyleSheet*>(this)->GetTitle(aTitle);
|
|
|
|
}
|
2013-11-11 08:03:17 +00:00
|
|
|
nsMediaList* Media();
|
2013-03-17 14:42:59 +00:00
|
|
|
bool Disabled() const { return mDisabled; }
|
|
|
|
// The XPCOM SetDisabled is fine for WebIDL
|
|
|
|
|
|
|
|
// WebIDL CSSStyleSheet API
|
|
|
|
// Can't be inline because we can't include ImportRule here. And can't be
|
|
|
|
// called GetOwnerRule because that would be ambiguous with the ImportRule
|
|
|
|
// version.
|
|
|
|
nsIDOMCSSRule* GetDOMOwnerRule() const;
|
|
|
|
nsIDOMCSSRuleList* GetCssRules(mozilla::ErrorResult& aRv);
|
|
|
|
uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
|
|
|
|
mozilla::ErrorResult& aRv) {
|
|
|
|
uint32_t retval;
|
|
|
|
aRv = InsertRule(aRule, aIndex, &retval);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
void DeleteRule(uint32_t aIndex, mozilla::ErrorResult& aRv) {
|
|
|
|
aRv = DeleteRule(aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
// WebIDL miscellaneous bits
|
|
|
|
mozilla::dom::ParentObject GetParentObject() const {
|
|
|
|
if (mOwningNode) {
|
|
|
|
return mozilla::dom::ParentObject(mOwningNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mozilla::dom::ParentObject(static_cast<nsIStyleSheet*>(mParent),
|
|
|
|
mParent);
|
|
|
|
}
|
2013-04-25 16:29:54 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
2013-03-17 14:42:59 +00:00
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
private:
|
|
|
|
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy,
|
2010-05-11 20:41:47 +00:00
|
|
|
nsCSSStyleSheet* aParentToUse,
|
2011-03-17 17:41:52 +00:00
|
|
|
mozilla::css::ImportRule* aOwnerRuleToUse,
|
2004-08-04 03:27:28 +00:00
|
|
|
nsIDocument* aDocumentToUse,
|
2013-03-17 14:42:59 +00:00
|
|
|
nsINode* aOwningNodeToUse);
|
2010-05-11 20:41:47 +00:00
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
nsCSSStyleSheet(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
|
|
|
|
nsCSSStyleSheet& operator=(const nsCSSStyleSheet& aCopy) MOZ_DELETE;
|
2004-08-04 03:27:28 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsCSSStyleSheet();
|
|
|
|
|
|
|
|
void ClearRuleCascades();
|
|
|
|
|
2013-11-11 08:00:46 +00:00
|
|
|
void WillDirty();
|
2004-08-04 03:27:28 +00:00
|
|
|
void DidDirty();
|
|
|
|
|
2007-07-03 18:45:39 +00:00
|
|
|
// Return success if the subject principal subsumes the principal of our
|
|
|
|
// inner, error otherwise. This will also succeed if the subject has
|
2012-08-28 17:10:09 +00:00
|
|
|
// UniversalXPConnect or if access is allowed by CORS. In the latter case,
|
|
|
|
// it will set the principal of the inner to the subject principal.
|
|
|
|
nsresult SubjectSubsumesInnerPrincipal();
|
2007-07-03 18:45:39 +00:00
|
|
|
|
2008-10-15 20:23:21 +00:00
|
|
|
// Add the namespace mapping from this @namespace rule to our namespace map
|
2011-04-08 01:23:46 +00:00
|
|
|
nsresult RegisterNamespaceRule(mozilla::css::Rule* aRule);
|
2008-10-15 20:23:21 +00:00
|
|
|
|
2012-10-08 02:39:08 +00:00
|
|
|
// Drop our reference to mRuleCollection
|
|
|
|
void DropRuleCollection();
|
|
|
|
|
|
|
|
// Drop our reference to mMedia
|
|
|
|
void DropMedia();
|
|
|
|
|
|
|
|
// Unlink our inner, if needed, for cycle collection
|
|
|
|
void UnlinkInner();
|
|
|
|
// Traverse our inner, if needed, for cycle collection
|
|
|
|
void TraverseInner(nsCycleCollectionTraversalCallback &);
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
protected:
|
|
|
|
nsString mTitle;
|
2010-05-11 20:41:47 +00:00
|
|
|
nsRefPtr<nsMediaList> mMedia;
|
2008-09-09 18:08:11 +00:00
|
|
|
nsRefPtr<nsCSSStyleSheet> mNext;
|
2010-05-11 20:41:47 +00:00
|
|
|
nsCSSStyleSheet* mParent; // weak ref
|
2011-03-17 17:41:52 +00:00
|
|
|
mozilla::css::ImportRule* mOwnerRule; // weak ref
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2012-11-12 19:19:01 +00:00
|
|
|
nsRefPtr<CSSRuleListImpl> mRuleCollection;
|
2004-08-04 03:27:28 +00:00
|
|
|
nsIDocument* mDocument; // weak ref; parents maintain this for their children
|
2013-03-17 14:42:59 +00:00
|
|
|
nsINode* mOwningNode; // weak ref
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mDisabled;
|
|
|
|
bool mDirty; // has been modified
|
2013-01-08 23:25:47 +00:00
|
|
|
nsRefPtr<mozilla::dom::Element> mScopeElement;
|
2004-08-04 03:27:28 +00:00
|
|
|
|
|
|
|
nsCSSStyleSheetInner* mInner;
|
|
|
|
|
2009-02-03 14:42:18 +00:00
|
|
|
nsAutoTArray<nsCSSRuleProcessor*, 8>* mRuleProcessors;
|
2004-08-04 03:27:28 +00:00
|
|
|
|
2005-03-30 00:36:57 +00:00
|
|
|
friend class nsMediaList;
|
2008-10-07 22:10:19 +00:00
|
|
|
friend class nsCSSRuleProcessor;
|
2008-09-09 18:08:11 +00:00
|
|
|
friend struct ChildSheetListBuilder;
|
2004-08-04 03:27:28 +00:00
|
|
|
};
|
|
|
|
|
2010-05-11 20:41:47 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsCSSStyleSheet, NS_CSS_STYLE_SHEET_IMPL_CID)
|
|
|
|
|
2004-08-04 03:27:28 +00:00
|
|
|
#endif /* !defined(nsCSSStyleSheet_h_) */
|