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