/work/obj-fuzz/dist/include/mozilla/dom/CSSFontFaceRule.h
Line | Count | Source (jump to first uncovered line) |
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_CSSFontFaceRule_h |
8 | | #define mozilla_CSSFontFaceRule_h |
9 | | |
10 | | #include "mozilla/ServoBindingTypes.h" |
11 | | #include "mozilla/css/Rule.h" |
12 | | #include "nsICSSDeclaration.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | |
18 | | // A CSSFontFaceRuleDecl is always embeded in a CSSFontFaceRule. |
19 | | class CSSFontFaceRule; |
20 | | class CSSFontFaceRuleDecl final : public nsICSSDeclaration |
21 | | { |
22 | | public: |
23 | | NS_DECL_ISUPPORTS_INHERITED |
24 | | NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER |
25 | | |
26 | | nsINode* GetParentObject() final; |
27 | | void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final; |
28 | | |
29 | | void GetPropertyValue(nsCSSFontDesc aFontDescID, nsAString& aResult) const; |
30 | | |
31 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; |
32 | | |
33 | | protected: |
34 | | // For accessing the constructor. |
35 | | friend class CSSFontFaceRule; |
36 | | |
37 | | explicit CSSFontFaceRuleDecl(already_AddRefed<RawServoFontFaceRule> aDecl) |
38 | 0 | : mRawRule(std::move(aDecl)) {} |
39 | | |
40 | 0 | ~CSSFontFaceRuleDecl() = default; |
41 | | |
42 | | inline CSSFontFaceRule* ContainingRule(); |
43 | | inline const CSSFontFaceRule* ContainingRule() const; |
44 | | |
45 | | RefPtr<RawServoFontFaceRule> mRawRule; |
46 | | |
47 | | private: |
48 | | void* operator new(size_t size) CPP_THROW_NEW = delete; |
49 | | }; |
50 | | |
51 | | class CSSFontFaceRule final : public css::Rule |
52 | | { |
53 | | public: |
54 | | CSSFontFaceRule(already_AddRefed<RawServoFontFaceRule> aRawRule, |
55 | | StyleSheet* aSheet, |
56 | | css::Rule* aParentRule, |
57 | | uint32_t aLine, |
58 | | uint32_t aColumn) |
59 | | : css::Rule(aSheet, aParentRule, aLine, aColumn) |
60 | | , mDecl(std::move(aRawRule)) |
61 | 0 | {} |
62 | | |
63 | | CSSFontFaceRule(const CSSFontFaceRule&) = delete; |
64 | | |
65 | | NS_DECL_ISUPPORTS_INHERITED |
66 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED( |
67 | | CSSFontFaceRule, css::Rule) |
68 | | bool IsCCLeaf() const final; |
69 | | |
70 | 0 | RawServoFontFaceRule* Raw() const { return mDecl.mRawRule; } |
71 | | |
72 | | // WebIDL interface |
73 | | uint16_t Type() const final; |
74 | | void GetCssText(nsAString& aCssText) const final; |
75 | | nsICSSDeclaration* Style(); |
76 | | |
77 | | // Methods of mozilla::css::Rule |
78 | | size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) |
79 | | const final; |
80 | | |
81 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; |
82 | | |
83 | | #ifdef DEBUG |
84 | | void List(FILE* out = stdout, int32_t aIndent = 0) const final; |
85 | | #endif |
86 | | |
87 | | private: |
88 | 0 | virtual ~CSSFontFaceRule() = default; |
89 | | |
90 | | // For computing the offset of mDecl. |
91 | | friend class CSSFontFaceRuleDecl; |
92 | | |
93 | | CSSFontFaceRuleDecl mDecl; |
94 | | }; |
95 | | |
96 | | inline CSSFontFaceRule* |
97 | | CSSFontFaceRuleDecl::ContainingRule() |
98 | 0 | { |
99 | 0 | return reinterpret_cast<CSSFontFaceRule*> |
100 | 0 | (reinterpret_cast<char*>(this) - offsetof(CSSFontFaceRule, mDecl)); |
101 | 0 | } |
102 | | |
103 | | inline const CSSFontFaceRule* |
104 | | CSSFontFaceRuleDecl::ContainingRule() const |
105 | 0 | { |
106 | 0 | return reinterpret_cast<const CSSFontFaceRule*> |
107 | 0 | (reinterpret_cast<const char*>(this) - offsetof(CSSFontFaceRule, mDecl)); |
108 | 0 | } |
109 | | |
110 | | } // namespace dom |
111 | | } // namespace mozilla |
112 | | |
113 | | #endif // mozilla_CSSFontFaceRule_h |