| /* |
| 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 "JSVTTCue.h" |
| |
| #include "DocumentFragment.h" |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "JSDocumentFragment.h" |
| #include "URL.h" |
| #include <runtime/Error.h> |
| #include <runtime/JSString.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Functions |
| |
| JSC::EncodedJSValue JSC_HOST_CALL jsVTTCuePrototypeFunctionGetCueAsHTML(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsVTTCueVertical(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueVertical(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueSnapToLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueSnapToLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCuePosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCuePosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsVTTCueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSVTTCueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSVTTCuePrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSVTTCuePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSVTTCuePrototype* ptr = new (NotNull, JSC::allocateCell<JSVTTCuePrototype>(vm.heap)) JSVTTCuePrototype(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: |
| JSVTTCuePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructor<JSVTTCue> JSVTTCueConstructor; |
| |
| template<> EncodedJSValue JSC_HOST_CALL JSVTTCueConstructor::construct(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| auto* castedThis = jsCast<JSVTTCueConstructor*>(state->callee()); |
| ASSERT(castedThis); |
| if (UNLIKELY(state->argumentCount() < 3)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| auto startTime = convert<double>(*state, state->uncheckedArgument(0), ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto endTime = convert<double>(*state, state->uncheckedArgument(1), ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto text = state->uncheckedArgument(2).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| ScriptExecutionContext* context = castedThis->scriptExecutionContext(); |
| if (UNLIKELY(!context)) |
| return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "VTTCue"); |
| auto object = VTTCue::create(*context, WTFMove(startTime), WTFMove(endTime), WTFMove(text)); |
| return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); |
| } |
| |
| template<> JSValue JSVTTCueConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSTextTrackCue::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSVTTCueConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSVTTCue::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("VTTCue"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(3), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSVTTCueConstructor::s_info = { "VTTCue", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTCueConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSVTTCuePrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueConstructor) } }, |
| { "vertical", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueVertical), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueVertical) } }, |
| { "snapToLines", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueSnapToLines), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueSnapToLines) } }, |
| { "line", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueLine), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueLine) } }, |
| { "position", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCuePosition), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCuePosition) } }, |
| { "size", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueSize) } }, |
| { "align", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueAlign) } }, |
| { "text", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueText) } }, |
| { "regionId", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueRegionId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueRegionId) } }, |
| { "getCueAsHTML", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsVTTCuePrototypeFunctionGetCueAsHTML), (intptr_t) (0) } }, |
| }; |
| |
| const ClassInfo JSVTTCuePrototype::s_info = { "VTTCuePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTCuePrototype) }; |
| |
| void JSVTTCuePrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSVTTCuePrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSVTTCue::s_info = { "VTTCue", &Base::s_info, 0, CREATE_METHOD_TABLE(JSVTTCue) }; |
| |
| JSVTTCue::JSVTTCue(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VTTCue>&& impl) |
| : JSTextTrackCue(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSVTTCue::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSVTTCuePrototype::create(vm, globalObject, JSVTTCuePrototype::createStructure(vm, globalObject, JSTextTrackCue::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSVTTCue::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSVTTCue>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsVTTCueVertical(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "vertical"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.vertical()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueSnapToLines(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "snapToLines"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsBoolean(impl.snapToLines()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueLine(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "line"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.line()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCuePosition(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "position"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.position()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueSize(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "size"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.size()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueAlign(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "align"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.align()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueText(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "text"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.text()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueRegionId(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<JSVTTCue*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "VTTCue", "regionId"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.regionId()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsVTTCueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSVTTCuePrototype* domObject = jsDynamicCast<JSVTTCuePrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSVTTCue::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSVTTCueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSVTTCuePrototype* domObject = jsDynamicCast<JSVTTCuePrototype*>(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 setJSVTTCueVertical(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "vertical"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setVertical(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueSnapToLines(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "snapToLines"); |
| } |
| auto& impl = castedThis->wrapped(); |
| auto nativeValue = value.toBoolean(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setSnapToLines(WTFMove(nativeValue)); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueLine(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "line"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setLine(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSVTTCuePosition(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "position"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setPosition(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueSize(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "size"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setSize(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueAlign(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "align"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setAlign(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueText(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "text"); |
| } |
| auto& impl = castedThis->wrapped(); |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setText(WTFMove(nativeValue)); |
| return true; |
| } |
| |
| |
| bool setJSVTTCueRegionId(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); |
| JSVTTCue* castedThis = jsDynamicCast<JSVTTCue*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "VTTCue", "regionId"); |
| } |
| auto& impl = castedThis->wrapped(); |
| auto nativeValue = value.toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setRegionId(WTFMove(nativeValue)); |
| return true; |
| } |
| |
| |
| JSValue JSVTTCue::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSVTTCueConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsVTTCuePrototypeFunctionGetCueAsHTML(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSVTTCue*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "VTTCue", "getCueAsHTML"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSVTTCue::info()); |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.getCueAsHTML()); |
| return JSValue::encode(result); |
| } |
| |
| void JSVTTCue::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSVTTCue*>(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("??_7VTTCue@WebCore@@6B@")[])(); } |
| #else |
| extern "C" { extern void* _ZTVN7WebCore6VTTCueE[]; } |
| #endif |
| #endif |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VTTCue>&& impl) |
| { |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| #if PLATFORM(WIN) |
| void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7VTTCue@WebCore@@6B@")); |
| #else |
| void* expectedVTablePointer = &_ZTVN7WebCore6VTTCueE[2]; |
| #if COMPILER(CLANG) |
| // If this fails VTTCue does not have a vtable, so you need to add the |
| // ImplementationLacksVTable attribute to the interface definition |
| static_assert(__is_polymorphic(VTTCue), "VTTCue is not polymorphic"); |
| #endif |
| #endif |
| // If you hit this assertion you either have a use after free bug, or |
| // VTTCue has subclasses. If VTTCue has subclasses that get passed |
| // to toJS() we currently require VTTCue you to opt out of binding hardening |
| // by adding the SkipVTableValidation attribute to the interface IDL definition |
| RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| #endif |
| return createWrapper<VTTCue>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VTTCue& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| VTTCue* JSVTTCue::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSVTTCue*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |
| |
| #endif // ENABLE(VIDEO_TRACK) |