blob: 9fb2021e1dd7aed825c9ec6fd6ff8eafe25cc85b [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "JSPannerNode.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
template<typename T> Optional<T> parse(ExecState&, JSValue);
template<typename T> const char* expectedEnumerationValues();
#if ENABLE(WEB_AUDIO)
JSString* jsStringWithCache(ExecState*, PanningModelType);
JSString* jsStringWithCache(ExecState* state, PanningModelType enumerationValue)
{
static NeverDestroyed<const String> values[] = {
ASCIILiteral("equalpower"),
ASCIILiteral("HRTF"),
};
static_assert(static_cast<size_t>(PanningModelType::Equalpower) == 0, "PanningModelType::Equalpower is not 0 as expected");
static_assert(static_cast<size_t>(PanningModelType::HRTF) == 1, "PanningModelType::HRTF is not 1 as expected");
ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
}
template<> struct JSValueTraits<PanningModelType> {
static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, PanningModelType value) { return jsStringWithCache(state, value); }
};
template<> Optional<PanningModelType> parse<PanningModelType>(ExecState& state, JSValue value)
{
auto stringValue = value.toWTFString(&state);
if (stringValue == "equalpower")
return PanningModelType::Equalpower;
if (stringValue == "HRTF")
return PanningModelType::HRTF;
return Nullopt;
}
template<> PanningModelType convert<PanningModelType>(ExecState& state, JSValue value)
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto result = parse<PanningModelType>(state, value);
if (UNLIKELY(!result)) {
throwTypeError(&state, throwScope);
return { };
}
return result.value();
}
template<> inline const char* expectedEnumerationValues<PanningModelType>()
{
return "\"equalpower\", \"HRTF\"";
}
#endif
#if ENABLE(WEB_AUDIO)
JSString* jsStringWithCache(ExecState*, DistanceModelType);
JSString* jsStringWithCache(ExecState* state, DistanceModelType enumerationValue)
{
static NeverDestroyed<const String> values[] = {
ASCIILiteral("linear"),
ASCIILiteral("inverse"),
ASCIILiteral("exponential"),
};
static_assert(static_cast<size_t>(DistanceModelType::Linear) == 0, "DistanceModelType::Linear is not 0 as expected");
static_assert(static_cast<size_t>(DistanceModelType::Inverse) == 1, "DistanceModelType::Inverse is not 1 as expected");
static_assert(static_cast<size_t>(DistanceModelType::Exponential) == 2, "DistanceModelType::Exponential is not 2 as expected");
ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
}
template<> struct JSValueTraits<DistanceModelType> {
static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, DistanceModelType value) { return jsStringWithCache(state, value); }
};
template<> Optional<DistanceModelType> parse<DistanceModelType>(ExecState& state, JSValue value)
{
auto stringValue = value.toWTFString(&state);
if (stringValue == "linear")
return DistanceModelType::Linear;
if (stringValue == "inverse")
return DistanceModelType::Inverse;
if (stringValue == "exponential")
return DistanceModelType::Exponential;
return Nullopt;
}
template<> DistanceModelType convert<DistanceModelType>(ExecState& state, JSValue value)
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto result = parse<DistanceModelType>(state, value);
if (UNLIKELY(!result)) {
throwTypeError(&state, throwScope);
return { };
}
return result.value();
}
template<> inline const char* expectedEnumerationValues<DistanceModelType>()
{
return "\"linear\", \"inverse\", \"exponential\"";
}
#endif
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetPosition(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetOrientation(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetVelocity(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsPannerNodePanningModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodePanningModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeDistanceModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeDistanceModel(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeRefDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeRefDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeMaxDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeMaxDistance(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeRolloffFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeRolloffFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeConeInnerAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeConeInnerAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeConeOuterAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeConeOuterAngle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeConeOuterGain(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeConeOuterGain(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsPannerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSPannerNodeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSPannerNodePrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSPannerNodePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSPannerNodePrototype* ptr = new (NotNull, JSC::allocateCell<JSPannerNodePrototype>(vm.heap)) JSPannerNodePrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSPannerNodePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSPannerNode> JSPannerNodeConstructor;
template<> JSValue JSPannerNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
return JSAudioNode::getConstructor(vm, &globalObject);
}
template<> void JSPannerNodeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSPannerNode::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("webkitAudioPannerNode"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSPannerNodeConstructor::s_info = { "webkitAudioPannerNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPannerNodeConstructor) };
/* Hash table for prototype */
static const HashTableValue JSPannerNodePrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConstructor) } },
{ "panningModel", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodePanningModel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodePanningModel) } },
{ "distanceModel", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeDistanceModel), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeDistanceModel) } },
{ "refDistance", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeRefDistance), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeRefDistance) } },
{ "maxDistance", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeMaxDistance), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeMaxDistance) } },
{ "rolloffFactor", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeRolloffFactor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeRolloffFactor) } },
{ "coneInnerAngle", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeInnerAngle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeInnerAngle) } },
{ "coneOuterAngle", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeOuterAngle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeOuterAngle) } },
{ "coneOuterGain", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPannerNodeConeOuterGain), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPannerNodeConeOuterGain) } },
{ "setPosition", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPannerNodePrototypeFunctionSetPosition), (intptr_t) (3) } },
{ "setOrientation", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPannerNodePrototypeFunctionSetOrientation), (intptr_t) (3) } },
{ "setVelocity", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPannerNodePrototypeFunctionSetVelocity), (intptr_t) (3) } },
};
const ClassInfo JSPannerNodePrototype::s_info = { "webkitAudioPannerNodePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPannerNodePrototype) };
void JSPannerNodePrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSPannerNodePrototypeTableValues, *this);
}
const ClassInfo JSPannerNode::s_info = { "webkitAudioPannerNode", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPannerNode) };
JSPannerNode::JSPannerNode(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PannerNode>&& impl)
: JSAudioNode(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSPannerNode::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSPannerNodePrototype::create(vm, globalObject, JSPannerNodePrototype::createStructure(vm, globalObject, JSAudioNode::prototype(vm, globalObject)));
}
JSObject* JSPannerNode::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSPannerNode>(vm, globalObject);
}
EncodedJSValue jsPannerNodePanningModel(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "panningModel");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.panningModel());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeDistanceModel(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "distanceModel");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.distanceModel());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeRefDistance(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "refDistance");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.refDistance());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeMaxDistance(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "maxDistance");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.maxDistance());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeRolloffFactor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "rolloffFactor");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.rolloffFactor());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeConeInnerAngle(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneInnerAngle");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.coneInnerAngle());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeConeOuterAngle(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneOuterAngle");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.coneOuterAngle());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeConeOuterGain(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSPannerNode*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneOuterGain");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.coneOuterGain());
return JSValue::encode(result);
}
EncodedJSValue jsPannerNodeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSPannerNodePrototype* domObject = jsDynamicCast<JSPannerNodePrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSPannerNode::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSPannerNodeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSPannerNodePrototype* domObject = jsDynamicCast<JSPannerNodePrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
bool setJSPannerNodePanningModel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "panningModel");
}
auto& impl = castedThis->wrapped();
auto nativeValue = parse<PanningModelType>(*state, value);
RETURN_IF_EXCEPTION(throwScope, false);
if (UNLIKELY(!nativeValue))
return false;
impl.setPanningModel(nativeValue.value());
return true;
}
bool setJSPannerNodeDistanceModel(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "distanceModel");
}
auto& impl = castedThis->wrapped();
auto nativeValue = parse<DistanceModelType>(*state, value);
RETURN_IF_EXCEPTION(throwScope, false);
if (UNLIKELY(!nativeValue))
return false;
impl.setDistanceModel(nativeValue.value());
return true;
}
bool setJSPannerNodeRefDistance(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "refDistance");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setRefDistance(WTFMove(nativeValue));
return true;
}
bool setJSPannerNodeMaxDistance(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "maxDistance");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setMaxDistance(WTFMove(nativeValue));
return true;
}
bool setJSPannerNodeRolloffFactor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "rolloffFactor");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setRolloffFactor(WTFMove(nativeValue));
return true;
}
bool setJSPannerNodeConeInnerAngle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneInnerAngle");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setConeInnerAngle(WTFMove(nativeValue));
return true;
}
bool setJSPannerNodeConeOuterAngle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneOuterAngle");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setConeOuterAngle(WTFMove(nativeValue));
return true;
}
bool setJSPannerNodeConeOuterGain(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(thisValue);
JSPannerNode* castedThis = jsDynamicCast<JSPannerNode*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "webkitAudioPannerNode", "coneOuterGain");
}
auto& impl = castedThis->wrapped();
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setConeOuterGain(WTFMove(nativeValue));
return true;
}
JSValue JSPannerNode::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSPannerNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetPosition(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSPannerNode*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "webkitAudioPannerNode", "setPosition");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSPannerNode::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setPosition(WTFMove(x), WTFMove(y), WTFMove(z));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetOrientation(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSPannerNode*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "webkitAudioPannerNode", "setOrientation");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSPannerNode::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setOrientation(WTFMove(x), WTFMove(y), WTFMove(z));
return JSValue::encode(jsUndefined());
}
EncodedJSValue JSC_HOST_CALL jsPannerNodePrototypeFunctionSetVelocity(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSPannerNode*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "webkitAudioPannerNode", "setVelocity");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSPannerNode::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto x = convert<float>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto y = convert<float>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto z = convert<float>(*state, state->uncheckedArgument(2), ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setVelocity(WTFMove(x), WTFMove(y), WTFMove(z));
return JSValue::encode(jsUndefined());
}
void JSPannerNode::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSPannerNode*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->wrapped().visitJSEventListeners(visitor);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7PannerNode@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore10PannerNodeE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PannerNode>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7PannerNode@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore10PannerNodeE[2];
#if COMPILER(CLANG)
// If this fails PannerNode does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(PannerNode), "PannerNode is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// PannerNode has subclasses. If PannerNode has subclasses that get passed
// to toJS() we currently require PannerNode you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<PannerNode>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PannerNode& impl)
{
return wrap(state, globalObject, impl);
}
}
#endif // ENABLE(WEB_AUDIO)