Line data Source code
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/. */
6 :
7 : #ifndef mozilla_ServoKeyframeRule_h
8 : #define mozilla_ServoKeyframeRule_h
9 :
10 : #include "mozilla/dom/CSSKeyframeRule.h"
11 : #include "mozilla/ServoBindingTypes.h"
12 :
13 : namespace mozilla {
14 :
15 : class ServoDeclarationBlock;
16 : class ServoKeyframeDeclaration;
17 :
18 : class ServoKeyframeRule final : public dom::CSSKeyframeRule
19 : {
20 : public:
21 0 : explicit ServoKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw)
22 0 : : CSSKeyframeRule(0, 0)
23 0 : , mRaw(aRaw) {}
24 :
25 : NS_DECL_ISUPPORTS_INHERITED
26 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoKeyframeRule,
27 : dom::CSSKeyframeRule)
28 :
29 : bool IsCCLeaf() const final;
30 : #ifdef DEBUG
31 : void List(FILE* out = stdout, int32_t aIndent = 0) const final;
32 : #endif
33 : already_AddRefed<mozilla::css::Rule> Clone() const final;
34 :
35 0 : RawServoKeyframe* Raw() const { return mRaw; }
36 :
37 : // nsIDOMCSSKeyframeRule interface
38 : NS_IMETHOD GetKeyText(nsAString& aKeyText) final;
39 : NS_IMETHOD SetKeyText(const nsAString& aKeyText) final;
40 :
41 : // WebIDL interface
42 : void GetCssTextImpl(nsAString& aCssText) const final;
43 : nsICSSDeclaration* Style() final;
44 :
45 : size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
46 :
47 : private:
48 : virtual ~ServoKeyframeRule();
49 :
50 : friend class ServoKeyframeDeclaration;
51 :
52 : template<typename Func>
53 : void UpdateRule(Func aCallback);
54 :
55 : RefPtr<RawServoKeyframe> mRaw;
56 : // lazily created when needed
57 : RefPtr<ServoKeyframeDeclaration> mDeclaration;
58 : };
59 :
60 : } // namespace mozilla
61 :
62 : #endif // mozilla_ServoKeyframeRule_h
|