2004-08-05 18:26:14 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
// vim:cindent:ts=2:et:sw=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/. */
|
2006-03-25 05:47:31 +00:00
|
|
|
|
|
|
|
/* rules in a CSS stylesheet other than style rules (e.g., @import rules) */
|
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
#ifndef nsCSSRules_h_
|
|
|
|
#define nsCSSRules_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"
|
2010-08-08 05:28:33 +00:00
|
|
|
#include "mozilla/css/GroupRule.h"
|
2012-08-02 00:32:12 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2012-11-27 05:30:30 +00:00
|
|
|
#include "nsIDOMCSSConditionRule.h"
|
2012-08-02 00:32:12 +00:00
|
|
|
#include "nsIDOMCSSFontFaceRule.h"
|
2013-05-20 02:59:20 +00:00
|
|
|
#include "nsIDOMCSSFontFeatureValuesRule.h"
|
2012-11-27 05:30:30 +00:00
|
|
|
#include "nsIDOMCSSGroupingRule.h"
|
2004-08-05 18:26:14 +00:00
|
|
|
#include "nsIDOMCSSMediaRule.h"
|
|
|
|
#include "nsIDOMCSSMozDocumentRule.h"
|
2012-08-02 00:32:12 +00:00
|
|
|
#include "nsIDOMCSSSupportsRule.h"
|
2011-04-12 06:18:43 +00:00
|
|
|
#include "nsIDOMMozCSSKeyframeRule.h"
|
|
|
|
#include "nsIDOMMozCSSKeyframesRule.h"
|
2008-08-07 23:15:40 +00:00
|
|
|
#include "nsIDOMCSSStyleDeclaration.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCSSProperty.h"
|
|
|
|
#include "nsCSSValue.h"
|
2010-08-08 05:34:19 +00:00
|
|
|
#include "nsIDOMCSSCharsetRule.h"
|
2011-04-12 06:18:43 +00:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsDOMCSSDeclaration.h"
|
|
|
|
#include "Declaration.h"
|
2012-08-31 21:21:28 +00:00
|
|
|
#include "nsIDOMCSSPageRule.h"
|
|
|
|
#include "StyleRule.h"
|
2013-05-20 02:59:20 +00:00
|
|
|
#include "gfxFontFeatures.h"
|
2004-08-05 18:26:14 +00:00
|
|
|
|
2005-03-30 00:36:57 +00:00
|
|
|
class nsMediaList;
|
2004-08-05 18:26:14 +00:00
|
|
|
|
2011-03-18 05:18:08 +00:00
|
|
|
namespace mozilla {
|
2013-03-03 00:31:48 +00:00
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
2011-03-18 05:18:08 +00:00
|
|
|
namespace css {
|
|
|
|
|
2011-12-19 18:48:15 +00:00
|
|
|
class MediaRule MOZ_FINAL : public GroupRule,
|
|
|
|
public nsIDOMCSSMediaRule
|
2004-08-05 18:26:14 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-03-18 05:18:08 +00:00
|
|
|
MediaRule();
|
|
|
|
private:
|
|
|
|
MediaRule(const MediaRule& aCopy);
|
|
|
|
~MediaRule();
|
|
|
|
public:
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2004-08-05 18:26:14 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2010-08-08 05:28:33 +00:00
|
|
|
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet); //override GroupRule
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetType() const;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<Rule> Clone() const;
|
2011-04-08 06:36:09 +00:00
|
|
|
virtual nsIDOMCSSRule* GetDOMRule()
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2012-10-08 02:39:08 +00:00
|
|
|
virtual nsIDOMCSSRule* GetExistingDOMRule()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
2012-11-27 05:30:30 +00:00
|
|
|
// nsIDOMCSSGroupingRule interface
|
|
|
|
NS_DECL_NSIDOMCSSGROUPINGRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
// nsIDOMCSSMediaRule interface
|
|
|
|
NS_DECL_NSIDOMCSSMEDIARULE
|
|
|
|
|
2010-08-08 05:28:33 +00:00
|
|
|
// rest of GroupRule
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2010-08-08 05:29:28 +00:00
|
|
|
nsMediaQueryResultCacheKey& aKey);
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
// @media rule methods
|
2005-03-30 00:36:57 +00:00
|
|
|
nsresult SetMedia(nsMediaList* aMedia);
|
2004-08-05 18:26:14 +00:00
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2013-03-24 02:14:43 +00:00
|
|
|
const MOZ_MUST_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
protected:
|
2012-11-27 05:30:30 +00:00
|
|
|
void AppendConditionText(nsAString& aOutput);
|
|
|
|
|
2008-08-07 23:15:40 +00:00
|
|
|
nsRefPtr<nsMediaList> mMedia;
|
2004-08-05 18:26:14 +00:00
|
|
|
};
|
|
|
|
|
2011-12-19 18:48:15 +00:00
|
|
|
class DocumentRule MOZ_FINAL : public GroupRule,
|
|
|
|
public nsIDOMCSSMozDocumentRule
|
2004-08-05 18:26:14 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-03-18 05:18:08 +00:00
|
|
|
DocumentRule();
|
|
|
|
private:
|
|
|
|
DocumentRule(const DocumentRule& aCopy);
|
|
|
|
~DocumentRule();
|
|
|
|
public:
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2004-08-05 18:26:14 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetType() const;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<Rule> Clone() const;
|
2011-04-08 06:36:09 +00:00
|
|
|
virtual nsIDOMCSSRule* GetDOMRule()
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2012-10-08 02:39:08 +00:00
|
|
|
virtual nsIDOMCSSRule* GetExistingDOMRule()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
2012-11-27 05:30:30 +00:00
|
|
|
// nsIDOMCSSGroupingRule interface
|
|
|
|
NS_DECL_NSIDOMCSSGROUPINGRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
// nsIDOMCSSMozDocumentRule interface
|
|
|
|
NS_DECL_NSIDOMCSSMOZDOCUMENTRULE
|
|
|
|
|
2010-08-08 05:28:33 +00:00
|
|
|
// rest of GroupRule
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2010-08-08 05:29:28 +00:00
|
|
|
nsMediaQueryResultCacheKey& aKey);
|
2004-08-05 18:26:14 +00:00
|
|
|
|
|
|
|
enum Function {
|
|
|
|
eURL,
|
|
|
|
eURLPrefix,
|
2011-04-28 17:21:37 +00:00
|
|
|
eDomain,
|
|
|
|
eRegExp
|
2004-08-05 18:26:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct URL {
|
2004-08-05 18:44:42 +00:00
|
|
|
Function func;
|
2004-08-05 18:26:14 +00:00
|
|
|
nsCString url;
|
|
|
|
URL *next;
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
URL() : next(nullptr) {}
|
2004-08-05 18:26:14 +00:00
|
|
|
URL(const URL& aOther)
|
|
|
|
: func(aOther.func)
|
|
|
|
, url(aOther.url)
|
2012-07-30 14:20:58 +00:00
|
|
|
, next(aOther.next ? new URL(*aOther.next) : nullptr)
|
2004-08-05 18:26:14 +00:00
|
|
|
{
|
|
|
|
}
|
2009-01-16 23:33:57 +00:00
|
|
|
~URL();
|
2004-08-05 18:26:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void SetURLs(URL *aURLs) { mURLs = aURLs; }
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2013-03-24 02:14:43 +00:00
|
|
|
const MOZ_MUST_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
protected:
|
2012-11-27 05:30:30 +00:00
|
|
|
void AppendConditionText(nsAString& aOutput);
|
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
nsAutoPtr<URL> mURLs; // linked list of |struct URL| above.
|
|
|
|
};
|
|
|
|
|
2011-03-18 05:18:08 +00:00
|
|
|
} // namespace css
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2008-08-07 23:15:40 +00:00
|
|
|
// A nsCSSFontFaceStyleDecl is always embedded in a nsCSSFontFaceRule.
|
|
|
|
class nsCSSFontFaceRule;
|
2012-08-06 02:14:47 +00:00
|
|
|
class nsCSSFontFaceStyleDecl : public nsICSSDeclaration
|
2008-08-07 23:15:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-10-01 16:49:41 +00:00
|
|
|
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
|
2012-08-06 02:14:47 +00:00
|
|
|
NS_DECL_NSICSSDECLARATION
|
2012-10-01 16:49:41 +00:00
|
|
|
virtual already_AddRefed<mozilla::dom::CSSValue>
|
|
|
|
GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
|
|
|
|
MOZ_OVERRIDE;
|
|
|
|
using nsICSSDeclaration::GetPropertyCSSValue;
|
2012-08-06 02:14:47 +00:00
|
|
|
|
2012-08-24 04:08:09 +00:00
|
|
|
nsCSSFontFaceStyleDecl()
|
|
|
|
{
|
|
|
|
SetIsDOMBinding();
|
|
|
|
}
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsINode *GetParentObject() MOZ_OVERRIDE;
|
|
|
|
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) MOZ_OVERRIDE;
|
2008-08-07 23:15:40 +00:00
|
|
|
|
|
|
|
nsresult GetPropertyValue(nsCSSFontDesc aFontDescID,
|
2012-07-06 20:14:07 +00:00
|
|
|
nsAString & aResult) const;
|
2008-08-07 23:15:40 +00:00
|
|
|
|
2013-04-25 16:29:54 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx,
|
|
|
|
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
|
2012-08-24 04:08:09 +00:00
|
|
|
|
2008-08-07 23:15:40 +00:00
|
|
|
protected:
|
|
|
|
friend class nsCSSFontFaceRule;
|
2011-12-20 16:49:16 +00:00
|
|
|
#define CSS_FONT_DESC(name_, method_) nsCSSValue m##method_;
|
|
|
|
#include "nsCSSFontDescList.h"
|
|
|
|
#undef CSS_FONT_DESC
|
2008-08-07 23:15:40 +00:00
|
|
|
|
2013-05-20 02:59:20 +00:00
|
|
|
static nsCSSValue nsCSSFontFaceStyleDecl::* const Fields[];
|
2008-08-07 23:15:40 +00:00
|
|
|
inline nsCSSFontFaceRule* ContainingRule();
|
|
|
|
inline const nsCSSFontFaceRule* ContainingRule() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// NOT TO BE IMPLEMENTED
|
|
|
|
// This object cannot be allocated on its own, only as part of
|
|
|
|
// nsCSSFontFaceRule.
|
|
|
|
void* operator new(size_t size) CPP_THROW_NEW;
|
|
|
|
};
|
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
class nsCSSFontFaceRule MOZ_FINAL : public mozilla::css::Rule,
|
|
|
|
public nsIDOMCSSFontFaceRule
|
2008-08-07 23:15:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-10-07 04:25:47 +00:00
|
|
|
nsCSSFontFaceRule() {}
|
|
|
|
|
|
|
|
nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
|
|
|
|
// copy everything except our reference count
|
2011-03-07 03:59:03 +00:00
|
|
|
: mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl) {}
|
2010-10-07 04:25:47 +00:00
|
|
|
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSFontFaceRule,
|
|
|
|
mozilla::css::Rule)
|
2008-08-07 23:15:40 +00:00
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2008-08-07 23:15:40 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2008-08-07 23:15:40 +00:00
|
|
|
DECL_STYLE_RULE_INHERIT
|
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual int32_t GetType() const MOZ_OVERRIDE;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const;
|
2008-08-07 23:15:40 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSFontFaceRule interface
|
|
|
|
NS_DECL_NSIDOMCSSFONTFACERULE
|
|
|
|
|
|
|
|
void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue);
|
|
|
|
void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue);
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2008-08-07 23:15:40 +00:00
|
|
|
protected:
|
|
|
|
friend class nsCSSFontFaceStyleDecl;
|
|
|
|
nsCSSFontFaceStyleDecl mDecl;
|
|
|
|
};
|
|
|
|
|
2013-05-20 02:59:20 +00:00
|
|
|
// nsFontFaceRuleContainer - used for associating sheet type with
|
2008-11-27 03:50:16 +00:00
|
|
|
// specific @font-face rules
|
|
|
|
struct nsFontFaceRuleContainer {
|
|
|
|
nsRefPtr<nsCSSFontFaceRule> mRule;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mSheetType;
|
2008-11-27 03:50:16 +00:00
|
|
|
};
|
|
|
|
|
2008-08-07 23:15:40 +00:00
|
|
|
inline nsCSSFontFaceRule*
|
|
|
|
nsCSSFontFaceStyleDecl::ContainingRule()
|
|
|
|
{
|
|
|
|
return reinterpret_cast<nsCSSFontFaceRule*>
|
|
|
|
(reinterpret_cast<char*>(this) - offsetof(nsCSSFontFaceRule, mDecl));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const nsCSSFontFaceRule*
|
|
|
|
nsCSSFontFaceStyleDecl::ContainingRule() const
|
|
|
|
{
|
|
|
|
return reinterpret_cast<const nsCSSFontFaceRule*>
|
|
|
|
(reinterpret_cast<const char*>(this) - offsetof(nsCSSFontFaceRule, mDecl));
|
|
|
|
}
|
2004-08-05 18:26:14 +00:00
|
|
|
|
2013-05-20 02:59:20 +00:00
|
|
|
class nsCSSFontFeatureValuesRule MOZ_FINAL :
|
|
|
|
public mozilla::css::Rule,
|
|
|
|
public nsIDOMCSSFontFeatureValuesRule
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsCSSFontFeatureValuesRule() {}
|
|
|
|
|
|
|
|
nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy)
|
|
|
|
// copy everything except our reference count
|
|
|
|
: mozilla::css::Rule(aCopy),
|
|
|
|
mFamilyList(aCopy.mFamilyList),
|
|
|
|
mFeatureValues(aCopy.mFeatureValues) {}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Rule methods
|
|
|
|
DECL_STYLE_RULE_INHERIT
|
|
|
|
|
|
|
|
virtual int32_t GetType() const MOZ_OVERRIDE;
|
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSFontFaceRule interface
|
|
|
|
NS_DECL_NSIDOMCSSFONTFEATUREVALUESRULE
|
|
|
|
|
|
|
|
const nsTArray<nsString>& GetFamilyList() { return mFamilyList; }
|
|
|
|
void SetFamilyList(const nsAString& aFamilyList, bool& aContainsGeneric);
|
|
|
|
|
|
|
|
void AddValueList(int32_t aVariantAlternate,
|
|
|
|
nsTArray<gfxFontFeatureValueSet::ValueList>& aValueList);
|
|
|
|
|
|
|
|
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& GetFeatureValues()
|
|
|
|
{
|
|
|
|
return mFeatureValues;
|
|
|
|
}
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
static bool PrefEnabled()
|
|
|
|
{
|
|
|
|
return mozilla::Preferences::GetBool("layout.css.font-features.enabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsTArray<nsString> mFamilyList;
|
|
|
|
nsTArray<gfxFontFeatureValueSet::FeatureValues> mFeatureValues;
|
|
|
|
};
|
|
|
|
|
2010-08-08 05:34:19 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
class CharsetRule MOZ_FINAL : public Rule,
|
|
|
|
public nsIDOMCSSCharsetRule
|
2010-08-08 05:34:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CharsetRule(const nsAString& aEncoding);
|
|
|
|
private:
|
|
|
|
// For |Clone|
|
|
|
|
CharsetRule(const CharsetRule& aCopy);
|
|
|
|
~CharsetRule() {}
|
|
|
|
|
|
|
|
public:
|
2012-10-08 02:39:09 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2010-08-08 05:34:19 +00:00
|
|
|
|
|
|
|
DECL_STYLE_RULE_INHERIT
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2010-08-08 05:34:19 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetType() const;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<Rule> Clone() const;
|
2010-08-08 05:34:19 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSCharsetRule methods
|
2013-05-29 19:37:49 +00:00
|
|
|
NS_IMETHOD GetEncoding(nsAString& aEncoding) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD SetEncoding(const nsAString& aEncoding) MOZ_OVERRIDE;
|
2010-08-08 05:34:19 +00:00
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2010-08-08 05:34:19 +00:00
|
|
|
private:
|
|
|
|
nsString mEncoding;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace css
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2011-04-12 06:18:43 +00:00
|
|
|
class nsCSSKeyframeRule;
|
|
|
|
|
2011-12-19 18:48:15 +00:00
|
|
|
class nsCSSKeyframeStyleDeclaration MOZ_FINAL : public nsDOMCSSDeclaration
|
2011-04-12 06:18:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsCSSKeyframeStyleDeclaration(nsCSSKeyframeRule *aRule);
|
|
|
|
virtual ~nsCSSKeyframeStyleDeclaration();
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) MOZ_OVERRIDE;
|
2012-07-30 14:20:58 +00:00
|
|
|
void DropReference() { mRule = nullptr; }
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual mozilla::css::Declaration* GetCSSDeclaration(bool aAllocate) MOZ_OVERRIDE;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) MOZ_OVERRIDE;
|
|
|
|
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) MOZ_OVERRIDE;
|
|
|
|
virtual nsIDocument* DocToUpdate() MOZ_OVERRIDE;
|
2011-04-12 06:18:43 +00:00
|
|
|
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSKeyframeStyleDeclaration,
|
|
|
|
nsICSSDeclaration)
|
2011-04-12 06:18:43 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsINode* GetParentObject() MOZ_OVERRIDE;
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// This reference is not reference-counted. The rule object tells us
|
|
|
|
// when it's about to go away.
|
|
|
|
nsCSSKeyframeRule *mRule;
|
|
|
|
};
|
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
class nsCSSKeyframeRule MOZ_FINAL : public mozilla::css::Rule,
|
|
|
|
public nsIDOMMozCSSKeyframeRule
|
2011-04-12 06:18:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// WARNING: Steals the contents of aKeys *and* aDeclaration
|
2012-11-29 16:14:14 +00:00
|
|
|
nsCSSKeyframeRule(InfallibleTArray<float>& aKeys,
|
2011-04-12 06:18:43 +00:00
|
|
|
nsAutoPtr<mozilla::css::Declaration> aDeclaration)
|
|
|
|
: mDeclaration(aDeclaration)
|
|
|
|
{
|
|
|
|
mKeys.SwapElements(aKeys);
|
|
|
|
}
|
2011-04-08 01:23:46 +00:00
|
|
|
private:
|
2011-04-12 06:18:43 +00:00
|
|
|
nsCSSKeyframeRule(const nsCSSKeyframeRule& aCopy);
|
|
|
|
~nsCSSKeyframeRule();
|
2011-04-08 01:23:46 +00:00
|
|
|
public:
|
2013-01-19 04:32:12 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCSSKeyframeRule, nsIStyleRule)
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2011-04-12 06:18:43 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2011-04-12 06:18:43 +00:00
|
|
|
DECL_STYLE_RULE_INHERIT
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual int32_t GetType() const MOZ_OVERRIDE;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const;
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMMozCSSKeyframeRule interface
|
|
|
|
NS_DECL_NSIDOMMOZCSSKEYFRAMERULE
|
|
|
|
|
|
|
|
const nsTArray<float>& GetKeys() const { return mKeys; }
|
|
|
|
mozilla::css::Declaration* Declaration() { return mDeclaration; }
|
|
|
|
|
|
|
|
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2012-11-20 19:55:14 +00:00
|
|
|
void DoGetKeyText(nsAString &aKeyText) const;
|
|
|
|
|
2011-04-12 06:18:43 +00:00
|
|
|
private:
|
2012-11-29 16:14:14 +00:00
|
|
|
nsTArray<float> mKeys;
|
2011-04-12 06:18:43 +00:00
|
|
|
nsAutoPtr<mozilla::css::Declaration> mDeclaration;
|
|
|
|
// lazily created when needed:
|
|
|
|
nsRefPtr<nsCSSKeyframeStyleDeclaration> mDOMDeclaration;
|
|
|
|
};
|
|
|
|
|
2011-12-19 18:48:15 +00:00
|
|
|
class nsCSSKeyframesRule MOZ_FINAL : public mozilla::css::GroupRule,
|
|
|
|
public nsIDOMMozCSSKeyframesRule
|
2011-04-12 06:18:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsCSSKeyframesRule(const nsSubstring& aName)
|
|
|
|
: mName(aName)
|
|
|
|
{
|
|
|
|
}
|
2011-04-08 01:23:46 +00:00
|
|
|
private:
|
2011-04-12 06:18:43 +00:00
|
|
|
nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy);
|
|
|
|
~nsCSSKeyframesRule();
|
2011-04-08 01:23:46 +00:00
|
|
|
public:
|
2011-04-12 06:18:43 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2011-04-12 06:18:43 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:23:46 +00:00
|
|
|
// Rule methods
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetType() const;
|
2011-04-08 01:23:46 +00:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const;
|
2011-04-08 06:36:09 +00:00
|
|
|
virtual nsIDOMCSSRule* GetDOMRule()
|
2011-04-12 06:18:43 +00:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2012-10-08 02:39:08 +00:00
|
|
|
virtual nsIDOMCSSRule* GetExistingDOMRule()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMMozCSSKeyframesRule interface
|
|
|
|
NS_DECL_NSIDOMMOZCSSKEYFRAMESRULE
|
|
|
|
|
|
|
|
// rest of GroupRule
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2013-05-29 19:37:49 +00:00
|
|
|
nsMediaQueryResultCacheKey& aKey) MOZ_OVERRIDE;
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
const nsString& GetName() { return mName; }
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2011-04-12 06:18:43 +00:00
|
|
|
private:
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t FindRuleIndexForKey(const nsAString& aKey);
|
2011-04-12 06:18:43 +00:00
|
|
|
|
|
|
|
nsString mName;
|
|
|
|
};
|
|
|
|
|
2012-08-31 21:21:28 +00:00
|
|
|
class nsCSSPageRule;
|
|
|
|
|
|
|
|
class nsCSSPageStyleDeclaration MOZ_FINAL : public nsDOMCSSDeclaration
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsCSSPageStyleDeclaration(nsCSSPageRule *aRule);
|
|
|
|
virtual ~nsCSSPageStyleDeclaration();
|
|
|
|
|
|
|
|
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) MOZ_OVERRIDE;
|
|
|
|
void DropReference() { mRule = nullptr; }
|
|
|
|
virtual mozilla::css::Declaration* GetCSSDeclaration(bool aAllocate) MOZ_OVERRIDE;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) MOZ_OVERRIDE;
|
|
|
|
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) MOZ_OVERRIDE;
|
|
|
|
virtual nsIDocument* DocToUpdate() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSPageStyleDeclaration,
|
|
|
|
nsICSSDeclaration)
|
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsINode *GetParentObject() MOZ_OVERRIDE;
|
2012-08-31 21:21:28 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// This reference is not reference-counted. The rule object tells us
|
|
|
|
// when it's about to go away.
|
|
|
|
nsCSSPageRule *mRule;
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsCSSPageRule MOZ_FINAL : public mozilla::css::Rule,
|
|
|
|
public nsIDOMCSSPageRule
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// WARNING: Steals the contents of aDeclaration
|
|
|
|
nsCSSPageRule(nsAutoPtr<mozilla::css::Declaration> aDeclaration)
|
|
|
|
: mDeclaration(aDeclaration),
|
|
|
|
mImportantRule(nullptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
nsCSSPageRule(const nsCSSPageRule& aCopy);
|
|
|
|
~nsCSSPageRule();
|
|
|
|
public:
|
2013-06-13 22:13:13 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCSSPageRule, nsIDOMCSSPageRule)
|
2012-08-31 21:21:28 +00:00
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2012-08-31 21:21:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Rule methods
|
|
|
|
DECL_STYLE_RULE_INHERIT
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual int32_t GetType() const MOZ_OVERRIDE;
|
2012-08-31 21:21:28 +00:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const;
|
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSPageRule interface
|
|
|
|
NS_DECL_NSIDOMCSSPAGERULE
|
|
|
|
|
|
|
|
mozilla::css::Declaration* Declaration() { return mDeclaration; }
|
|
|
|
|
|
|
|
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
|
|
|
|
|
|
|
|
mozilla::css::ImportantRule* GetImportantRule();
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
2012-08-31 21:21:28 +00:00
|
|
|
private:
|
|
|
|
nsAutoPtr<mozilla::css::Declaration> mDeclaration;
|
|
|
|
// lazily created when needed:
|
|
|
|
nsRefPtr<nsCSSPageStyleDeclaration> mDOMDeclaration;
|
|
|
|
nsRefPtr<mozilla::css::ImportantRule> mImportantRule;
|
|
|
|
};
|
|
|
|
|
2012-08-02 00:32:12 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class CSSSupportsRule : public css::GroupRule,
|
|
|
|
public nsIDOMCSSSupportsRule
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CSSSupportsRule(bool aConditionMet, const nsString& aCondition);
|
|
|
|
CSSSupportsRule(const CSSSupportsRule& aCopy);
|
|
|
|
|
|
|
|
// nsIStyleRule methods
|
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2012-08-02 00:32:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Rule methods
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual int32_t GetType() const;
|
2012-08-02 00:32:12 +00:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const;
|
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
|
|
|
nsMediaQueryResultCacheKey& aKey);
|
|
|
|
virtual nsIDOMCSSRule* GetDOMRule()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2012-10-08 02:39:08 +00:00
|
|
|
virtual nsIDOMCSSRule* GetExistingDOMRule()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2012-08-02 00:32:12 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMCSSRule interface
|
|
|
|
NS_DECL_NSIDOMCSSRULE
|
|
|
|
|
2012-11-27 05:30:30 +00:00
|
|
|
// nsIDOMCSSGroupingRule interface
|
|
|
|
NS_DECL_NSIDOMCSSGROUPINGRULE
|
|
|
|
|
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2012-08-02 00:32:12 +00:00
|
|
|
// nsIDOMCSSSupportsRule interface
|
|
|
|
NS_DECL_NSIDOMCSSSUPPORTSRULE
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2012-08-02 00:32:12 +00:00
|
|
|
|
|
|
|
static bool PrefEnabled()
|
|
|
|
{
|
|
|
|
return Preferences::GetBool("layout.css.supports-rule.enabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool mUseGroup;
|
|
|
|
nsString mCondition;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2004-08-05 18:26:14 +00:00
|
|
|
#endif /* !defined(nsCSSRules_h_) */
|