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