| /* |
| 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" |
| #include "JSHTMLProgressElement.h" |
| |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "JSNodeList.h" |
| #include "NameNodeList.h" |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsHTMLProgressElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSHTMLProgressElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsHTMLProgressElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSHTMLProgressElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsHTMLProgressElementPosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsHTMLProgressElementLabels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsHTMLProgressElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSHTMLProgressElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSHTMLProgressElementPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSHTMLProgressElementPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSHTMLProgressElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLProgressElementPrototype>(vm.heap)) JSHTMLProgressElementPrototype(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: |
| JSHTMLProgressElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSHTMLProgressElement> JSHTMLProgressElementConstructor; |
| |
| template<> JSValue JSHTMLProgressElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSHTMLElement::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSHTMLProgressElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSHTMLProgressElement::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("HTMLProgressElement"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSHTMLProgressElementConstructor::s_info = { "HTMLProgressElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLProgressElementConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSHTMLProgressElementPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementConstructor) } }, |
| { "value", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementValue) } }, |
| { "max", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementMax), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementMax) } }, |
| { "position", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementPosition), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "labels", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementLabels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| }; |
| |
| const ClassInfo JSHTMLProgressElementPrototype::s_info = { "HTMLProgressElementPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLProgressElementPrototype) }; |
| |
| void JSHTMLProgressElementPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSHTMLProgressElementPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSHTMLProgressElement::s_info = { "HTMLProgressElement", &Base::s_info, 0, CREATE_METHOD_TABLE(JSHTMLProgressElement) }; |
| |
| JSHTMLProgressElement::JSHTMLProgressElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLProgressElement>&& impl) |
| : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSHTMLProgressElement::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSHTMLProgressElementPrototype::create(vm, globalObject, JSHTMLProgressElementPrototype::createStructure(vm, globalObject, JSHTMLElement::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSHTMLProgressElement::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSHTMLProgressElement>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsHTMLProgressElementValue(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<JSHTMLProgressElement*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "HTMLProgressElement", "value"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.value()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsHTMLProgressElementMax(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<JSHTMLProgressElement*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "HTMLProgressElement", "max"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.max()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsHTMLProgressElementPosition(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<JSHTMLProgressElement*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "HTMLProgressElement", "position"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.position()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsHTMLProgressElementLabels(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<JSHTMLProgressElement*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "HTMLProgressElement", "labels"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.labels()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsHTMLProgressElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSHTMLProgressElementPrototype* domObject = jsDynamicCast<JSHTMLProgressElementPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSHTMLProgressElement::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSHTMLProgressElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSHTMLProgressElementPrototype* domObject = jsDynamicCast<JSHTMLProgressElementPrototype*>(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 setJSHTMLProgressElementValue(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); |
| JSHTMLProgressElement* castedThis = jsDynamicCast<JSHTMLProgressElement*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "HTMLProgressElement", "value"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setValue(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| bool setJSHTMLProgressElementMax(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); |
| JSHTMLProgressElement* castedThis = jsDynamicCast<JSHTMLProgressElement*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "HTMLProgressElement", "max"); |
| } |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto nativeValue = convert<double>(*state, value, ShouldAllowNonFinite::Yes); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setMax(WTFMove(nativeValue), ec); |
| setDOMException(state, throwScope, ec); |
| return true; |
| } |
| |
| |
| JSValue JSHTMLProgressElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSHTMLProgressElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| void JSHTMLProgressElement::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSHTMLProgressElement*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| Base::visitChildren(thisObject, visitor); |
| thisObject->wrapped().visitJSEventListeners(visitor); |
| } |
| |
| |
| } |