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_dom_CSSKeyframeRule_h 8 #define mozilla_dom_CSSKeyframeRule_h 9 10 #include "mozilla/css/Rule.h" 11 #include "mozilla/ServoBindingTypes.h" 12 13 class nsICSSDeclaration; 14 15 namespace mozilla::dom { 16 17 class CSSKeyframeDeclaration; 18 19 class CSSKeyframeRule final : public css::Rule { 20 public: 21 CSSKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw, StyleSheet* aSheet, 22 css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn); 23 24 NS_DECL_ISUPPORTS_INHERITED 25 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CSSKeyframeRule, css::Rule) 26 bool IsCCLeaf() const final; 27 28 #ifdef DEBUG 29 void List(FILE* out = stdout, int32_t aIndent = 0) const final; 30 #endif 31 Raw()32 RawServoKeyframe* Raw() const { return mRaw; } 33 void SetRawAfterClone(RefPtr<RawServoKeyframe>); 34 35 // WebIDL interface 36 StyleCssRuleType Type() const final; 37 void GetCssText(nsACString& aCssText) const final; 38 void GetKeyText(nsACString& aKey); 39 void SetKeyText(const nsACString& aKey); 40 nsICSSDeclaration* Style(); 41 42 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final; 43 44 JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; 45 46 private: 47 virtual ~CSSKeyframeRule(); 48 49 friend class CSSKeyframeDeclaration; 50 51 template <typename Func> 52 void UpdateRule(Func aCallback); 53 54 RefPtr<RawServoKeyframe> mRaw; 55 // lazily created when needed 56 RefPtr<CSSKeyframeDeclaration> mDeclaration; 57 }; 58 59 } // namespace mozilla::dom 60 61 #endif // mozilla_dom_CSSKeyframeRule_h 62