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_
|
|
|
|
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "Declaration.h"
|
|
|
|
#include "StyleRule.h"
|
|
|
|
#include "gfxFontFeatures.h"
|
2011-11-21 10:21:16 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "mozilla/Move.h"
|
|
|
|
#include "mozilla/SheetType.h"
|
2010-08-08 09:28:33 +04:00
|
|
|
#include "mozilla/css/GroupRule.h"
|
2017-04-18 19:59:43 +03:00
|
|
|
#include "mozilla/css/URLMatchingFunction.h"
|
2017-05-19 09:12:34 +03:00
|
|
|
#include "mozilla/dom/CSSKeyframeRule.h"
|
|
|
|
#include "mozilla/dom/CSSKeyframesRule.h"
|
2017-03-09 09:37:38 +03:00
|
|
|
#include "mozilla/dom/CSSMediaRule.h"
|
2017-04-01 03:14:49 +03:00
|
|
|
#include "mozilla/dom/CSSPageRule.h"
|
2017-04-26 11:55:36 +03:00
|
|
|
#include "mozilla/dom/CSSSupportsRule.h"
|
2017-05-11 15:11:15 +03:00
|
|
|
#include "mozilla/dom/CSSMozDocumentRule.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2016-08-17 04:37:48 +03:00
|
|
|
#include "nsCSSPropertyID.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "nsCSSValue.h"
|
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2012-11-27 09:30:30 +04:00
|
|
|
#include "nsIDOMCSSConditionRule.h"
|
2013-05-20 06:59:20 +04:00
|
|
|
#include "nsIDOMCSSFontFeatureValuesRule.h"
|
2012-11-27 09:30:30 +04:00
|
|
|
#include "nsIDOMCSSGroupingRule.h"
|
2004-08-05 22:26:14 +04:00
|
|
|
#include "nsIDOMCSSMozDocumentRule.h"
|
2012-08-02 04:32:12 +04:00
|
|
|
#include "nsIDOMCSSSupportsRule.h"
|
2011-04-12 10:18:43 +04:00
|
|
|
#include "nsTArray.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 {
|
2013-03-03 04:31:48 +04:00
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
2016-11-09 09:28:24 +03:00
|
|
|
namespace dom {
|
|
|
|
class MediaList;
|
|
|
|
}
|
|
|
|
|
2011-03-18 08:18:08 +03:00
|
|
|
namespace css {
|
|
|
|
|
2017-03-09 09:37:38 +03:00
|
|
|
class MediaRule final : public dom::CSSMediaRule
|
2004-08-05 22:26:14 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 02:57:54 +04:00
|
|
|
MediaRule(uint32_t aLineNumber, uint32_t aColumnNumber);
|
2011-03-18 08:18:08 +03:00
|
|
|
private:
|
|
|
|
MediaRule(const MediaRule& aCopy);
|
|
|
|
~MediaRule();
|
|
|
|
public:
|
2004-08-05 22:26:14 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2017-03-09 09:37:38 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaRule, dom::CSSMediaRule)
|
2004-08-05 22:26:14 +04:00
|
|
|
|
2015-11-05 11:44:10 +03:00
|
|
|
// Rule methods
|
2004-08-05 22:26:14 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2004-08-05 22:26:14 +04:00
|
|
|
#endif
|
2016-11-23 02:26:20 +03:00
|
|
|
virtual void SetStyleSheet(mozilla::StyleSheet* aSheet) override; //override GroupRule
|
|
|
|
mozilla::CSSStyleSheet* GetStyleSheet() const
|
|
|
|
{
|
|
|
|
mozilla::StyleSheet* sheet = GroupRule::GetStyleSheet();
|
|
|
|
return sheet ? sheet->AsGecko() : nullptr;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<Rule> Clone() const override;
|
2017-01-15 22:50:10 +03:00
|
|
|
|
2012-11-27 09:30:30 +04:00
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2010-08-08 09:28:33 +04:00
|
|
|
// rest of GroupRule
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsMediaQueryResultCacheKey& aKey) override;
|
2004-08-05 22:26:14 +04:00
|
|
|
|
|
|
|
// @media rule methods
|
2005-03-30 04:36:57 +04:00
|
|
|
nsresult SetMedia(nsMediaList* aMedia);
|
2017-01-13 18:41:02 +03:00
|
|
|
|
|
|
|
// WebIDL interface
|
|
|
|
void GetCssTextImpl(nsAString& aCssText) const override;
|
2017-03-09 09:37:38 +03:00
|
|
|
using CSSMediaRule::SetConditionText;
|
|
|
|
dom::MediaList* Media() override;
|
2004-08-05 22:26:14 +04:00
|
|
|
|
2013-06-23 16:03:39 +04:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2015-03-21 19:28:04 +03:00
|
|
|
const override MOZ_MUST_OVERRIDE;
|
2012-01-03 06:19:14 +04:00
|
|
|
|
2004-08-05 22:26:14 +04:00
|
|
|
protected:
|
2017-01-13 18:41:02 +03:00
|
|
|
void AppendConditionText(nsAString& aOutput) const;
|
2012-11-27 09:30:30 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsMediaList> mMedia;
|
2004-08-05 22:26:14 +04:00
|
|
|
};
|
|
|
|
|
2017-05-11 15:11:15 +03:00
|
|
|
class DocumentRule final : public dom::CSSMozDocumentRule
|
2004-08-05 22:26:14 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 02:57:54 +04:00
|
|
|
DocumentRule(uint32_t aLineNumber, uint32_t aColumnNumber);
|
2011-03-18 08:18:08 +03:00
|
|
|
private:
|
|
|
|
DocumentRule(const DocumentRule& aCopy);
|
|
|
|
~DocumentRule();
|
|
|
|
public:
|
2004-08-05 22:26:14 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-11-05 11:44:10 +03:00
|
|
|
// Rule methods
|
2004-08-05 22:26:14 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2004-08-05 22:26:14 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<Rule> Clone() const override;
|
2017-01-15 22:50:10 +03:00
|
|
|
|
2012-11-27 09:30:30 +04:00
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2010-08-08 09:28:33 +04:00
|
|
|
// rest of GroupRule
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2017-04-18 19:59:43 +03:00
|
|
|
nsMediaQueryResultCacheKey& aKey) override;
|
2004-08-05 22:26:14 +04:00
|
|
|
|
2015-06-26 06:52:47 +03:00
|
|
|
bool UseForPresentation(nsPresContext* aPresContext);
|
|
|
|
|
2017-04-18 19:59:43 +03:00
|
|
|
static bool UseForPresentation(nsIDocument* aDoc,
|
|
|
|
nsIURI* aDocURI,
|
|
|
|
const nsACString& aDocURISpec,
|
|
|
|
const nsACString& aPattern,
|
|
|
|
URLMatchingFunction aUrlMatchingFunction);
|
2004-08-05 22:26:14 +04:00
|
|
|
|
|
|
|
struct URL {
|
2017-04-18 19:59:43 +03:00
|
|
|
URLMatchingFunction 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; }
|
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
// WebIDL interface
|
|
|
|
void GetCssTextImpl(nsAString& aCssText) const override;
|
2017-05-11 15:11:15 +03:00
|
|
|
using dom::CSSMozDocumentRule::SetConditionText;
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2013-06-23 16:03:39 +04:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2015-03-21 19:28:04 +03:00
|
|
|
const override MOZ_MUST_OVERRIDE;
|
2012-01-03 06:19:14 +04:00
|
|
|
|
2004-08-05 22:26:14 +04:00
|
|
|
protected:
|
2017-01-13 18:41:02 +03:00
|
|
|
void AppendConditionText(nsAString& aOutput) const;
|
2012-11-27 09:30:30 +04:00
|
|
|
|
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
|
2014-09-25 03:25:40 +04:00
|
|
|
|
2011-03-18 08:18:08 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-27 21:52:19 +03:00
|
|
|
class nsCSSFontFeatureValuesRule final : public mozilla::css::Rule,
|
|
|
|
public nsIDOMCSSFontFeatureValuesRule
|
2013-05-20 06:59:20 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 02:57:54 +04:00
|
|
|
nsCSSFontFeatureValuesRule(uint32_t aLineNumber, uint32_t aColumnNumber)
|
2017-01-13 18:41:02 +03:00
|
|
|
: mozilla::css::Rule(aLineNumber, aColumnNumber)
|
|
|
|
{
|
|
|
|
}
|
2013-05-20 06:59:20 +04:00
|
|
|
|
|
|
|
nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy)
|
|
|
|
// copy everything except our reference count
|
|
|
|
: mozilla::css::Rule(aCopy),
|
|
|
|
mFamilyList(aCopy.mFamilyList),
|
2017-01-13 18:41:02 +03:00
|
|
|
mFeatureValues(aCopy.mFeatureValues)
|
|
|
|
{
|
|
|
|
}
|
2013-05-20 06:59:20 +04:00
|
|
|
|
2016-12-01 02:18:14 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
virtual bool IsCCLeaf() const override;
|
2013-05-20 06:59:20 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2013-05-20 06:59:20 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int32_t GetType() const override;
|
2017-01-13 18:41:02 +03:00
|
|
|
using Rule::GetType;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
|
2013-05-20 06:59:20 +04:00
|
|
|
|
|
|
|
// nsIDOMCSSFontFaceRule interface
|
|
|
|
NS_DECL_NSIDOMCSSFONTFEATUREVALUESRULE
|
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
// WebIDL interface
|
|
|
|
uint16_t Type() const override;
|
|
|
|
void GetCssTextImpl(nsAString& aCssText) const override;
|
2017-01-13 18:41:04 +03:00
|
|
|
// The XPCOM GetFontFamily is fine
|
|
|
|
void SetFontFamily(const nsAString& aFamily, mozilla::ErrorResult& aRv);
|
|
|
|
// The XPCOM GetValueText is fine
|
|
|
|
void SetValueText(const nsAString& aFamily, mozilla::ErrorResult& aRv);
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2014-06-06 10:09:23 +04:00
|
|
|
const mozilla::FontFamilyList& GetFamilyList() { return mFamilyList; }
|
|
|
|
void SetFamilyList(const mozilla::FontFamilyList& aFamilyList);
|
2013-05-20 06:59:20 +04:00
|
|
|
|
|
|
|
void AddValueList(int32_t aVariantAlternate,
|
|
|
|
nsTArray<gfxFontFeatureValueSet::ValueList>& aValueList);
|
|
|
|
|
|
|
|
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& GetFeatureValues()
|
|
|
|
{
|
|
|
|
return mFeatureValues;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2013-05-20 06:59:20 +04:00
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2013-05-20 06:59:20 +04:00
|
|
|
protected:
|
2014-06-24 02:40:01 +04:00
|
|
|
~nsCSSFontFeatureValuesRule() {}
|
|
|
|
|
2014-06-06 10:09:23 +04:00
|
|
|
mozilla::FontFamilyList mFamilyList;
|
2013-05-20 06:59:20 +04:00
|
|
|
nsTArray<gfxFontFeatureValueSet::FeatureValues> mFeatureValues;
|
|
|
|
};
|
|
|
|
|
2011-04-12 10:18:43 +04:00
|
|
|
class nsCSSKeyframeRule;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsCSSKeyframeStyleDeclaration final : public nsDOMCSSDeclaration
|
2011-04-12 10:18:43 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsCSSKeyframeStyleDeclaration(nsCSSKeyframeRule *aRule);
|
2011-04-12 10:18:43 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
|
2012-07-30 18:20:58 +04:00
|
|
|
void DropReference() { mRule = nullptr; }
|
2016-11-03 06:41:02 +03:00
|
|
|
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
|
2017-05-11 19:06:43 +03:00
|
|
|
nsDOMCSSDeclaration::ServoCSSParsingEnvironment GetServoCSSParsingEnvironment() const final;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDocument* DocToUpdate() 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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsINode* GetParentObject() override;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
|
|
|
protected:
|
2014-06-24 02:40:01 +04:00
|
|
|
virtual ~nsCSSKeyframeStyleDeclaration();
|
|
|
|
|
2011-04-12 10:18:43 +04:00
|
|
|
// This reference is not reference-counted. The rule object tells us
|
|
|
|
// when it's about to go away.
|
2015-06-16 15:12:00 +03:00
|
|
|
nsCSSKeyframeRule* MOZ_NON_OWNING_REF mRule;
|
2011-04-12 10:18:43 +04:00
|
|
|
};
|
|
|
|
|
2017-05-19 09:12:34 +03:00
|
|
|
class nsCSSKeyframeRule final : public mozilla::dom::CSSKeyframeRule
|
2011-04-12 10:18:43 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-11-21 09:30:54 +03:00
|
|
|
// Steals the contents of aKeys, and takes the reference in Declaration
|
2015-11-21 09:30:54 +03:00
|
|
|
nsCSSKeyframeRule(InfallibleTArray<float>&& aKeys,
|
2015-11-21 09:30:54 +03:00
|
|
|
already_AddRefed<mozilla::css::Declaration>&& aDeclaration,
|
2014-07-15 02:57:54 +04:00
|
|
|
uint32_t aLineNumber, uint32_t aColumnNumber)
|
2017-05-19 09:12:34 +03:00
|
|
|
: mozilla::dom::CSSKeyframeRule(aLineNumber, aColumnNumber)
|
2015-11-21 09:30:54 +03:00
|
|
|
, mKeys(mozilla::Move(aKeys))
|
2015-11-21 09:30:54 +03:00
|
|
|
, mDeclaration(mozilla::Move(aDeclaration))
|
2011-04-12 10:18:43 +04:00
|
|
|
{
|
2015-11-05 11:44:08 +03:00
|
|
|
mDeclaration->SetOwningRule(this);
|
2011-04-12 10:18:43 +04:00
|
|
|
}
|
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:
|
2016-12-01 02:18:14 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2017-05-19 09:12:34 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsCSSKeyframeRule,
|
|
|
|
mozilla::dom::CSSKeyframeRule)
|
2016-12-01 02:18:14 +03:00
|
|
|
virtual bool IsCCLeaf() const override;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2011-04-12 10:18:43 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
2016-03-13 22:46:13 +03:00
|
|
|
// nsIDOMCSSKeyframeRule interface
|
2017-05-19 09:12:34 +03:00
|
|
|
NS_IMETHOD GetKeyText(nsAString& aKeyText) final;
|
|
|
|
NS_IMETHOD SetKeyText(const nsAString& aKeyText) final;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
// WebIDL interface
|
2017-05-19 09:12:34 +03:00
|
|
|
void GetCssTextImpl(nsAString& aCssText) const final;
|
|
|
|
nsICSSDeclaration* Style() final;
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2011-04-12 10:18:43 +04:00
|
|
|
const nsTArray<float>& GetKeys() const { return mKeys; }
|
|
|
|
mozilla::css::Declaration* Declaration() { return mDeclaration; }
|
|
|
|
|
|
|
|
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const 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;
|
2015-11-05 11:44:08 +03:00
|
|
|
RefPtr<mozilla::css::Declaration> mDeclaration;
|
2011-04-12 10:18:43 +04:00
|
|
|
// lazily created when needed:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsCSSKeyframeStyleDeclaration> mDOMDeclaration;
|
2011-04-12 10:18:43 +04:00
|
|
|
};
|
|
|
|
|
2017-05-19 09:12:34 +03:00
|
|
|
class nsCSSKeyframesRule final : public mozilla::dom::CSSKeyframesRule
|
2011-04-12 10:18:43 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 02:57:54 +04:00
|
|
|
nsCSSKeyframesRule(const nsSubstring& aName,
|
|
|
|
uint32_t aLineNumber, uint32_t aColumnNumber)
|
2017-05-19 09:12:34 +03:00
|
|
|
: mozilla::dom::CSSKeyframesRule(aLineNumber, aColumnNumber)
|
2014-07-15 02:57:54 +04:00
|
|
|
, mName(aName)
|
2011-04-12 10:18:43 +04:00
|
|
|
{
|
|
|
|
}
|
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
|
|
|
|
|
2015-11-05 11:44:10 +03:00
|
|
|
// Rule methods
|
2011-04-12 10:18:43 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2011-04-12 10:18:43 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
|
2017-01-15 22:50:10 +03:00
|
|
|
|
2016-03-13 22:46:13 +03:00
|
|
|
// nsIDOMCSSKeyframesRule interface
|
2017-05-19 09:12:34 +03:00
|
|
|
NS_IMETHOD GetName(nsAString& aName) final;
|
|
|
|
NS_IMETHOD SetName(const nsAString& aName) final;
|
|
|
|
NS_IMETHOD AppendRule(const nsAString& aRule) final;
|
|
|
|
NS_IMETHOD DeleteRule(const nsAString& aKey) final;
|
|
|
|
using nsIDOMCSSKeyframesRule::FindRule;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
// WebIDL interface
|
2017-05-19 09:12:34 +03:00
|
|
|
void GetCssTextImpl(nsAString& aCssText) const final;
|
|
|
|
mozilla::dom::CSSRuleList* CssRules() final { return GroupRule::CssRules(); }
|
|
|
|
nsCSSKeyframeRule* FindRule(const nsAString& aKey) final;
|
2011-04-12 10:18:43 +04:00
|
|
|
|
|
|
|
const nsString& GetName() { return mName; }
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const 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;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsCSSPageStyleDeclaration final : public nsDOMCSSDeclaration
|
2012-09-01 01:21:28 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsCSSPageStyleDeclaration(nsCSSPageRule *aRule);
|
2012-09-01 01:21:28 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
|
2012-09-01 01:21:28 +04:00
|
|
|
void DropReference() { mRule = nullptr; }
|
2016-11-03 06:41:02 +03:00
|
|
|
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
|
2017-05-11 19:06:43 +03:00
|
|
|
nsDOMCSSDeclaration::ServoCSSParsingEnvironment GetServoCSSParsingEnvironment() const final;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDocument* DocToUpdate() override;
|
2012-09-01 01:21:28 +04:00
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSPageStyleDeclaration,
|
|
|
|
nsICSSDeclaration)
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsINode *GetParentObject() override;
|
2012-09-01 01:21:28 +04:00
|
|
|
|
|
|
|
protected:
|
2014-06-24 02:40:01 +04:00
|
|
|
virtual ~nsCSSPageStyleDeclaration();
|
|
|
|
|
2012-09-01 01:21:28 +04:00
|
|
|
// This reference is not reference-counted. The rule object tells us
|
|
|
|
// when it's about to go away.
|
2015-06-16 15:12:00 +03:00
|
|
|
nsCSSPageRule* MOZ_NON_OWNING_REF mRule;
|
2012-09-01 01:21:28 +04:00
|
|
|
};
|
|
|
|
|
2017-04-01 03:14:49 +03:00
|
|
|
class nsCSSPageRule final : public mozilla::dom::CSSPageRule
|
2012-09-01 01:21:28 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-11-05 11:44:08 +03:00
|
|
|
nsCSSPageRule(mozilla::css::Declaration* aDeclaration,
|
2014-07-15 02:57:54 +04:00
|
|
|
uint32_t aLineNumber, uint32_t aColumnNumber)
|
2017-04-01 03:14:49 +03:00
|
|
|
: mozilla::dom::CSSPageRule(aLineNumber, aColumnNumber)
|
2015-11-05 11:44:08 +03:00
|
|
|
, mDeclaration(aDeclaration)
|
2012-09-01 01:21:28 +04:00
|
|
|
{
|
2015-11-05 11:44:08 +03:00
|
|
|
mDeclaration->SetOwningRule(this);
|
2012-09-01 01:21:28 +04:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
nsCSSPageRule(const nsCSSPageRule& aCopy);
|
|
|
|
~nsCSSPageRule();
|
|
|
|
public:
|
2016-12-01 02:18:14 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2017-04-01 03:14:49 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsCSSPageRule, mozilla::dom::CSSPageRule)
|
2016-12-01 02:18:14 +03:00
|
|
|
virtual bool IsCCLeaf() const override;
|
2012-09-01 01:21:28 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2012-09-01 01:21:28 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
|
2012-09-01 01:21:28 +04:00
|
|
|
|
2017-04-01 03:14:49 +03:00
|
|
|
// WebIDL interfaces
|
|
|
|
virtual void GetCssTextImpl(nsAString& aCssText) const override;
|
|
|
|
virtual nsICSSDeclaration* Style() override;
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2012-09-01 01:21:28 +04:00
|
|
|
mozilla::css::Declaration* Declaration() { return mDeclaration; }
|
|
|
|
|
|
|
|
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2012-09-01 01:21:28 +04:00
|
|
|
private:
|
2015-11-05 11:44:08 +03:00
|
|
|
RefPtr<mozilla::css::Declaration> mDeclaration;
|
2012-09-01 01:21:28 +04:00
|
|
|
// lazily created when needed:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsCSSPageStyleDeclaration> mDOMDeclaration;
|
2012-09-01 01:21:28 +04:00
|
|
|
};
|
|
|
|
|
2012-08-02 04:32:12 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2017-04-26 11:55:36 +03:00
|
|
|
class CSSSupportsRule final : public dom::CSSSupportsRule
|
2012-08-02 04:32:12 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 02:57:54 +04:00
|
|
|
CSSSupportsRule(bool aConditionMet, const nsString& aCondition,
|
|
|
|
uint32_t aLineNumber, uint32_t aColumnNumber);
|
2012-08-02 04:32:12 +04:00
|
|
|
CSSSupportsRule(const CSSSupportsRule& aCopy);
|
|
|
|
|
2015-11-05 11:44:10 +03:00
|
|
|
// Rule methods
|
2012-08-02 04:32:12 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2012-08-02 04:32:12 +04:00
|
|
|
#endif
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
|
2012-08-02 04:32:12 +04:00
|
|
|
virtual bool UseForPresentation(nsPresContext* aPresContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsMediaQueryResultCacheKey& aKey) override;
|
2012-08-02 04:32:12 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-11-27 09:30:30 +04:00
|
|
|
// nsIDOMCSSConditionRule interface
|
|
|
|
NS_DECL_NSIDOMCSSCONDITIONRULE
|
|
|
|
|
2017-01-13 18:41:02 +03:00
|
|
|
// WebIDL interface
|
|
|
|
void GetCssTextImpl(nsAString& aCssText) const override;
|
2017-04-26 11:55:36 +03:00
|
|
|
using dom::CSSSupportsRule::SetConditionText;
|
2017-01-13 18:41:02 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2012-08-02 04:32:12 +04:00
|
|
|
|
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~CSSSupportsRule();
|
|
|
|
|
2012-08-02 04:32:12 +04:00
|
|
|
bool mUseGroup;
|
|
|
|
nsString mCondition;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2004-08-05 22:26:14 +04:00
|
|
|
#endif /* !defined(nsCSSRules_h_) */
|