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 "JSHTMLLIElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "HTMLNames.h"
26#include "JSDOMAttribute.h"
27#include "JSDOMBinding.h"
28#include "JSDOMConstructorNotConstructable.h"
29#include "JSDOMConvertNumbers.h"
30#include "JSDOMConvertStrings.h"
31#include "JSDOMExceptionHandling.h"
32#include "JSDOMWrapperCache.h"
33#include "ScriptExecutionContext.h"
34#include <JavaScriptCore/HeapSnapshotBuilder.h>
35#include <JavaScriptCore/JSCInlines.h>
36#include <wtf/GetPtr.h>
37#include <wtf/PointerPreparations.h>
38#include <wtf/URL.h>
39
40
41namespace WebCore {
42using namespace JSC;
43
44// Attributes
45
46JSC::EncodedJSValue jsHTMLLIElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSHTMLLIElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsHTMLLIElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSHTMLLIElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsHTMLLIElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51bool setJSHTMLLIElementValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52
53class JSHTMLLIElementPrototype : public JSC::JSNonFinalObject {
54public:
55 using Base = JSC::JSNonFinalObject;
56 static JSHTMLLIElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
57 {
58 JSHTMLLIElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLLIElementPrototype>(vm.heap)) JSHTMLLIElementPrototype(vm, globalObject, structure);
59 ptr->finishCreation(vm);
60 return ptr;
61 }
62
63 DECLARE_INFO;
64 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
65 {
66 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
67 }
68
69private:
70 JSHTMLLIElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
71 : JSC::JSNonFinalObject(vm, structure)
72 {
73 }
74
75 void finishCreation(JSC::VM&);
76};
77
78using JSHTMLLIElementConstructor = JSDOMConstructorNotConstructable<JSHTMLLIElement>;
79
80template<> JSValue JSHTMLLIElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
81{
82 return JSHTMLElement::getConstructor(vm, &globalObject);
83}
84
85template<> void JSHTMLLIElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
86{
87 putDirect(vm, vm.propertyNames->prototype, JSHTMLLIElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLLIElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90}
91
92template<> const ClassInfo JSHTMLLIElementConstructor::s_info = { "HTMLLIElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLIElementConstructor) };
93
94/* Hash table for prototype */
95
96static const HashTableValue JSHTMLLIElementPrototypeTableValues[] =
97{
98 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLIElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLLIElementConstructor) } },
99 { "type", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLIElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLLIElementType) } },
100 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLIElementValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLLIElementValue) } },
101};
102
103const ClassInfo JSHTMLLIElementPrototype::s_info = { "HTMLLIElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLIElementPrototype) };
104
105void JSHTMLLIElementPrototype::finishCreation(VM& vm)
106{
107 Base::finishCreation(vm);
108 reifyStaticProperties(vm, JSHTMLLIElement::info(), JSHTMLLIElementPrototypeTableValues, *this);
109}
110
111const ClassInfo JSHTMLLIElement::s_info = { "HTMLLIElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLIElement) };
112
113JSHTMLLIElement::JSHTMLLIElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLLIElement>&& impl)
114 : JSHTMLElement(structure, globalObject, WTFMove(impl))
115{
116}
117
118void JSHTMLLIElement::finishCreation(VM& vm)
119{
120 Base::finishCreation(vm);
121 ASSERT(inherits(vm, info()));
122
123}
124
125JSObject* JSHTMLLIElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
126{
127 return JSHTMLLIElementPrototype::create(vm, &globalObject, JSHTMLLIElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
128}
129
130JSObject* JSHTMLLIElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return getDOMPrototype<JSHTMLLIElement>(vm, globalObject);
133}
134
135JSValue JSHTMLLIElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
136{
137 return getDOMConstructor<JSHTMLLIElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
138}
139
140template<> inline JSHTMLLIElement* IDLAttribute<JSHTMLLIElement>::cast(ExecState& state, EncodedJSValue thisValue)
141{
142 return jsDynamicCast<JSHTMLLIElement*>(state.vm(), JSValue::decode(thisValue));
143}
144
145EncodedJSValue jsHTMLLIElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
146{
147 VM& vm = state->vm();
148 auto throwScope = DECLARE_THROW_SCOPE(vm);
149 auto* prototype = jsDynamicCast<JSHTMLLIElementPrototype*>(vm, JSValue::decode(thisValue));
150 if (UNLIKELY(!prototype))
151 return throwVMTypeError(state, throwScope);
152 return JSValue::encode(JSHTMLLIElement::getConstructor(state->vm(), prototype->globalObject()));
153}
154
155bool setJSHTMLLIElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
156{
157 VM& vm = state->vm();
158 auto throwScope = DECLARE_THROW_SCOPE(vm);
159 auto* prototype = jsDynamicCast<JSHTMLLIElementPrototype*>(vm, JSValue::decode(thisValue));
160 if (UNLIKELY(!prototype)) {
161 throwVMTypeError(state, throwScope);
162 return false;
163 }
164 // Shadowing a built-in constructor
165 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
166}
167
168static inline JSValue jsHTMLLIElementTypeGetter(ExecState& state, JSHTMLLIElement& thisObject, ThrowScope& throwScope)
169{
170 UNUSED_PARAM(throwScope);
171 UNUSED_PARAM(state);
172 auto& impl = thisObject.wrapped();
173 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::typeAttr));
174 return result;
175}
176
177EncodedJSValue jsHTMLLIElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
178{
179 return IDLAttribute<JSHTMLLIElement>::get<jsHTMLLIElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type");
180}
181
182static inline bool setJSHTMLLIElementTypeSetter(ExecState& state, JSHTMLLIElement& thisObject, JSValue value, ThrowScope& throwScope)
183{
184 UNUSED_PARAM(throwScope);
185 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
186 auto& impl = thisObject.wrapped();
187 auto nativeValue = convert<IDLDOMString>(state, value);
188 RETURN_IF_EXCEPTION(throwScope, false);
189 AttributeSetter::call(state, throwScope, [&] {
190 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, WTFMove(nativeValue));
191 });
192 return true;
193}
194
195bool setJSHTMLLIElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
196{
197 return IDLAttribute<JSHTMLLIElement>::set<setJSHTMLLIElementTypeSetter>(*state, thisValue, encodedValue, "type");
198}
199
200static inline JSValue jsHTMLLIElementValueGetter(ExecState& state, JSHTMLLIElement& thisObject, ThrowScope& throwScope)
201{
202 UNUSED_PARAM(throwScope);
203 UNUSED_PARAM(state);
204 auto& impl = thisObject.wrapped();
205 JSValue result = toJS<IDLLong>(state, throwScope, impl.getIntegralAttribute(WebCore::HTMLNames::valueAttr));
206 return result;
207}
208
209EncodedJSValue jsHTMLLIElementValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
210{
211 return IDLAttribute<JSHTMLLIElement>::get<jsHTMLLIElementValueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "value");
212}
213
214static inline bool setJSHTMLLIElementValueSetter(ExecState& state, JSHTMLLIElement& thisObject, JSValue value, ThrowScope& throwScope)
215{
216 UNUSED_PARAM(throwScope);
217 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
218 auto& impl = thisObject.wrapped();
219 auto nativeValue = convert<IDLLong>(state, value);
220 RETURN_IF_EXCEPTION(throwScope, false);
221 AttributeSetter::call(state, throwScope, [&] {
222 return impl.setIntegralAttribute(WebCore::HTMLNames::valueAttr, WTFMove(nativeValue));
223 });
224 return true;
225}
226
227bool setJSHTMLLIElementValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
228{
229 return IDLAttribute<JSHTMLLIElement>::set<setJSHTMLLIElementValueSetter>(*state, thisValue, encodedValue, "value");
230}
231
232void JSHTMLLIElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
233{
234 auto* thisObject = jsCast<JSHTMLLIElement*>(cell);
235 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
236 if (thisObject->scriptExecutionContext())
237 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
238 Base::heapSnapshot(cell, builder);
239}
240
241
242}
243