1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_CSSKeyframesRule_h
8 #define mozilla_dom_CSSKeyframesRule_h
10 #include "mozilla/css/Rule.h"
11 #include "mozilla/dom/CSSKeyframeRule.h"
13 namespace mozilla::dom
{
15 class CSSKeyframeList
;
17 class CSSKeyframesRule final
: public css::Rule
{
19 CSSKeyframesRule(RefPtr
<StyleLockedKeyframesRule
> aRawRule
,
20 StyleSheet
* aSheet
, css::Rule
* aParentRule
, uint32_t aLine
,
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CSSKeyframesRule
, css::Rule
)
26 bool IsCCLeaf() const final
;
29 void List(FILE* out
= stdout
, int32_t aIndent
= 0) const final
;
32 void DropSheetReference() final
;
35 StyleCssRuleType
Type() const final
;
36 const StyleLockedKeyframesRule
* Raw() const { return mRawRule
.get(); }
37 void SetRawAfterClone(RefPtr
<StyleLockedKeyframesRule
>);
39 void GetCssText(nsACString
& aCssText
) const final
;
40 void GetName(nsAString
& aName
) const;
41 void SetName(const nsAString
& aName
);
42 CSSRuleList
* CssRules();
44 CSSKeyframeRule
* IndexedGetter(uint32_t aIndex
, bool& aFound
);
47 void AppendRule(const nsAString
& aRule
);
48 void DeleteRule(const nsAString
& aKey
);
49 CSSKeyframeRule
* FindRule(const nsAString
& aKey
);
51 size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf
) const final
;
53 JSObject
* WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) final
;
56 CSSKeyframeList
* EnsureRules();
57 uint32_t FindRuleIndexForKey(const nsAString
& aKey
);
59 template <typename Func
>
60 nsresult
UpdateRule(Func aCallback
);
62 virtual ~CSSKeyframesRule();
64 RefPtr
<StyleLockedKeyframesRule
> mRawRule
;
65 RefPtr
<CSSKeyframeList
> mKeyframeList
; // lazily constructed
68 } // namespace mozilla::dom
70 #endif // mozilla_dom_CSSKeyframesRule_h