Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLCanvasElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_HTMLCanvasElementBinding_h
4 : #define mozilla_dom_HTMLCanvasElementBinding_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 Blob;
18 : class BlobCallback;
19 : class HTMLCanvasElement;
20 : struct HTMLCanvasElementAtoms;
21 : class HTMLCanvasPrintState;
22 : struct HTMLCanvasPrintStateAtoms;
23 : struct NativePropertyHooks;
24 : class PrintCallback;
25 : class ProtoAndIfaceCache;
26 :
27 : } // namespace dom
28 : } // namespace mozilla
29 :
30 : namespace mozilla {
31 : namespace dom {
32 :
33 0 : class PrintCallback : public CallbackFunction
34 : {
35 : public:
36 : explicit inline PrintCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
37 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
38 : {
39 : MOZ_ASSERT(JS::IsCallable(mCallback));
40 : }
41 :
42 0 : explicit inline PrintCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
43 0 : : CallbackFunction(aCallback, FastCallbackConstructor())
44 : {
45 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
46 0 : }
47 :
48 : explicit inline PrintCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
49 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
50 : {
51 : MOZ_ASSERT(JS::IsCallable(mCallback));
52 : }
53 :
54 : explicit inline PrintCallback(CallbackFunction* aOther)
55 : : CallbackFunction(aOther)
56 : {
57 : }
58 :
59 : template <typename T>
60 : inline void
61 : Call(const T& thisVal, HTMLCanvasPrintState& ctx, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
62 : {
63 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
64 : if (!aExecutionReason) {
65 : aExecutionReason = "PrintCallback";
66 : }
67 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
68 : if (!s.GetContext()) {
69 : MOZ_ASSERT(aRv.Failed());
70 : return;
71 : }
72 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
73 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
74 : aRv.Throw(NS_ERROR_FAILURE);
75 : return;
76 : }
77 : return Call(s.GetContext(), thisValJS, ctx, aRv);
78 : }
79 :
80 : inline void
81 0 : Call(HTMLCanvasPrintState& ctx, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
82 : {
83 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
84 0 : if (!aExecutionReason) {
85 0 : aExecutionReason = "PrintCallback";
86 : }
87 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
88 0 : if (!s.GetContext()) {
89 0 : MOZ_ASSERT(aRv.Failed());
90 0 : return;
91 : }
92 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, ctx, aRv);
93 : }
94 :
95 : template <typename T>
96 : inline void
97 : Call(const T& thisVal, HTMLCanvasPrintState& ctx, const char* aExecutionReason = nullptr)
98 : {
99 : IgnoredErrorResult rv;
100 : return Call(thisVal, ctx, rv, aExecutionReason);
101 : }
102 :
103 : inline void
104 : Call(HTMLCanvasPrintState& ctx, const char* aExecutionReason = nullptr)
105 : {
106 : IgnoredErrorResult rv;
107 : return Call(ctx, rv, aExecutionReason, eReportExceptions, nullptr);
108 : }
109 :
110 : inline bool
111 : operator==(const PrintCallback& aOther) const
112 : {
113 : return CallbackFunction::operator==(aOther);
114 : }
115 :
116 : private:
117 : void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, HTMLCanvasPrintState& ctx, ErrorResult& aRv);
118 : };
119 :
120 :
121 0 : class BlobCallback : public CallbackFunction
122 : {
123 : public:
124 : explicit inline BlobCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
125 : : CallbackFunction(aCx, aCallback, aIncumbentGlobal)
126 : {
127 : MOZ_ASSERT(JS::IsCallable(mCallback));
128 : }
129 :
130 0 : explicit inline BlobCallback(JS::Handle<JSObject*> aCallback, const FastCallbackConstructor& )
131 0 : : CallbackFunction(aCallback, FastCallbackConstructor())
132 : {
133 0 : MOZ_ASSERT(JS::IsCallable(mCallback));
134 0 : }
135 :
136 : explicit inline BlobCallback(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
137 : : CallbackFunction(aCallback, aAsyncStack, aIncumbentGlobal)
138 : {
139 : MOZ_ASSERT(JS::IsCallable(mCallback));
140 : }
141 :
142 : explicit inline BlobCallback(CallbackFunction* aOther)
143 : : CallbackFunction(aOther)
144 : {
145 : }
146 :
147 : template <typename T>
148 : inline void
149 : Call(const T& thisVal, Blob* blob, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
150 : {
151 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
152 : if (!aExecutionReason) {
153 : aExecutionReason = "BlobCallback";
154 : }
155 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
156 : if (!s.GetContext()) {
157 : MOZ_ASSERT(aRv.Failed());
158 : return;
159 : }
160 : JS::Rooted<JS::Value> thisValJS(s.GetContext());
161 : if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
162 : aRv.Throw(NS_ERROR_FAILURE);
163 : return;
164 : }
165 : return Call(s.GetContext(), thisValJS, blob, aRv);
166 : }
167 :
168 : inline void
169 0 : Call(Blob* blob, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr)
170 : {
171 0 : MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
172 0 : if (!aExecutionReason) {
173 0 : aExecutionReason = "BlobCallback";
174 : }
175 0 : CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aCompartment);
176 0 : if (!s.GetContext()) {
177 0 : MOZ_ASSERT(aRv.Failed());
178 0 : return;
179 : }
180 0 : return Call(s.GetContext(), JS::UndefinedHandleValue, blob, aRv);
181 : }
182 :
183 : template <typename T>
184 : inline void
185 : Call(const T& thisVal, Blob* blob, const char* aExecutionReason = nullptr)
186 : {
187 : IgnoredErrorResult rv;
188 : return Call(thisVal, blob, rv, aExecutionReason);
189 : }
190 :
191 : inline void
192 0 : Call(Blob* blob, const char* aExecutionReason = nullptr)
193 : {
194 0 : IgnoredErrorResult rv;
195 0 : return Call(blob, rv, aExecutionReason, eReportExceptions, nullptr);
196 : }
197 :
198 : inline bool
199 : operator==(const BlobCallback& aOther) const
200 : {
201 : return CallbackFunction::operator==(aOther);
202 : }
203 :
204 : private:
205 : void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, Blob* blob, ErrorResult& aRv);
206 : };
207 :
208 :
209 : namespace binding_detail {
210 0 : class FastPrintCallback : public PrintCallback
211 : {
212 : public:
213 0 : explicit inline FastPrintCallback(JS::Handle<JSObject*> aCallback)
214 0 : : PrintCallback(aCallback, FastCallbackConstructor())
215 : {
216 0 : }
217 :
218 : inline void
219 0 : Trace(JSTracer* aTracer)
220 : {
221 0 : PrintCallback::Trace(aTracer);
222 0 : }
223 :
224 : inline void
225 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
226 : {
227 0 : PrintCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
228 0 : }
229 : };
230 : } // namespace binding_detail
231 :
232 :
233 : namespace binding_detail {
234 0 : class FastBlobCallback : public BlobCallback
235 : {
236 : public:
237 0 : explicit inline FastBlobCallback(JS::Handle<JSObject*> aCallback)
238 0 : : BlobCallback(aCallback, FastCallbackConstructor())
239 : {
240 0 : }
241 :
242 : inline void
243 0 : Trace(JSTracer* aTracer)
244 : {
245 0 : BlobCallback::Trace(aTracer);
246 0 : }
247 :
248 : inline void
249 0 : FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
250 : {
251 0 : BlobCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
252 0 : }
253 : };
254 : } // namespace binding_detail
255 :
256 :
257 : namespace HTMLCanvasElementBinding {
258 :
259 : typedef mozilla::dom::HTMLCanvasElement NativeType;
260 :
261 : JSObject*
262 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
263 :
264 : const JSClass*
265 : GetJSClass();
266 :
267 : bool
268 : Wrap(JSContext* aCx, mozilla::dom::HTMLCanvasElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
269 :
270 : template <class T>
271 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
272 : {
273 0 : JS::Rooted<JSObject*> reflector(aCx);
274 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
275 : }
276 :
277 : // We declare this as an array so that retrieving a pointer to this
278 : // binding's property hooks only requires compile/link-time resolvable
279 : // address arithmetic. Declaring it as a pointer instead would require
280 : // doing a run-time load to fetch a pointer to this binding's property
281 : // hooks. And then structures which embedded a pointer to this structure
282 : // would require a run-time load for proper initialization, which would
283 : // then induce static constructors. Lots of static constructors.
284 : extern const NativePropertyHooks sNativePropertyHooks[];
285 :
286 : void
287 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
288 :
289 : JS::Handle<JSObject*>
290 : GetProtoObjectHandle(JSContext* aCx);
291 :
292 : JS::Handle<JSObject*>
293 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
294 :
295 : JSObject*
296 : GetConstructorObject(JSContext* aCx);
297 :
298 : } // namespace HTMLCanvasElementBinding
299 :
300 :
301 :
302 : namespace MozCanvasPrintStateBinding {
303 :
304 : typedef mozilla::dom::HTMLCanvasPrintState NativeType;
305 :
306 : bool
307 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
308 :
309 : JSObject*
310 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
311 :
312 : const JSClass*
313 : GetJSClass();
314 :
315 : bool
316 : Wrap(JSContext* aCx, mozilla::dom::HTMLCanvasPrintState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
317 :
318 : template <class T>
319 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
320 : {
321 0 : JS::Rooted<JSObject*> reflector(aCx);
322 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
323 : }
324 :
325 : // We declare this as an array so that retrieving a pointer to this
326 : // binding's property hooks only requires compile/link-time resolvable
327 : // address arithmetic. Declaring it as a pointer instead would require
328 : // doing a run-time load to fetch a pointer to this binding's property
329 : // hooks. And then structures which embedded a pointer to this structure
330 : // would require a run-time load for proper initialization, which would
331 : // then induce static constructors. Lots of static constructors.
332 : extern const NativePropertyHooks sNativePropertyHooks[];
333 :
334 : void
335 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
336 :
337 : JS::Handle<JSObject*>
338 : GetProtoObjectHandle(JSContext* aCx);
339 :
340 : JS::Handle<JSObject*>
341 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
342 :
343 : JSObject*
344 : GetConstructorObject(JSContext* aCx);
345 :
346 : } // namespace MozCanvasPrintStateBinding
347 :
348 :
349 :
350 : } // namespace dom
351 : } // namespace mozilla
352 :
353 : #endif // mozilla_dom_HTMLCanvasElementBinding_h
|