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