1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22
23#if ENABLE(WEB_AUDIO)
24
25#include "JSPannerNode.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertNumbers.h"
31#include "JSDOMExceptionHandling.h"
32#include "JSDOMOperation.h"
33#include "JSDOMWrapperCache.h"
34#include "ScriptExecutionContext.h"
35#include <JavaScriptCore/HeapSnapshotBuilder.h>
36#include <JavaScriptCore/JSCInlines.h>
37#include <JavaScriptCore/JSString.h>
38#include <wtf/GetPtr.h>
39#include <wtf/NeverDestroyed.h>
40#include <wtf/PointerPreparations.h>
41#include <wtf/URL.h>
42
43
44namespace WebCore {
45using namespace JSC;
46
47#if ENABLE(WEB_AUDIO)
48
49String convertEnumerationToString(PanningModelType enumerationValue)
50{
51 static const NeverDestroyed<String> values[] = {
52 MAKE_STATIC_STRING_IMPL("equalpower"),
53 MAKE_STATIC_STRING_IMPL("HRTF"),
54 };
55 static_assert(static_cast<size_t>(PanningModelType::Equalpower) == 0, "PanningModelType::Equalpower is not 0 as expected");
56 static_assert(static_cast<size_t>(PanningModelType::HRTF) == 1, "PanningModelType::HRTF is not 1 as expected");
57 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
58 return values[static_cast<size_t>(enumerationValue)];
59}
60
61template<> JSString* convertEnumerationToJS(ExecState& state, PanningModelType enumerationValue)
62{
63 return jsStringWithCache(&state, convertEnumerationToString(enumerationValue));
64}
65
66template<> Optional<PanningModelType> parseEnumeration<PanningModelType>(ExecState& state, JSValue value)
67{
68 auto stringValue = value.toWTFString(&state);
69 if (stringValue == "equalpower")
70 return PanningModelType::Equalpower;
71 if (stringValue == "HRTF")
72 return PanningModelType::HRTF;
73 return WTF::nullopt;
74}
75
76template<> const char* expectedEnumerationValues<PanningModelType>()
77{
78 return "\"equalpower\", \"HRTF\"";
79}
80
81#endif
82
83#if ENABLE(WEB_AUDIO)
84
85String convertEnumerationToString(DistanceModelType enumerationValue)
86{
87 static const NeverDestroyed<String> values[] = {
88 MAKE_STATIC_STRING_IMPL("linear"),
89 MAKE_STATIC_STRING_IMPL("inverse"),
90 MAKE_STATIC_STRING_IMPL("exponential"),
91 };
92 static_assert(static_cast<size_t>(DistanceModelType::Linear) == 0, "DistanceModelType::Linear is not 0 as expected");
93 static_assert(static_cast<size_t>(DistanceModelType::Inverse) == 1, "DistanceModelType::Inverse is not 1 as expected");
94 static_assert(static_cast<size_t>(DistanceModelType::Exponential) == 2, "DistanceModelType::Exponential is not 2 as expected");
95 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
96 return values[static_cast<size_t>(enumerationValue)];
97}
98
99template<> JSString* convertEnumerationToJS(ExecState& state, DistanceModelType enumerationValue)
100{
101 return jsStringWithCache(&state, convertEnumerationToString(enumerationValue));
102}
103
104template<> Optional<DistanceModelType> parseEnumeration<DistanceModelType>(ExecState& state, JSValue value)
105{
106 auto stringValue = value.toWTFString(&state);
107 if (stringValue == "linear")
108 return DistanceModelType::Linear;
109 if (stringValue == "inverse")
110 return DistanceModelType::Inverse;
111 if (stringValue == "exponential")
112 return DistanceModelType::Exponential;
113 return WTF::nullopt;
114}
115
116template<> const char* expectedEnumerationValues<DistanceModelType>()
117{
118 return "\"linear\", \"inverse\", \"exponential\"";
119}
120
121#endif
122
123// Functions
124
125JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetPosition(JSC::ExecState*);
126JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetOrientation(JSC::ExecState*);
127JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetVelocity(JSC::ExecState*);
128
129// Attributes
130
131JSC::EncodedJSValue jsPannerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
132bool setJSPannerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
133JSC::EncodedJSValue jsPannerNodePanningModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
134bool setJSPannerNodePanningModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
135JSC::EncodedJSValue jsPannerNodeDistanceModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
136bool setJSPannerNodeDistanceModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
137JSC::EncodedJSValue jsPannerNodeRefDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
138bool setJSPannerNodeRefDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
139JSC::EncodedJSValue jsPannerNodeMaxDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
140bool setJSPannerNodeMaxDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
141JSC::EncodedJSValue jsPannerNodeRolloffFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
142bool setJSPannerNodeRolloffFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
143JSC::EncodedJSValue jsPannerNodeConeInnerAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
144bool setJSPannerNodeConeInnerAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
145JSC::EncodedJSValue jsPannerNodeConeOuterAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
146bool setJSPannerNodeConeOuterAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
147JSC::EncodedJSValue jsPannerNodeConeOuterGain(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
148bool setJSPannerNodeConeOuterGain(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
149
150class JSPannerNodePrototype : public JSC::JSNonFinalObject {
151public:
152 using Base = JSC::JSNonFinalObject;
153 static JSPannerNodePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
154 {
155 JSPannerNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSPannerNodePrototype>(vm.heap)) JSPannerNodePrototype(vm, globalObject, structure);
156 ptr->finishCreation(vm);
157 return ptr;
158 }
159
160 DECLARE_INFO;
161 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
162 {
163 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
164 }
165
166private:
167 JSPannerNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
168 : JSC::JSNonFinalObject(vm, structure)
169 {
170 }
171
172 void finishCreation(JSC::VM&);
173};
174
175using JSPannerNodeConstructor = JSDOMConstructorNotConstructable<JSPannerNode>;
176
177template<> JSValue JSPannerNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
178{
179 return JSAudioNode::getConstructor(vm, &globalObject);
180}
181
182template<> void JSPannerNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
183{
184 putDirect(vm, vm.propertyNames->prototype, JSPannerNode::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
185 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("webkitAudioPannerNode"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
186 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
187}
188
189template<> const ClassInfo JSPannerNodeConstructor::s_info = { "webkitAudioPannerNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPannerNodeConstructor) };
190
191/* Hash table for prototype */
192
193static const HashTableValue JSPannerNodePrototypeTableValues[] =
194{
195 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConstructor) } },
196 { "panningModel", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodePanningModel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodePanningModel) } },
197 { "distanceModel", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeDistanceModel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeDistanceModel) } },
198 { "refDistance", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeRefDistance), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeRefDistance) } },
199 { "maxDistance", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeMaxDistance), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeMaxDistance) } },
200 { "rolloffFactor", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeRolloffFactor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeRolloffFactor) } },
201 { "coneInnerAngle", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeInnerAngle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeInnerAngle) } },
202 { "coneOuterAngle", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeOuterAngle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeOuterAngle) } },
203 { "coneOuterGain", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeOuterGain), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeOuterGain) } },
204 { "setPosition", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPannerNodePrototypeFunctionSetPosition), (intptr_t) (3) } },
205 { "setOrientation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPannerNodePrototypeFunctionSetOrientation), (intptr_t) (3) } },
206 { "setVelocity", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPannerNodePrototypeFunctionSetVelocity), (intptr_t) (3) } },
207};
208
209const ClassInfo JSPannerNodePrototype::s_info = { "webkitAudioPannerNodePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPannerNodePrototype) };
210
211void JSPannerNodePrototype::finishCreation(VM& vm)
212{
213 Base::finishCreation(vm);
214 reifyStaticProperties(vm, JSPannerNode::info(), JSPannerNodePrototypeTableValues, *this);
215}
216
217const ClassInfo JSPannerNode::s_info = { "webkitAudioPannerNode", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPannerNode) };
218
219JSPannerNode::JSPannerNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PannerNode>&& impl)
220 : JSAudioNode(structure, globalObject, WTFMove(impl))
221{
222}
223
224void JSPannerNode::finishCreation(VM& vm)
225{
226 Base::finishCreation(vm);
227 ASSERT(inherits(vm, info()));
228
229}
230
231JSObject* JSPannerNode::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
232{
233 return JSPannerNodePrototype::create(vm, &globalObject, JSPannerNodePrototype::createStructure(vm, &globalObject, JSAudioNode::prototype(vm, globalObject)));
234}
235
236JSObject* JSPannerNode::prototype(VM& vm, JSDOMGlobalObject& globalObject)
237{
238 return getDOMPrototype<JSPannerNode>(vm, globalObject);
239}
240
241JSValue JSPannerNode::getConstructor(VM& vm, const JSGlobalObject* globalObject)
242{
243 return getDOMConstructor<JSPannerNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
244}
245
246template<> inline JSPannerNode* IDLAttribute<JSPannerNode>::cast(ExecState& state, EncodedJSValue thisValue)
247{
248 return jsDynamicCast<JSPannerNode*>(state.vm(), JSValue::decode(thisValue));
249}
250
251template<> inline JSPannerNode* IDLOperation<JSPannerNode>::cast(ExecState& state)
252{
253 return jsDynamicCast<JSPannerNode*>(state.vm(), state.thisValue());
254}
255
256EncodedJSValue jsPannerNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
257{
258 VM& vm = state->vm();
259 auto throwScope = DECLARE_THROW_SCOPE(vm);
260 auto* prototype = jsDynamicCast<JSPannerNodePrototype*>(vm, JSValue::decode(thisValue));
261 if (UNLIKELY(!prototype))
262 return throwVMTypeError(state, throwScope);
263 return JSValue::encode(JSPannerNode::getConstructor(state->vm(), prototype->globalObject()));
264}
265
266bool setJSPannerNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
267{
268 VM& vm = state->vm();
269 auto throwScope = DECLARE_THROW_SCOPE(vm);
270 auto* prototype = jsDynamicCast<JSPannerNodePrototype*>(vm, JSValue::decode(thisValue));
271 if (UNLIKELY(!prototype)) {
272 throwVMTypeError(state, throwScope);
273 return false;
274 }
275 // Shadowing a built-in constructor
276 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
277}
278
279static inline JSValue jsPannerNodePanningModelGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
280{
281 UNUSED_PARAM(throwScope);
282 UNUSED_PARAM(state);
283 auto& impl = thisObject.wrapped();
284 JSValue result = toJS<IDLEnumeration<PanningModelType>>(state, throwScope, impl.panningModel());
285 return result;
286}
287
288EncodedJSValue jsPannerNodePanningModel(ExecState* state, EncodedJSValue thisValue, PropertyName)
289{
290 return IDLAttribute<JSPannerNode>::get<jsPannerNodePanningModelGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "panningModel");
291}
292
293static inline bool setJSPannerNodePanningModelSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
294{
295 UNUSED_PARAM(throwScope);
296 auto& impl = thisObject.wrapped();
297 auto optionalNativeValue = parseEnumeration<PanningModelType>(state, value);
298 RETURN_IF_EXCEPTION(throwScope, false);
299 if (UNLIKELY(!optionalNativeValue))
300 return false;
301 auto nativeValue = optionalNativeValue.value();
302 AttributeSetter::call(state, throwScope, [&] {
303 return impl.setPanningModel(WTFMove(nativeValue));
304 });
305 return true;
306}
307
308bool setJSPannerNodePanningModel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
309{
310 return IDLAttribute<JSPannerNode>::set<setJSPannerNodePanningModelSetter>(*state, thisValue, encodedValue, "panningModel");
311}
312
313static inline JSValue jsPannerNodeDistanceModelGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
314{
315 UNUSED_PARAM(throwScope);
316 UNUSED_PARAM(state);
317 auto& impl = thisObject.wrapped();
318 JSValue result = toJS<IDLEnumeration<DistanceModelType>>(state, throwScope, impl.distanceModel());
319 return result;
320}
321
322EncodedJSValue jsPannerNodeDistanceModel(ExecState* state, EncodedJSValue thisValue, PropertyName)
323{
324 return IDLAttribute<JSPannerNode>::get<jsPannerNodeDistanceModelGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "distanceModel");
325}
326
327static inline bool setJSPannerNodeDistanceModelSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
328{
329 UNUSED_PARAM(throwScope);
330 auto& impl = thisObject.wrapped();
331 auto optionalNativeValue = parseEnumeration<DistanceModelType>(state, value);
332 RETURN_IF_EXCEPTION(throwScope, false);
333 if (UNLIKELY(!optionalNativeValue))
334 return false;
335 auto nativeValue = optionalNativeValue.value();
336 AttributeSetter::call(state, throwScope, [&] {
337 return impl.setDistanceModel(WTFMove(nativeValue));
338 });
339 return true;
340}
341
342bool setJSPannerNodeDistanceModel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
343{
344 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeDistanceModelSetter>(*state, thisValue, encodedValue, "distanceModel");
345}
346
347static inline JSValue jsPannerNodeRefDistanceGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
348{
349 UNUSED_PARAM(throwScope);
350 UNUSED_PARAM(state);
351 auto& impl = thisObject.wrapped();
352 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.refDistance());
353 return result;
354}
355
356EncodedJSValue jsPannerNodeRefDistance(ExecState* state, EncodedJSValue thisValue, PropertyName)
357{
358 return IDLAttribute<JSPannerNode>::get<jsPannerNodeRefDistanceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "refDistance");
359}
360
361static inline bool setJSPannerNodeRefDistanceSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
362{
363 UNUSED_PARAM(throwScope);
364 auto& impl = thisObject.wrapped();
365 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
366 RETURN_IF_EXCEPTION(throwScope, false);
367 AttributeSetter::call(state, throwScope, [&] {
368 return impl.setRefDistance(WTFMove(nativeValue));
369 });
370 return true;
371}
372
373bool setJSPannerNodeRefDistance(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
374{
375 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeRefDistanceSetter>(*state, thisValue, encodedValue, "refDistance");
376}
377
378static inline JSValue jsPannerNodeMaxDistanceGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
379{
380 UNUSED_PARAM(throwScope);
381 UNUSED_PARAM(state);
382 auto& impl = thisObject.wrapped();
383 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.maxDistance());
384 return result;
385}
386
387EncodedJSValue jsPannerNodeMaxDistance(ExecState* state, EncodedJSValue thisValue, PropertyName)
388{
389 return IDLAttribute<JSPannerNode>::get<jsPannerNodeMaxDistanceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "maxDistance");
390}
391
392static inline bool setJSPannerNodeMaxDistanceSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
393{
394 UNUSED_PARAM(throwScope);
395 auto& impl = thisObject.wrapped();
396 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
397 RETURN_IF_EXCEPTION(throwScope, false);
398 AttributeSetter::call(state, throwScope, [&] {
399 return impl.setMaxDistance(WTFMove(nativeValue));
400 });
401 return true;
402}
403
404bool setJSPannerNodeMaxDistance(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
405{
406 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeMaxDistanceSetter>(*state, thisValue, encodedValue, "maxDistance");
407}
408
409static inline JSValue jsPannerNodeRolloffFactorGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
410{
411 UNUSED_PARAM(throwScope);
412 UNUSED_PARAM(state);
413 auto& impl = thisObject.wrapped();
414 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.rolloffFactor());
415 return result;
416}
417
418EncodedJSValue jsPannerNodeRolloffFactor(ExecState* state, EncodedJSValue thisValue, PropertyName)
419{
420 return IDLAttribute<JSPannerNode>::get<jsPannerNodeRolloffFactorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rolloffFactor");
421}
422
423static inline bool setJSPannerNodeRolloffFactorSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
424{
425 UNUSED_PARAM(throwScope);
426 auto& impl = thisObject.wrapped();
427 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
428 RETURN_IF_EXCEPTION(throwScope, false);
429 AttributeSetter::call(state, throwScope, [&] {
430 return impl.setRolloffFactor(WTFMove(nativeValue));
431 });
432 return true;
433}
434
435bool setJSPannerNodeRolloffFactor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
436{
437 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeRolloffFactorSetter>(*state, thisValue, encodedValue, "rolloffFactor");
438}
439
440static inline JSValue jsPannerNodeConeInnerAngleGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
441{
442 UNUSED_PARAM(throwScope);
443 UNUSED_PARAM(state);
444 auto& impl = thisObject.wrapped();
445 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.coneInnerAngle());
446 return result;
447}
448
449EncodedJSValue jsPannerNodeConeInnerAngle(ExecState* state, EncodedJSValue thisValue, PropertyName)
450{
451 return IDLAttribute<JSPannerNode>::get<jsPannerNodeConeInnerAngleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "coneInnerAngle");
452}
453
454static inline bool setJSPannerNodeConeInnerAngleSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
455{
456 UNUSED_PARAM(throwScope);
457 auto& impl = thisObject.wrapped();
458 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
459 RETURN_IF_EXCEPTION(throwScope, false);
460 AttributeSetter::call(state, throwScope, [&] {
461 return impl.setConeInnerAngle(WTFMove(nativeValue));
462 });
463 return true;
464}
465
466bool setJSPannerNodeConeInnerAngle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
467{
468 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeConeInnerAngleSetter>(*state, thisValue, encodedValue, "coneInnerAngle");
469}
470
471static inline JSValue jsPannerNodeConeOuterAngleGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
472{
473 UNUSED_PARAM(throwScope);
474 UNUSED_PARAM(state);
475 auto& impl = thisObject.wrapped();
476 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.coneOuterAngle());
477 return result;
478}
479
480EncodedJSValue jsPannerNodeConeOuterAngle(ExecState* state, EncodedJSValue thisValue, PropertyName)
481{
482 return IDLAttribute<JSPannerNode>::get<jsPannerNodeConeOuterAngleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "coneOuterAngle");
483}
484
485static inline bool setJSPannerNodeConeOuterAngleSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
486{
487 UNUSED_PARAM(throwScope);
488 auto& impl = thisObject.wrapped();
489 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
490 RETURN_IF_EXCEPTION(throwScope, false);
491 AttributeSetter::call(state, throwScope, [&] {
492 return impl.setConeOuterAngle(WTFMove(nativeValue));
493 });
494 return true;
495}
496
497bool setJSPannerNodeConeOuterAngle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
498{
499 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeConeOuterAngleSetter>(*state, thisValue, encodedValue, "coneOuterAngle");
500}
501
502static inline JSValue jsPannerNodeConeOuterGainGetter(ExecState& state, JSPannerNode& thisObject, ThrowScope& throwScope)
503{
504 UNUSED_PARAM(throwScope);
505 UNUSED_PARAM(state);
506 auto& impl = thisObject.wrapped();
507 JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.coneOuterGain());
508 return result;
509}
510
511EncodedJSValue jsPannerNodeConeOuterGain(ExecState* state, EncodedJSValue thisValue, PropertyName)
512{
513 return IDLAttribute<JSPannerNode>::get<jsPannerNodeConeOuterGainGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "coneOuterGain");
514}
515
516static inline bool setJSPannerNodeConeOuterGainSetter(ExecState& state, JSPannerNode& thisObject, JSValue value, ThrowScope& throwScope)
517{
518 UNUSED_PARAM(throwScope);
519 auto& impl = thisObject.wrapped();
520 auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
521 RETURN_IF_EXCEPTION(throwScope, false);
522 AttributeSetter::call(state, throwScope, [&] {
523 return impl.setConeOuterGain(WTFMove(nativeValue));
524 });
525 return true;
526}
527
528bool setJSPannerNodeConeOuterGain(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
529{
530 return IDLAttribute<JSPannerNode>::set<setJSPannerNodeConeOuterGainSetter>(*state, thisValue, encodedValue, "coneOuterGain");
531}
532
533static inline JSC::EncodedJSValue jsPannerNodePrototypeFunctionSetPositionBody(JSC::ExecState* state, typename IDLOperation<JSPannerNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
534{
535 UNUSED_PARAM(state);
536 UNUSED_PARAM(throwScope);
537 auto& impl = castedThis->wrapped();
538 if (UNLIKELY(state->argumentCount() < 3))
539 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
540 auto x = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
541 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
542 auto y = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
543 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
544 auto z = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(2));
545 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
546 impl.setPosition(WTFMove(x), WTFMove(y), WTFMove(z));
547 return JSValue::encode(jsUndefined());
548}
549
550EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetPosition(ExecState* state)
551{
552 return IDLOperation<JSPannerNode>::call<jsPannerNodePrototypeFunctionSetPositionBody>(*state, "setPosition");
553}
554
555static inline JSC::EncodedJSValue jsPannerNodePrototypeFunctionSetOrientationBody(JSC::ExecState* state, typename IDLOperation<JSPannerNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
556{
557 UNUSED_PARAM(state);
558 UNUSED_PARAM(throwScope);
559 auto& impl = castedThis->wrapped();
560 if (UNLIKELY(state->argumentCount() < 3))
561 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
562 auto x = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
563 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
564 auto y = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
565 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
566 auto z = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(2));
567 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
568 impl.setOrientation(WTFMove(x), WTFMove(y), WTFMove(z));
569 return JSValue::encode(jsUndefined());
570}
571
572EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetOrientation(ExecState* state)
573{
574 return IDLOperation<JSPannerNode>::call<jsPannerNodePrototypeFunctionSetOrientationBody>(*state, "setOrientation");
575}
576
577static inline JSC::EncodedJSValue jsPannerNodePrototypeFunctionSetVelocityBody(JSC::ExecState* state, typename IDLOperation<JSPannerNode>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
578{
579 UNUSED_PARAM(state);
580 UNUSED_PARAM(throwScope);
581 auto& impl = castedThis->wrapped();
582 if (UNLIKELY(state->argumentCount() < 3))
583 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
584 auto x = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(0));
585 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
586 auto y = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(1));
587 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
588 auto z = convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(2));
589 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
590 impl.setVelocity(WTFMove(x), WTFMove(y), WTFMove(z));
591 return JSValue::encode(jsUndefined());
592}
593
594EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetVelocity(ExecState* state)
595{
596 return IDLOperation<JSPannerNode>::call<jsPannerNodePrototypeFunctionSetVelocityBody>(*state, "setVelocity");
597}
598
599void JSPannerNode::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
600{
601 auto* thisObject = jsCast<JSPannerNode*>(cell);
602 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
603 if (thisObject->scriptExecutionContext())
604 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
605 Base::heapSnapshot(cell, builder);
606}
607
608#if ENABLE(BINDING_INTEGRITY)
609#if PLATFORM(WIN)
610#pragma warning(disable: 4483)
611extern "C" { extern void (*const __identifier("??_7PannerNode@WebCore@@6B@")[])(); }
612#else
613extern "C" { extern void* _ZTVN7WebCore10PannerNodeE[]; }
614#endif
615#endif
616
617JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PannerNode>&& impl)
618{
619
620#if ENABLE(BINDING_INTEGRITY)
621 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
622#if PLATFORM(WIN)
623 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7PannerNode@WebCore@@6B@"));
624#else
625 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore10PannerNodeE[2]);
626#endif
627
628 // If this fails PannerNode does not have a vtable, so you need to add the
629 // ImplementationLacksVTable attribute to the interface definition
630 static_assert(std::is_polymorphic<PannerNode>::value, "PannerNode is not polymorphic");
631
632 // If you hit this assertion you either have a use after free bug, or
633 // PannerNode has subclasses. If PannerNode has subclasses that get passed
634 // to toJS() we currently require PannerNode you to opt out of binding hardening
635 // by adding the SkipVTableValidation attribute to the interface IDL definition
636 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
637#endif
638 return createWrapper<PannerNode>(globalObject, WTFMove(impl));
639}
640
641JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PannerNode& impl)
642{
643 return wrap(state, globalObject, impl);
644}
645
646
647}
648
649#endif // ENABLE(WEB_AUDIO)
650