CSSCounterStyleRule.h (1988B)
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_CSSCounterStyleRule_h 8 #define mozilla_CSSCounterStyleRule_h 9 10 #include "mozilla/ServoBindingTypes.h" 11 #include "mozilla/css/Rule.h" 12 13 struct StyleLockedCounterStyleRule; 14 15 namespace mozilla::dom { 16 17 class CSSCounterStyleRule final : public css::Rule { 18 public: 19 CSSCounterStyleRule(already_AddRefed<StyleLockedCounterStyleRule> aRawRule, 20 StyleSheet* aSheet, css::Rule* aParentRule, 21 uint32_t aLine, uint32_t aColumn) 22 : css::Rule(aSheet, aParentRule, aLine, aColumn), 23 mRawRule(std::move(aRawRule)) {} 24 25 private: 26 CSSCounterStyleRule(const CSSCounterStyleRule& aCopy) = delete; 27 ~CSSCounterStyleRule() = default; 28 29 template <typename Func> 30 void ModifyRule(Func); 31 32 public: 33 bool IsCCLeaf() const final; 34 35 const StyleLockedCounterStyleRule* Raw() const { return mRawRule.get(); } 36 void SetRawAfterClone(RefPtr<StyleLockedCounterStyleRule>); 37 38 #ifdef DEBUG 39 void List(FILE* out = stdout, int32_t aIndent = 0) const final; 40 #endif 41 42 // WebIDL interface 43 StyleCssRuleType Type() const override; 44 void GetCssText(nsACString& aCssText) const override; 45 void GetName(nsAString& aName); 46 void SetName(const nsAString& aName); 47 #define CSS_COUNTER_DESC(name_, method_) \ 48 void Get##method_(nsACString& aValue); \ 49 void Set##method_(const nsACString& aValue); 50 #include "nsCSSCounterDescList.h" 51 #undef CSS_COUNTER_DESC 52 53 size_t SizeOfIncludingThis(MallocSizeOf) const final; 54 55 JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; 56 57 private: 58 RefPtr<StyleLockedCounterStyleRule> mRawRule; 59 }; 60 61 } // namespace mozilla::dom 62 63 #endif // mozilla_CSSCounterStyleRule_h