blob: 9b4858ce4b9eab5cc53350772a80d2422ce4f99d [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(VIDEO_TRACK)
#include "JSVTTRegion.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSDOMConvert.h"
#include "JSTextTrack.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsVTTRegionTrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsVTTRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionRegionAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionRegionAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionRegionAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionRegionAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionViewportAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionViewportAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionViewportAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionViewportAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionScroll(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionScroll(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsVTTRegionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSVTTRegionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSVTTRegionPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSVTTRegionPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSVTTRegionPrototype* ptr = new (NotNull, JSC::allocateCell<JSVTTRegionPrototype>(vm.heap)) JSVTTRegionPrototype(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:
JSVTTRegionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSVTTRegion> JSVTTRegionConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSVTTRegionConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
auto* castedThis = jsCast<JSVTTRegionConstructor*>(state->callee());
ASSERT(castedThis);
ScriptExecutionContext* context = castedThis->scriptExecutionContext();
if (UNLIKELY(!context))
return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "VTTRegion");
auto object = VTTRegion::create(*context);
return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
}
template<> JSValue JSVTTRegionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSVTTRegionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSVTTRegion::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("VTTRegion"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSVTTRegionConstructor::s_info = { "VTTRegion", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTRegionConstructor) };
/* Hash table for prototype */
static const HashTableValue JSVTTRegionPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionConstructor) } },
{ "track", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionTrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "id", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionId) } },
{ "width", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionWidth) } },
{ "height", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionHeight) } },
{ "regionAnchorX", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionRegionAnchorX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionRegionAnchorX) } },
{ "regionAnchorY", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionRegionAnchorY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionRegionAnchorY) } },
{ "viewportAnchorX", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionViewportAnchorX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionViewportAnchorX) } },
{ "viewportAnchorY", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionViewportAnchorY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionViewportAnchorY) } },
{ "scroll", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionScroll), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionScroll) } },
};
const ClassInfo JSVTTRegionPrototype::s_info = { "VTTRegionPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTRegionPrototype) };
void JSVTTRegionPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSVTTRegionPrototypeTableValues, *this);
}
const ClassInfo JSVTTRegion::s_info = { "VTTRegion", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTRegion) };
JSVTTRegion::JSVTTRegion(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VTTRegion>&& impl)
: JSDOMWrapper<VTTRegion>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSVTTRegion::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSVTTRegionPrototype::create(vm, globalObject, JSVTTRegionPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSVTTRegion::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSVTTRegion>(vm, globalObject);
}
void JSVTTRegion::destroy(JSC::JSCell* cell)
{
JSVTTRegion* thisObject = static_cast<JSVTTRegion*>(cell);
thisObject->JSVTTRegion::~JSVTTRegion();
}
EncodedJSValue jsVTTRegionTrack(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "track");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), impl.track());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionId(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "id");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.id());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionWidth(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "width");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.width());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionHeight(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "height");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.height());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionRegionAnchorX(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "regionAnchorX");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.regionAnchorX());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionRegionAnchorY(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "regionAnchorY");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.regionAnchorY());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionViewportAnchorX(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "viewportAnchorX");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.viewportAnchorX());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionViewportAnchorY(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "viewportAnchorY");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.viewportAnchorY());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionScroll(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<JSVTTRegion*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "VTTRegion", "scroll");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.scroll());
return JSValue::encode(result);
}
EncodedJSValue jsVTTRegionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSVTTRegionPrototype* domObject = jsDynamicCast<JSVTTRegionPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSVTTRegion::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSVTTRegionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSVTTRegionPrototype* domObject = jsDynamicCast<JSVTTRegionPrototype*>(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 setJSVTTRegionId(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "id");
}
auto& impl = castedThis->wrapped();
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setId(WTFMove(nativeValue));
return true;
}
bool setJSVTTRegionWidth(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "width");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setWidth(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionHeight(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "height");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setHeight(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionRegionAnchorX(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "regionAnchorX");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setRegionAnchorX(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionRegionAnchorY(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "regionAnchorY");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setRegionAnchorY(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionViewportAnchorX(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "viewportAnchorX");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setViewportAnchorX(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionViewportAnchorY(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "viewportAnchorY");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setViewportAnchorY(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
bool setJSVTTRegionScroll(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);
JSVTTRegion* castedThis = jsDynamicCast<JSVTTRegion*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "VTTRegion", "scroll");
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
auto nativeValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, false);
impl.setScroll(WTFMove(nativeValue), ec);
setDOMException(state, throwScope, ec);
return true;
}
JSValue JSVTTRegion::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSVTTRegionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
bool JSVTTRegionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSVTTRegionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsVTTRegion = jsCast<JSVTTRegion*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsVTTRegion->wrapped(), jsVTTRegion);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7VTTRegion@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore9VTTRegionE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VTTRegion>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7VTTRegion@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore9VTTRegionE[2];
#if COMPILER(CLANG)
// If this fails VTTRegion does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(VTTRegion), "VTTRegion is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// VTTRegion has subclasses. If VTTRegion has subclasses that get passed
// to toJS() we currently require VTTRegion you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<VTTRegion>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VTTRegion& impl)
{
return wrap(state, globalObject, impl);
}
VTTRegion* JSVTTRegion::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSVTTRegion*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(VIDEO_TRACK)