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