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