/* 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) #include "JSHTMLVideoElement.h" #include "ExceptionCode.h" #include "HTMLNames.h" #include "HTMLVideoElement.h" #include "JSDOMBinding.h" #include "KURL.h" #include #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSHTMLVideoElement); /* Hash table */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLVideoElementTableValues[9] = { { "width", DontDelete, (intptr_t)static_cast(jsHTMLVideoElementWidth), (intptr_t)setJSHTMLVideoElementWidth THUNK_GENERATOR(0) }, { "height", DontDelete, (intptr_t)static_cast(jsHTMLVideoElementHeight), (intptr_t)setJSHTMLVideoElementHeight THUNK_GENERATOR(0) }, { "videoWidth", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLVideoElementVideoWidth), (intptr_t)0 THUNK_GENERATOR(0) }, { "videoHeight", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLVideoElementVideoHeight), (intptr_t)0 THUNK_GENERATOR(0) }, { "poster", DontDelete, (intptr_t)static_cast(jsHTMLVideoElementPoster), (intptr_t)setJSHTMLVideoElementPoster THUNK_GENERATOR(0) }, { "webkitSupportsFullscreen", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLVideoElementWebkitSupportsFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, { "webkitDisplayingFullscreen", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLVideoElementWebkitDisplayingFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsHTMLVideoElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementTable = { 18, 15, JSHTMLVideoElementTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLVideoElementConstructorTableValues[1] = { { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementConstructorTable = { 1, 0, JSHTMLVideoElementConstructorTableValues, 0 }; class JSHTMLVideoElementConstructor : public DOMConstructorObject { public: JSHTMLVideoElementConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; const ClassInfo JSHTMLVideoElementConstructor::s_info = { "HTMLVideoElementConstructor", &DOMConstructorObject::s_info, &JSHTMLVideoElementConstructorTable, 0 }; JSHTMLVideoElementConstructor::JSHTMLVideoElementConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { ASSERT(inherits(&s_info)); putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLVideoElementPrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSHTMLVideoElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSHTMLVideoElementConstructorTable, this, propertyName, slot); } bool JSHTMLVideoElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSHTMLVideoElementConstructorTable, this, propertyName, descriptor); } /* Hash table for prototype */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLVideoElementPrototypeTableValues[5] = { { "webkitEnterFullscreen", DontDelete | Function, (intptr_t)static_cast(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, { "webkitExitFullscreen", DontDelete | Function, (intptr_t)static_cast(jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, { "webkitEnterFullScreen", DontDelete | Function, (intptr_t)static_cast(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen), (intptr_t)0 THUNK_GENERATOR(0) }, { "webkitExitFullScreen", DontDelete | Function, (intptr_t)static_cast(jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementPrototypeTable = { 8, 7, JSHTMLVideoElementPrototypeTableValues, 0 }; const ClassInfo JSHTMLVideoElementPrototype::s_info = { "HTMLVideoElementPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSHTMLVideoElementPrototypeTable, 0 }; JSObject* JSHTMLVideoElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } bool JSHTMLVideoElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticFunctionSlot(exec, &JSHTMLVideoElementPrototypeTable, this, propertyName, slot); } bool JSHTMLVideoElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor(exec, &JSHTMLVideoElementPrototypeTable, this, propertyName, descriptor); } const ClassInfo JSHTMLVideoElement::s_info = { "HTMLVideoElement", &JSHTMLMediaElement::s_info, &JSHTMLVideoElementTable, 0 }; JSHTMLVideoElement::JSHTMLVideoElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) : JSHTMLMediaElement(structure, globalObject, impl) { ASSERT(inherits(&s_info)); } JSObject* JSHTMLVideoElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { return new (exec) JSHTMLVideoElementPrototype(exec->globalData(), globalObject, JSHTMLVideoElementPrototype::createStructure(exec->globalData(), JSHTMLMediaElementPrototype::self(exec, globalObject))); } bool JSHTMLVideoElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSHTMLVideoElementTable, this, propertyName, slot); } bool JSHTMLVideoElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSHTMLVideoElementTable, this, propertyName, descriptor); } JSValue jsHTMLVideoElementWidth(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::widthAttr))); return result; } JSValue jsHTMLVideoElementHeight(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::heightAttr))); return result; } JSValue jsHTMLVideoElementVideoWidth(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->videoWidth()); return result; } JSValue jsHTMLVideoElementVideoHeight(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(imp->videoHeight()); return result; } JSValue jsHTMLVideoElementPoster(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsString(exec, imp->getURLAttribute(WebCore::HTMLNames::posterAttr)); return result; } JSValue jsHTMLVideoElementWebkitSupportsFullscreen(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsBoolean(imp->webkitSupportsFullscreen()); return result; } JSValue jsHTMLVideoElementWebkitDisplayingFullscreen(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); HTMLVideoElement* imp = static_cast(castedThis->impl()); JSValue result = jsBoolean(imp->webkitDisplayingFullscreen()); return result; } JSValue jsHTMLVideoElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLVideoElement* domObject = static_cast(asObject(slotBase)); return JSHTMLVideoElement::getConstructor(exec, domObject->globalObject()); } void JSHTMLVideoElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { lookupPut(exec, propertyName, value, &JSHTMLVideoElementTable, this, slot); } void setJSHTMLVideoElementWidth(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLVideoElement* castedThis = static_cast(thisObject); HTMLVideoElement* imp = static_cast(castedThis->impl()); imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::widthAttr, value.toUInt32(exec)); } void setJSHTMLVideoElementHeight(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLVideoElement* castedThis = static_cast(thisObject); HTMLVideoElement* imp = static_cast(castedThis->impl()); imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::heightAttr, value.toUInt32(exec)); } void setJSHTMLVideoElementPoster(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLVideoElement* castedThis = static_cast(thisObject); HTMLVideoElement* imp = static_cast(castedThis->impl()); imp->setAttribute(WebCore::HTMLNames::posterAttr, valueToStringWithNullCheck(exec, value)); } JSValue JSHTMLVideoElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor(exec, static_cast(globalObject)); } EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) return throwVMTypeError(exec); JSHTMLVideoElement* castedThis = static_cast(asObject(thisValue)); HTMLVideoElement* imp = static_cast(castedThis->impl()); ExceptionCode ec = 0; imp->webkitEnterFullscreen(processingUserGesture(), ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) return throwVMTypeError(exec); JSHTMLVideoElement* castedThis = static_cast(asObject(thisValue)); HTMLVideoElement* imp = static_cast(castedThis->impl()); imp->webkitExitFullscreen(); return JSValue::encode(jsUndefined()); } EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) return throwVMTypeError(exec); JSHTMLVideoElement* castedThis = static_cast(asObject(thisValue)); HTMLVideoElement* imp = static_cast(castedThis->impl()); ExceptionCode ec = 0; imp->webkitEnterFullScreen(processingUserGesture(), ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) return throwVMTypeError(exec); JSHTMLVideoElement* castedThis = static_cast(asObject(thisValue)); HTMLVideoElement* imp = static_cast(castedThis->impl()); imp->webkitExitFullScreen(); return JSValue::encode(jsUndefined()); } HTMLVideoElement* toHTMLVideoElement(JSC::JSValue value) { return value.inherits(&JSHTMLVideoElement::s_info) ? static_cast(asObject(value))->impl() : 0; } } #endif // ENABLE(VIDEO)