Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM FontFaceSet.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_FontFaceSetBinding_h
4 : #define mozilla_dom_FontFaceSetBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/CallbackFunction.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/ToJSValue.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class FontFace;
18 : class FontFaceSet;
19 : struct FontFaceSetAtoms;
20 : class FontFaceSetForEachCallback;
21 : class FontFaceSetIterator;
22 : struct FontFaceSetIteratorAtoms;
23 : struct FontFaceSetIteratorResultAtoms;
24 : struct NativePropertyHooks;
25 : class ProtoAndIfaceCache;
26 :
27 : } // namespace dom
28 : } // namespace mozilla
29 :
30 : namespace mozilla {
31 : namespace dom {
32 :
33 : enum class FontFaceSetLoadStatus : uint8_t {
34 : Loading,
35 : Loaded,
36 : EndGuard_
37 : };
38 :
39 : namespace FontFaceSetLoadStatusValues {
40 : extern const EnumEntry strings[3];
41 : } // namespace FontFaceSetLoadStatusValues
42 :
43 : bool
44 : ToJSValue(JSContext* aCx, FontFaceSetLoadStatus aArgument, JS::MutableHandle<JS::Value> aValue);
45 :
46 :
47 : struct FontFaceSetIteratorResult : public DictionaryBase
48 : {
49 : MOZ_INIT_OUTSIDE_CTOR bool mDone;
50 : MOZ_INIT_OUTSIDE_CTOR JS::Value mValue;
51 :
52 : FontFaceSetIteratorResult();
53 :
54 : explicit inline FontFaceSetIteratorResult(const FastDictionaryInitializer& )
55 : : mValue(JS::UndefinedValue())
56 : {
57 : // Do nothing here; this is used by our "Fast" subclass
58 : }
59 :
60 : private:
61 : FontFaceSetIteratorResult(const FontFaceSetIteratorResult&) = delete;
62 : FontFaceSetIteratorResult& operator=(const FontFaceSetIteratorResult&) = delete;
63 :
64 : static bool
65 : InitIds(JSContext* cx, FontFaceSetIteratorResultAtoms* atomsCache);
66 :
67 : public:
68 : bool
69 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
70 :
71 : bool
72 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
73 :
74 : void
75 : TraceDictionary(JSTracer* trc);
76 : };
77 :
78 : namespace binding_detail {
79 : struct FastFontFaceSetIteratorResult : public FontFaceSetIteratorResult
80 : {
81 : inline FastFontFaceSetIteratorResult()
82 : : FontFaceSetIteratorResult(FastDictionaryInitializer())
83 : {
84 : // Doesn't matter what int we pass to the parent constructor
85 : }
86 : };
87 : } // namespace binding_detail
88 :
89 :
90 0 : class FontFaceSetForEachCallback : public CallbackFunction
91 : {
92 : public:
93 : explicit inline FontFaceSetForEachCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
94 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
95 : {
96 : MOZ_ASSERT(JS::IsCallable(mCallback));
97 : }
98 :
99 0 : explicit inline FontFaceSetForEachCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
100 0 : : CallbackFunction(aCallback, FastCallbackConstructor())
101 : {
102 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
103 0 : }
104 :
105 : explicit inline FontFaceSetForEachCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
106 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
107 : {
108 : MOZ_ASSERT(JS::IsCallable(mCallback));
109 : }
110 :
111 : explicit inline FontFaceSetForEachCallback(CallbackFunction* aOther)
112 : : CallbackFunction(aOther)
113 : {
114 : }
115 :
116 : template <typename T>
117 : inline void
118 0 : Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
119 : {
120 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
121 0 : if (!aExecutionReason) {
122 0 : aExecutionReason = "FontFaceSetForEachCallback";
123 : }
124 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
125 0 : if (!s.GetContext()) {
126 0 : MOZ_ASSERT(aRv.Failed());
127 0 : return;
128 : }
129 0 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
130 0 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
131 0 : aRv.Throw(NS_ERROR_FAILURE);
132 0 : return;
133 : }
134 0 : return Call(s.GetContext(), thisValJS, value, key, set, aRv);
135 : }
136 :
137 : inline void
138 : Call(FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
139 : {
140 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
141 : if (!aExecutionReason) {
142 : aExecutionReason = "FontFaceSetForEachCallback";
143 : }
144 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
145 : if (!s.GetContext()) {
146 : MOZ_ASSERT(aRv.Failed());
147 : return;
148 : }
149 : return Call(s.GetContext(), JS::UndefinedHandleValue, value, key, set, aRv);
150 : }
151 :
152 : template <typename T>
153 : inline void
154 : Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
155 : {
156 : IgnoredErrorResult rv;
157 : return Call(thisVal, value, key, set, rv, aExecutionReason);
158 : }
159 :
160 : inline void
161 : Call(FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
162 : {
163 : IgnoredErrorResult rv;
164 : return Call(value, key, set, rv, aExecutionReason, eReportExceptions, nullptr);
165 : }
166 :
167 : inline bool
168 : operator==(const FontFaceSetForEachCallback& aOther) const
169 : {
170 : return CallbackFunction::operator==(aOther);
171 : }
172 :
173 : private:
174 : void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv);
175 : };
176 :
177 :
178 : namespace binding_detail {
179 0 : class FastFontFaceSetForEachCallback : public FontFaceSetForEachCallback
180 : {
181 : public:
182 0 : explicit inline FastFontFaceSetForEachCallback(JS::Handle<JSObject*> aCallback)
183 0 : : FontFaceSetForEachCallback(aCallback, FastCallbackConstructor())
184 : {
185 0 : }
186 :
187 : inline void
188 0 : Trace(JSTracer* aTracer)
189 : {
190 0 : FontFaceSetForEachCallback::Trace(aTracer);
191 0 : }
192 :
193 : inline void
194 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
195 : {
196 0 : FontFaceSetForEachCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
197 0 : }
198 : };
199 : } // namespace binding_detail
200 :
201 :
202 : namespace FontFaceSetBinding {
203 :
204 : typedef mozilla::dom::FontFaceSet NativeType;
205 :
206 : bool
207 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
208 :
209 : JSObject*
210 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
211 :
212 : const JSClass*
213 : GetJSClass();
214 :
215 : bool
216 : Wrap(JSContext* aCx, mozilla::dom::FontFaceSet* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
217 :
218 : template <class T>
219 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
220 : {
221 0 : JS::Rooted<JSObject*> reflector(aCx);
222 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
223 : }
224 :
225 : // We declare this as an array so that retrieving a pointer to this
226 : // binding's property hooks only requires compile/link-time resolvable
227 : // address arithmetic. Declaring it as a pointer instead would require
228 : // doing a run-time load to fetch a pointer to this binding's property
229 : // hooks. And then structures which embedded a pointer to this structure
230 : // would require a run-time load for proper initialization, which would
231 : // then induce static constructors. Lots of static constructors.
232 : extern const NativePropertyHooks sNativePropertyHooks[];
233 :
234 : void
235 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
236 :
237 : JS::Handle<JSObject*>
238 : GetProtoObjectHandle(JSContext* aCx);
239 :
240 : JS::Handle<JSObject*>
241 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
242 :
243 : JSObject*
244 : GetConstructorObject(JSContext* aCx);
245 :
246 : } // namespace FontFaceSetBinding
247 :
248 :
249 :
250 : namespace FontFaceSetIteratorBinding {
251 :
252 : typedef mozilla::dom::FontFaceSetIterator NativeType;
253 :
254 : const JSClass*
255 : GetJSClass();
256 :
257 : bool
258 : Wrap(JSContext* aCx, mozilla::dom::FontFaceSetIterator* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
259 :
260 : // We declare this as an array so that retrieving a pointer to this
261 : // binding's property hooks only requires compile/link-time resolvable
262 : // address arithmetic. Declaring it as a pointer instead would require
263 : // doing a run-time load to fetch a pointer to this binding's property
264 : // hooks. And then structures which embedded a pointer to this structure
265 : // would require a run-time load for proper initialization, which would
266 : // then induce static constructors. Lots of static constructors.
267 : extern const NativePropertyHooks sNativePropertyHooks[];
268 :
269 : void
270 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
271 :
272 : JS::Handle<JSObject*>
273 : GetProtoObjectHandle(JSContext* aCx);
274 :
275 : } // namespace FontFaceSetIteratorBinding
276 :
277 :
278 :
279 : } // namespace dom
280 : } // namespace mozilla
281 :
282 : #endif // mozilla_dom_FontFaceSetBinding_h
|