1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22#include "JSHTMLProgressElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "JSDOMAttribute.h"
26#include "JSDOMBinding.h"
27#include "JSDOMConstructorNotConstructable.h"
28#include "JSDOMConvertInterface.h"
29#include "JSDOMConvertNumbers.h"
30#include "JSDOMExceptionHandling.h"
31#include "JSDOMGlobalObject.h"
32#include "JSDOMWrapperCache.h"
33#include "JSNodeList.h"
34#include "ScriptExecutionContext.h"
35#include <JavaScriptCore/HeapSnapshotBuilder.h>
36#include <JavaScriptCore/JSCInlines.h>
37#include <wtf/GetPtr.h>
38#include <wtf/PointerPreparations.h>
39#include <wtf/URL.h>
40
41
42namespace WebCore {
43using namespace JSC;
44
45// Attributes
46
47JSC::EncodedJSValue jsHTMLProgressElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSHTMLProgressElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsHTMLProgressElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSHTMLProgressElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsHTMLProgressElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSHTMLProgressElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53JSC::EncodedJSValue jsHTMLProgressElementPosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54JSC::EncodedJSValue jsHTMLProgressElementLabels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55
56class JSHTMLProgressElementPrototype : public JSC::JSNonFinalObject {
57public:
58 using Base = JSC::JSNonFinalObject;
59 static JSHTMLProgressElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
60 {
61 JSHTMLProgressElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLProgressElementPrototype>(vm.heap)) JSHTMLProgressElementPrototype(vm, globalObject, structure);
62 ptr->finishCreation(vm);
63 return ptr;
64 }
65
66 DECLARE_INFO;
67 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
68 {
69 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
70 }
71
72private:
73 JSHTMLProgressElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
74 : JSC::JSNonFinalObject(vm, structure)
75 {
76 }
77
78 void finishCreation(JSC::VM&);
79};
80
81using JSHTMLProgressElementConstructor = JSDOMConstructorNotConstructable<JSHTMLProgressElement>;
82
83template<> JSValue JSHTMLProgressElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
84{
85 return JSHTMLElement::getConstructor(vm, &globalObject);
86}
87
88template<> void JSHTMLProgressElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
89{
90 putDirect(vm, vm.propertyNames->prototype, JSHTMLProgressElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLProgressElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
92 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
93}
94
95template<> const ClassInfo JSHTMLProgressElementConstructor::s_info = { "HTMLProgressElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLProgressElementConstructor) };
96
97/* Hash table for prototype */
98
99static const HashTableValue JSHTMLProgressElementPrototypeTableValues[] =
100{
101 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementConstructor) } },
102 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementValue) } },
103 { "max", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementMax), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLProgressElementMax) } },
104 { "position", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementPosition), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
105 { "labels", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLProgressElementLabels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
106};
107
108const ClassInfo JSHTMLProgressElementPrototype::s_info = { "HTMLProgressElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLProgressElementPrototype) };
109
110void JSHTMLProgressElementPrototype::finishCreation(VM& vm)
111{
112 Base::finishCreation(vm);
113 reifyStaticProperties(vm, JSHTMLProgressElement::info(), JSHTMLProgressElementPrototypeTableValues, *this);
114}
115
116const ClassInfo JSHTMLProgressElement::s_info = { "HTMLProgressElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLProgressElement) };
117
118JSHTMLProgressElement::JSHTMLProgressElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLProgressElement>&& impl)
119 : JSHTMLElement(structure, globalObject, WTFMove(impl))
120{
121}
122
123void JSHTMLProgressElement::finishCreation(VM& vm)
124{
125 Base::finishCreation(vm);
126 ASSERT(inherits(vm, info()));
127
128}
129
130JSObject* JSHTMLProgressElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return JSHTMLProgressElementPrototype::create(vm, &globalObject, JSHTMLProgressElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
133}
134
135JSObject* JSHTMLProgressElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
136{
137 return getDOMPrototype<JSHTMLProgressElement>(vm, globalObject);
138}
139
140JSValue JSHTMLProgressElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
141{
142 return getDOMConstructor<JSHTMLProgressElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
143}
144
145template<> inline JSHTMLProgressElement* IDLAttribute<JSHTMLProgressElement>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSHTMLProgressElement*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue jsHTMLProgressElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSHTMLProgressElementPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype))
156 return throwVMTypeError(state, throwScope);
157 return JSValue::encode(JSHTMLProgressElement::getConstructor(state->vm(), prototype->globalObject()));
158}
159
160bool setJSHTMLProgressElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSHTMLProgressElementPrototype*>(vm, JSValue::decode(thisValue));
165 if (UNLIKELY(!prototype)) {
166 throwVMTypeError(state, throwScope);
167 return false;
168 }
169 // Shadowing a built-in constructor
170 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
171}
172
173static inline JSValue jsHTMLProgressElementValueGetter(ExecState& state, JSHTMLProgressElement& thisObject, ThrowScope& throwScope)
174{
175 UNUSED_PARAM(throwScope);
176 UNUSED_PARAM(state);
177 auto& impl = thisObject.wrapped();
178 JSValue result = toJS<IDLDouble>(state, throwScope, impl.value());
179 return result;
180}
181
182EncodedJSValue jsHTMLProgressElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSHTMLProgressElement>::get<jsHTMLProgressElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
185}
186
187static inline bool setJSHTMLProgressElementValueSetter(ExecState& state, JSHTMLProgressElement& thisObject, JSValue value, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
191 auto& impl = thisObject.wrapped();
192 auto nativeValue = convert<IDLDouble>(state, value);
193 RETURN_IF_EXCEPTION(throwScope, false);
194 AttributeSetter::call(state, throwScope, [&] {
195 return impl.setValue(WTFMove(nativeValue));
196 });
197 return true;
198}
199
200bool setJSHTMLProgressElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
201{
202 return IDLAttribute<JSHTMLProgressElement>::set<setJSHTMLProgressElementValueSetter>(*state, thisValue, encodedValue, "value");
203}
204
205static inline JSValue jsHTMLProgressElementMaxGetter(ExecState& state, JSHTMLProgressElement& thisObject, ThrowScope& throwScope)
206{
207 UNUSED_PARAM(throwScope);
208 UNUSED_PARAM(state);
209 auto& impl = thisObject.wrapped();
210 JSValue result = toJS<IDLDouble>(state, throwScope, impl.max());
211 return result;
212}
213
214EncodedJSValue jsHTMLProgressElementMax(ExecState* state, EncodedJSValue thisValue, PropertyName)
215{
216 return IDLAttribute<JSHTMLProgressElement>::get<jsHTMLProgressElementMaxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "max");
217}
218
219static inline bool setJSHTMLProgressElementMaxSetter(ExecState& state, JSHTMLProgressElement& thisObject, JSValue value, ThrowScope& throwScope)
220{
221 UNUSED_PARAM(throwScope);
222 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
223 auto& impl = thisObject.wrapped();
224 auto nativeValue = convert<IDLDouble>(state, value);
225 RETURN_IF_EXCEPTION(throwScope, false);
226 AttributeSetter::call(state, throwScope, [&] {
227 return impl.setMax(WTFMove(nativeValue));
228 });
229 return true;
230}
231
232bool setJSHTMLProgressElementMax(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233{
234 return IDLAttribute<JSHTMLProgressElement>::set<setJSHTMLProgressElementMaxSetter>(*state, thisValue, encodedValue, "max");
235}
236
237static inline JSValue jsHTMLProgressElementPositionGetter(ExecState& state, JSHTMLProgressElement& thisObject, ThrowScope& throwScope)
238{
239 UNUSED_PARAM(throwScope);
240 UNUSED_PARAM(state);
241 auto& impl = thisObject.wrapped();
242 JSValue result = toJS<IDLDouble>(state, throwScope, impl.position());
243 return result;
244}
245
246EncodedJSValue jsHTMLProgressElementPosition(ExecState* state, EncodedJSValue thisValue, PropertyName)
247{
248 return IDLAttribute<JSHTMLProgressElement>::get<jsHTMLProgressElementPositionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "position");
249}
250
251static inline JSValue jsHTMLProgressElementLabelsGetter(ExecState& state, JSHTMLProgressElement& thisObject, ThrowScope& throwScope)
252{
253 UNUSED_PARAM(throwScope);
254 UNUSED_PARAM(state);
255 auto& impl = thisObject.wrapped();
256 JSValue result = toJS<IDLInterface<NodeList>>(state, *thisObject.globalObject(), throwScope, impl.labels());
257 return result;
258}
259
260EncodedJSValue jsHTMLProgressElementLabels(ExecState* state, EncodedJSValue thisValue, PropertyName)
261{
262 return IDLAttribute<JSHTMLProgressElement>::get<jsHTMLProgressElementLabelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "labels");
263}
264
265void JSHTMLProgressElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
266{
267 auto* thisObject = jsCast<JSHTMLProgressElement*>(cell);
268 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
269 if (thisObject->scriptExecutionContext())
270 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
271 Base::heapSnapshot(cell, builder);
272}
273
274
275}
276