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
23#if ENABLE(METER_ELEMENT)
24
25#include "JSHTMLMeterElement.h"
26
27#include "CustomElementReactionQueue.h"
28#include "JSDOMAttribute.h"
29#include "JSDOMBinding.h"
30#include "JSDOMConstructorNotConstructable.h"
31#include "JSDOMConvertInterface.h"
32#include "JSDOMConvertNumbers.h"
33#include "JSDOMExceptionHandling.h"
34#include "JSDOMGlobalObject.h"
35#include "JSDOMWrapperCache.h"
36#include "JSNodeList.h"
37#include "ScriptExecutionContext.h"
38#include <JavaScriptCore/HeapSnapshotBuilder.h>
39#include <JavaScriptCore/JSCInlines.h>
40#include <wtf/GetPtr.h>
41#include <wtf/PointerPreparations.h>
42#include <wtf/URL.h>
43
44
45namespace WebCore {
46using namespace JSC;
47
48// Attributes
49
50JSC::EncodedJSValue jsHTMLMeterElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51bool setJSHTMLMeterElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52JSC::EncodedJSValue jsHTMLMeterElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53bool setJSHTMLMeterElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
54JSC::EncodedJSValue jsHTMLMeterElementMin(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55bool setJSHTMLMeterElementMin(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
56JSC::EncodedJSValue jsHTMLMeterElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57bool setJSHTMLMeterElementMax(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
58JSC::EncodedJSValue jsHTMLMeterElementLow(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
59bool setJSHTMLMeterElementLow(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
60JSC::EncodedJSValue jsHTMLMeterElementHigh(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
61bool setJSHTMLMeterElementHigh(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
62JSC::EncodedJSValue jsHTMLMeterElementOptimum(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
63bool setJSHTMLMeterElementOptimum(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
64JSC::EncodedJSValue jsHTMLMeterElementLabels(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
65
66class JSHTMLMeterElementPrototype : public JSC::JSNonFinalObject {
67public:
68 using Base = JSC::JSNonFinalObject;
69 static JSHTMLMeterElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
70 {
71 JSHTMLMeterElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLMeterElementPrototype>(vm.heap)) JSHTMLMeterElementPrototype(vm, globalObject, structure);
72 ptr->finishCreation(vm);
73 return ptr;
74 }
75
76 DECLARE_INFO;
77 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
78 {
79 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
80 }
81
82private:
83 JSHTMLMeterElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
84 : JSC::JSNonFinalObject(vm, structure)
85 {
86 }
87
88 void finishCreation(JSC::VM&);
89};
90
91using JSHTMLMeterElementConstructor = JSDOMConstructorNotConstructable<JSHTMLMeterElement>;
92
93template<> JSValue JSHTMLMeterElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
94{
95 return JSHTMLElement::getConstructor(vm, &globalObject);
96}
97
98template<> void JSHTMLMeterElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
99{
100 putDirect(vm, vm.propertyNames->prototype, JSHTMLMeterElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
101 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLMeterElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
102 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
103}
104
105template<> const ClassInfo JSHTMLMeterElementConstructor::s_info = { "HTMLMeterElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLMeterElementConstructor) };
106
107/* Hash table for prototype */
108
109static const HashTableValue JSHTMLMeterElementPrototypeTableValues[] =
110{
111 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementConstructor) } },
112 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementValue) } },
113 { "min", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementMin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementMin) } },
114 { "max", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementMax), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementMax) } },
115 { "low", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementLow), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementLow) } },
116 { "high", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementHigh), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementHigh) } },
117 { "optimum", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementOptimum), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLMeterElementOptimum) } },
118 { "labels", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementLabels), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
119};
120
121const ClassInfo JSHTMLMeterElementPrototype::s_info = { "HTMLMeterElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLMeterElementPrototype) };
122
123void JSHTMLMeterElementPrototype::finishCreation(VM& vm)
124{
125 Base::finishCreation(vm);
126 reifyStaticProperties(vm, JSHTMLMeterElement::info(), JSHTMLMeterElementPrototypeTableValues, *this);
127}
128
129const ClassInfo JSHTMLMeterElement::s_info = { "HTMLMeterElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLMeterElement) };
130
131JSHTMLMeterElement::JSHTMLMeterElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLMeterElement>&& impl)
132 : JSHTMLElement(structure, globalObject, WTFMove(impl))
133{
134}
135
136void JSHTMLMeterElement::finishCreation(VM& vm)
137{
138 Base::finishCreation(vm);
139 ASSERT(inherits(vm, info()));
140
141}
142
143JSObject* JSHTMLMeterElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
144{
145 return JSHTMLMeterElementPrototype::create(vm, &globalObject, JSHTMLMeterElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
146}
147
148JSObject* JSHTMLMeterElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
149{
150 return getDOMPrototype<JSHTMLMeterElement>(vm, globalObject);
151}
152
153JSValue JSHTMLMeterElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
154{
155 return getDOMConstructor<JSHTMLMeterElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
156}
157
158template<> inline JSHTMLMeterElement* IDLAttribute<JSHTMLMeterElement>::cast(ExecState& state, EncodedJSValue thisValue)
159{
160 return jsDynamicCast<JSHTMLMeterElement*>(state.vm(), JSValue::decode(thisValue));
161}
162
163EncodedJSValue jsHTMLMeterElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
164{
165 VM& vm = state->vm();
166 auto throwScope = DECLARE_THROW_SCOPE(vm);
167 auto* prototype = jsDynamicCast<JSHTMLMeterElementPrototype*>(vm, JSValue::decode(thisValue));
168 if (UNLIKELY(!prototype))
169 return throwVMTypeError(state, throwScope);
170 return JSValue::encode(JSHTMLMeterElement::getConstructor(state->vm(), prototype->globalObject()));
171}
172
173bool setJSHTMLMeterElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
174{
175 VM& vm = state->vm();
176 auto throwScope = DECLARE_THROW_SCOPE(vm);
177 auto* prototype = jsDynamicCast<JSHTMLMeterElementPrototype*>(vm, JSValue::decode(thisValue));
178 if (UNLIKELY(!prototype)) {
179 throwVMTypeError(state, throwScope);
180 return false;
181 }
182 // Shadowing a built-in constructor
183 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
184}
185
186static inline JSValue jsHTMLMeterElementValueGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
187{
188 UNUSED_PARAM(throwScope);
189 UNUSED_PARAM(state);
190 auto& impl = thisObject.wrapped();
191 JSValue result = toJS<IDLDouble>(state, throwScope, impl.value());
192 return result;
193}
194
195EncodedJSValue jsHTMLMeterElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
196{
197 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
198}
199
200static inline bool setJSHTMLMeterElementValueSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
201{
202 UNUSED_PARAM(throwScope);
203 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
204 auto& impl = thisObject.wrapped();
205 auto nativeValue = convert<IDLDouble>(state, value);
206 RETURN_IF_EXCEPTION(throwScope, false);
207 AttributeSetter::call(state, throwScope, [&] {
208 return impl.setValue(WTFMove(nativeValue));
209 });
210 return true;
211}
212
213bool setJSHTMLMeterElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
214{
215 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementValueSetter>(*state, thisValue, encodedValue, "value");
216}
217
218static inline JSValue jsHTMLMeterElementMinGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
219{
220 UNUSED_PARAM(throwScope);
221 UNUSED_PARAM(state);
222 auto& impl = thisObject.wrapped();
223 JSValue result = toJS<IDLDouble>(state, throwScope, impl.min());
224 return result;
225}
226
227EncodedJSValue jsHTMLMeterElementMin(ExecState* state, EncodedJSValue thisValue, PropertyName)
228{
229 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementMinGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "min");
230}
231
232static inline bool setJSHTMLMeterElementMinSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
233{
234 UNUSED_PARAM(throwScope);
235 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
236 auto& impl = thisObject.wrapped();
237 auto nativeValue = convert<IDLDouble>(state, value);
238 RETURN_IF_EXCEPTION(throwScope, false);
239 AttributeSetter::call(state, throwScope, [&] {
240 return impl.setMin(WTFMove(nativeValue));
241 });
242 return true;
243}
244
245bool setJSHTMLMeterElementMin(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
246{
247 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementMinSetter>(*state, thisValue, encodedValue, "min");
248}
249
250static inline JSValue jsHTMLMeterElementMaxGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
251{
252 UNUSED_PARAM(throwScope);
253 UNUSED_PARAM(state);
254 auto& impl = thisObject.wrapped();
255 JSValue result = toJS<IDLDouble>(state, throwScope, impl.max());
256 return result;
257}
258
259EncodedJSValue jsHTMLMeterElementMax(ExecState* state, EncodedJSValue thisValue, PropertyName)
260{
261 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementMaxGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "max");
262}
263
264static inline bool setJSHTMLMeterElementMaxSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
265{
266 UNUSED_PARAM(throwScope);
267 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
268 auto& impl = thisObject.wrapped();
269 auto nativeValue = convert<IDLDouble>(state, value);
270 RETURN_IF_EXCEPTION(throwScope, false);
271 AttributeSetter::call(state, throwScope, [&] {
272 return impl.setMax(WTFMove(nativeValue));
273 });
274 return true;
275}
276
277bool setJSHTMLMeterElementMax(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
278{
279 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementMaxSetter>(*state, thisValue, encodedValue, "max");
280}
281
282static inline JSValue jsHTMLMeterElementLowGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
283{
284 UNUSED_PARAM(throwScope);
285 UNUSED_PARAM(state);
286 auto& impl = thisObject.wrapped();
287 JSValue result = toJS<IDLDouble>(state, throwScope, impl.low());
288 return result;
289}
290
291EncodedJSValue jsHTMLMeterElementLow(ExecState* state, EncodedJSValue thisValue, PropertyName)
292{
293 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementLowGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "low");
294}
295
296static inline bool setJSHTMLMeterElementLowSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
297{
298 UNUSED_PARAM(throwScope);
299 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
300 auto& impl = thisObject.wrapped();
301 auto nativeValue = convert<IDLDouble>(state, value);
302 RETURN_IF_EXCEPTION(throwScope, false);
303 AttributeSetter::call(state, throwScope, [&] {
304 return impl.setLow(WTFMove(nativeValue));
305 });
306 return true;
307}
308
309bool setJSHTMLMeterElementLow(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
310{
311 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementLowSetter>(*state, thisValue, encodedValue, "low");
312}
313
314static inline JSValue jsHTMLMeterElementHighGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
315{
316 UNUSED_PARAM(throwScope);
317 UNUSED_PARAM(state);
318 auto& impl = thisObject.wrapped();
319 JSValue result = toJS<IDLDouble>(state, throwScope, impl.high());
320 return result;
321}
322
323EncodedJSValue jsHTMLMeterElementHigh(ExecState* state, EncodedJSValue thisValue, PropertyName)
324{
325 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementHighGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "high");
326}
327
328static inline bool setJSHTMLMeterElementHighSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
329{
330 UNUSED_PARAM(throwScope);
331 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
332 auto& impl = thisObject.wrapped();
333 auto nativeValue = convert<IDLDouble>(state, value);
334 RETURN_IF_EXCEPTION(throwScope, false);
335 AttributeSetter::call(state, throwScope, [&] {
336 return impl.setHigh(WTFMove(nativeValue));
337 });
338 return true;
339}
340
341bool setJSHTMLMeterElementHigh(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
342{
343 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementHighSetter>(*state, thisValue, encodedValue, "high");
344}
345
346static inline JSValue jsHTMLMeterElementOptimumGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
347{
348 UNUSED_PARAM(throwScope);
349 UNUSED_PARAM(state);
350 auto& impl = thisObject.wrapped();
351 JSValue result = toJS<IDLDouble>(state, throwScope, impl.optimum());
352 return result;
353}
354
355EncodedJSValue jsHTMLMeterElementOptimum(ExecState* state, EncodedJSValue thisValue, PropertyName)
356{
357 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementOptimumGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "optimum");
358}
359
360static inline bool setJSHTMLMeterElementOptimumSetter(ExecState& state, JSHTMLMeterElement& thisObject, JSValue value, ThrowScope& throwScope)
361{
362 UNUSED_PARAM(throwScope);
363 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
364 auto& impl = thisObject.wrapped();
365 auto nativeValue = convert<IDLDouble>(state, value);
366 RETURN_IF_EXCEPTION(throwScope, false);
367 AttributeSetter::call(state, throwScope, [&] {
368 return impl.setOptimum(WTFMove(nativeValue));
369 });
370 return true;
371}
372
373bool setJSHTMLMeterElementOptimum(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
374{
375 return IDLAttribute<JSHTMLMeterElement>::set<setJSHTMLMeterElementOptimumSetter>(*state, thisValue, encodedValue, "optimum");
376}
377
378static inline JSValue jsHTMLMeterElementLabelsGetter(ExecState& state, JSHTMLMeterElement& thisObject, ThrowScope& throwScope)
379{
380 UNUSED_PARAM(throwScope);
381 UNUSED_PARAM(state);
382 auto& impl = thisObject.wrapped();
383 JSValue result = toJS<IDLInterface<NodeList>>(state, *thisObject.globalObject(), throwScope, impl.labels());
384 return result;
385}
386
387EncodedJSValue jsHTMLMeterElementLabels(ExecState* state, EncodedJSValue thisValue, PropertyName)
388{
389 return IDLAttribute<JSHTMLMeterElement>::get<jsHTMLMeterElementLabelsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "labels");
390}
391
392void JSHTMLMeterElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
393{
394 auto* thisObject = jsCast<JSHTMLMeterElement*>(cell);
395 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
396 if (thisObject->scriptExecutionContext())
397 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
398 Base::heapSnapshot(cell, builder);
399}
400
401
402}
403
404#endif // ENABLE(METER_ELEMENT)
405