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 "JSHTMLTableSectionElement.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 "JSDOMConvertNumbers.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMOperation.h"
35#include "JSDOMWrapperCache.h"
36#include "JSHTMLCollection.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// Functions
49
50JSC::EncodedJSValue JSC_HOST_CALL jsHTMLTableSectionElementPrototypeFunctionInsertRow(JSC::ExecState*);
51JSC::EncodedJSValue JSC_HOST_CALL jsHTMLTableSectionElementPrototypeFunctionDeleteRow(JSC::ExecState*);
52
53// Attributes
54
55JSC::EncodedJSValue jsHTMLTableSectionElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56bool setJSHTMLTableSectionElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57JSC::EncodedJSValue jsHTMLTableSectionElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58bool setJSHTMLTableSectionElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
59JSC::EncodedJSValue jsHTMLTableSectionElementCh(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60bool setJSHTMLTableSectionElementCh(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
61JSC::EncodedJSValue jsHTMLTableSectionElementChOff(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62bool setJSHTMLTableSectionElementChOff(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63JSC::EncodedJSValue jsHTMLTableSectionElementVAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64bool setJSHTMLTableSectionElementVAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65JSC::EncodedJSValue jsHTMLTableSectionElementRows(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66
67class JSHTMLTableSectionElementPrototype : public JSC::JSNonFinalObject {
68public:
69 using Base = JSC::JSNonFinalObject;
70 static JSHTMLTableSectionElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
71 {
72 JSHTMLTableSectionElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLTableSectionElementPrototype>(vm.heap)) JSHTMLTableSectionElementPrototype(vm, globalObject, structure);
73 ptr->finishCreation(vm);
74 return ptr;
75 }
76
77 DECLARE_INFO;
78 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
79 {
80 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
81 }
82
83private:
84 JSHTMLTableSectionElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
85 : JSC::JSNonFinalObject(vm, structure)
86 {
87 }
88
89 void finishCreation(JSC::VM&);
90};
91
92using JSHTMLTableSectionElementConstructor = JSDOMConstructorNotConstructable<JSHTMLTableSectionElement>;
93
94template<> JSValue JSHTMLTableSectionElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
95{
96 return JSHTMLElement::getConstructor(vm, &globalObject);
97}
98
99template<> void JSHTMLTableSectionElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
100{
101 putDirect(vm, vm.propertyNames->prototype, JSHTMLTableSectionElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
102 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLTableSectionElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
103 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
104}
105
106template<> const ClassInfo JSHTMLTableSectionElementConstructor::s_info = { "HTMLTableSectionElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTableSectionElementConstructor) };
107
108/* Hash table for prototype */
109
110static const HashTableValue JSHTMLTableSectionElementPrototypeTableValues[] =
111{
112 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTableSectionElementConstructor) } },
113 { "align", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTableSectionElementAlign) } },
114 { "ch", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementCh), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTableSectionElementCh) } },
115 { "chOff", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementChOff), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTableSectionElementChOff) } },
116 { "vAlign", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementVAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLTableSectionElementVAlign) } },
117 { "rows", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLTableSectionElementRows), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
118 { "insertRow", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLTableSectionElementPrototypeFunctionInsertRow), (intptr_t) (0) } },
119 { "deleteRow", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLTableSectionElementPrototypeFunctionDeleteRow), (intptr_t) (1) } },
120};
121
122const ClassInfo JSHTMLTableSectionElementPrototype::s_info = { "HTMLTableSectionElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTableSectionElementPrototype) };
123
124void JSHTMLTableSectionElementPrototype::finishCreation(VM& vm)
125{
126 Base::finishCreation(vm);
127 reifyStaticProperties(vm, JSHTMLTableSectionElement::info(), JSHTMLTableSectionElementPrototypeTableValues, *this);
128}
129
130const ClassInfo JSHTMLTableSectionElement::s_info = { "HTMLTableSectionElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLTableSectionElement) };
131
132JSHTMLTableSectionElement::JSHTMLTableSectionElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLTableSectionElement>&& impl)
133 : JSHTMLElement(structure, globalObject, WTFMove(impl))
134{
135}
136
137void JSHTMLTableSectionElement::finishCreation(VM& vm)
138{
139 Base::finishCreation(vm);
140 ASSERT(inherits(vm, info()));
141
142}
143
144JSObject* JSHTMLTableSectionElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
145{
146 return JSHTMLTableSectionElementPrototype::create(vm, &globalObject, JSHTMLTableSectionElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
147}
148
149JSObject* JSHTMLTableSectionElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
150{
151 return getDOMPrototype<JSHTMLTableSectionElement>(vm, globalObject);
152}
153
154JSValue JSHTMLTableSectionElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
155{
156 return getDOMConstructor<JSHTMLTableSectionElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
157}
158
159template<> inline JSHTMLTableSectionElement* IDLAttribute<JSHTMLTableSectionElement>::cast(ExecState& state, EncodedJSValue thisValue)
160{
161 return jsDynamicCast<JSHTMLTableSectionElement*>(state.vm(), JSValue::decode(thisValue));
162}
163
164template<> inline JSHTMLTableSectionElement* IDLOperation<JSHTMLTableSectionElement>::cast(ExecState& state)
165{
166 return jsDynamicCast<JSHTMLTableSectionElement*>(state.vm(), state.thisValue());
167}
168
169EncodedJSValue jsHTMLTableSectionElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
170{
171 VM& vm = state->vm();
172 auto throwScope = DECLARE_THROW_SCOPE(vm);
173 auto* prototype = jsDynamicCast<JSHTMLTableSectionElementPrototype*>(vm, JSValue::decode(thisValue));
174 if (UNLIKELY(!prototype))
175 return throwVMTypeError(state, throwScope);
176 return JSValue::encode(JSHTMLTableSectionElement::getConstructor(state->vm(), prototype->globalObject()));
177}
178
179bool setJSHTMLTableSectionElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
180{
181 VM& vm = state->vm();
182 auto throwScope = DECLARE_THROW_SCOPE(vm);
183 auto* prototype = jsDynamicCast<JSHTMLTableSectionElementPrototype*>(vm, JSValue::decode(thisValue));
184 if (UNLIKELY(!prototype)) {
185 throwVMTypeError(state, throwScope);
186 return false;
187 }
188 // Shadowing a built-in constructor
189 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
190}
191
192static inline JSValue jsHTMLTableSectionElementAlignGetter(ExecState& state, JSHTMLTableSectionElement& thisObject, ThrowScope& throwScope)
193{
194 UNUSED_PARAM(throwScope);
195 UNUSED_PARAM(state);
196 auto& impl = thisObject.wrapped();
197 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr));
198 return result;
199}
200
201EncodedJSValue jsHTMLTableSectionElementAlign(ExecState* state, EncodedJSValue thisValue, PropertyName)
202{
203 return IDLAttribute<JSHTMLTableSectionElement>::get<jsHTMLTableSectionElementAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align");
204}
205
206static inline bool setJSHTMLTableSectionElementAlignSetter(ExecState& state, JSHTMLTableSectionElement& thisObject, JSValue value, ThrowScope& throwScope)
207{
208 UNUSED_PARAM(throwScope);
209 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
210 auto& impl = thisObject.wrapped();
211 auto nativeValue = convert<IDLDOMString>(state, value);
212 RETURN_IF_EXCEPTION(throwScope, false);
213 AttributeSetter::call(state, throwScope, [&] {
214 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, WTFMove(nativeValue));
215 });
216 return true;
217}
218
219bool setJSHTMLTableSectionElementAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
220{
221 return IDLAttribute<JSHTMLTableSectionElement>::set<setJSHTMLTableSectionElementAlignSetter>(*state, thisValue, encodedValue, "align");
222}
223
224static inline JSValue jsHTMLTableSectionElementChGetter(ExecState& state, JSHTMLTableSectionElement& thisObject, ThrowScope& throwScope)
225{
226 UNUSED_PARAM(throwScope);
227 UNUSED_PARAM(state);
228 auto& impl = thisObject.wrapped();
229 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::charAttr));
230 return result;
231}
232
233EncodedJSValue jsHTMLTableSectionElementCh(ExecState* state, EncodedJSValue thisValue, PropertyName)
234{
235 return IDLAttribute<JSHTMLTableSectionElement>::get<jsHTMLTableSectionElementChGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ch");
236}
237
238static inline bool setJSHTMLTableSectionElementChSetter(ExecState& state, JSHTMLTableSectionElement& thisObject, JSValue value, ThrowScope& throwScope)
239{
240 UNUSED_PARAM(throwScope);
241 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
242 auto& impl = thisObject.wrapped();
243 auto nativeValue = convert<IDLDOMString>(state, value);
244 RETURN_IF_EXCEPTION(throwScope, false);
245 AttributeSetter::call(state, throwScope, [&] {
246 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::charAttr, WTFMove(nativeValue));
247 });
248 return true;
249}
250
251bool setJSHTMLTableSectionElementCh(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
252{
253 return IDLAttribute<JSHTMLTableSectionElement>::set<setJSHTMLTableSectionElementChSetter>(*state, thisValue, encodedValue, "ch");
254}
255
256static inline JSValue jsHTMLTableSectionElementChOffGetter(ExecState& state, JSHTMLTableSectionElement& thisObject, ThrowScope& throwScope)
257{
258 UNUSED_PARAM(throwScope);
259 UNUSED_PARAM(state);
260 auto& impl = thisObject.wrapped();
261 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::charoffAttr));
262 return result;
263}
264
265EncodedJSValue jsHTMLTableSectionElementChOff(ExecState* state, EncodedJSValue thisValue, PropertyName)
266{
267 return IDLAttribute<JSHTMLTableSectionElement>::get<jsHTMLTableSectionElementChOffGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "chOff");
268}
269
270static inline bool setJSHTMLTableSectionElementChOffSetter(ExecState& state, JSHTMLTableSectionElement& thisObject, JSValue value, ThrowScope& throwScope)
271{
272 UNUSED_PARAM(throwScope);
273 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
274 auto& impl = thisObject.wrapped();
275 auto nativeValue = convert<IDLDOMString>(state, value);
276 RETURN_IF_EXCEPTION(throwScope, false);
277 AttributeSetter::call(state, throwScope, [&] {
278 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::charoffAttr, WTFMove(nativeValue));
279 });
280 return true;
281}
282
283bool setJSHTMLTableSectionElementChOff(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
284{
285 return IDLAttribute<JSHTMLTableSectionElement>::set<setJSHTMLTableSectionElementChOffSetter>(*state, thisValue, encodedValue, "chOff");
286}
287
288static inline JSValue jsHTMLTableSectionElementVAlignGetter(ExecState& state, JSHTMLTableSectionElement& thisObject, ThrowScope& throwScope)
289{
290 UNUSED_PARAM(throwScope);
291 UNUSED_PARAM(state);
292 auto& impl = thisObject.wrapped();
293 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::valignAttr));
294 return result;
295}
296
297EncodedJSValue jsHTMLTableSectionElementVAlign(ExecState* state, EncodedJSValue thisValue, PropertyName)
298{
299 return IDLAttribute<JSHTMLTableSectionElement>::get<jsHTMLTableSectionElementVAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "vAlign");
300}
301
302static inline bool setJSHTMLTableSectionElementVAlignSetter(ExecState& state, JSHTMLTableSectionElement& thisObject, JSValue value, ThrowScope& throwScope)
303{
304 UNUSED_PARAM(throwScope);
305 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
306 auto& impl = thisObject.wrapped();
307 auto nativeValue = convert<IDLDOMString>(state, value);
308 RETURN_IF_EXCEPTION(throwScope, false);
309 AttributeSetter::call(state, throwScope, [&] {
310 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::valignAttr, WTFMove(nativeValue));
311 });
312 return true;
313}
314
315bool setJSHTMLTableSectionElementVAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
316{
317 return IDLAttribute<JSHTMLTableSectionElement>::set<setJSHTMLTableSectionElementVAlignSetter>(*state, thisValue, encodedValue, "vAlign");
318}
319
320static inline JSValue jsHTMLTableSectionElementRowsGetter(ExecState& state, JSHTMLTableSectionElement& thisObject, ThrowScope& throwScope)
321{
322 UNUSED_PARAM(throwScope);
323 UNUSED_PARAM(state);
324 auto& impl = thisObject.wrapped();
325 JSValue result = toJS<IDLInterface<HTMLCollection>>(state, *thisObject.globalObject(), throwScope, impl.rows());
326 return result;
327}
328
329EncodedJSValue jsHTMLTableSectionElementRows(ExecState* state, EncodedJSValue thisValue, PropertyName)
330{
331 return IDLAttribute<JSHTMLTableSectionElement>::get<jsHTMLTableSectionElementRowsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "rows");
332}
333
334static inline JSC::EncodedJSValue jsHTMLTableSectionElementPrototypeFunctionInsertRowBody(JSC::ExecState* state, typename IDLOperation<JSHTMLTableSectionElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
335{
336 UNUSED_PARAM(state);
337 UNUSED_PARAM(throwScope);
338 auto& impl = castedThis->wrapped();
339 auto index = state->argument(0).isUndefined() ? -1 : convert<IDLLong>(*state, state->uncheckedArgument(0));
340 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
341 return JSValue::encode(toJS<IDLInterface<HTMLElement>>(*state, *castedThis->globalObject(), throwScope, impl.insertRow(WTFMove(index))));
342}
343
344EncodedJSValue JSC_HOST_CALL jsHTMLTableSectionElementPrototypeFunctionInsertRow(ExecState* state)
345{
346 return IDLOperation<JSHTMLTableSectionElement>::call<jsHTMLTableSectionElementPrototypeFunctionInsertRowBody>(*state, "insertRow");
347}
348
349static inline JSC::EncodedJSValue jsHTMLTableSectionElementPrototypeFunctionDeleteRowBody(JSC::ExecState* state, typename IDLOperation<JSHTMLTableSectionElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
350{
351 UNUSED_PARAM(state);
352 UNUSED_PARAM(throwScope);
353 CustomElementReactionStack customElementReactionStack(*state);
354 auto& impl = castedThis->wrapped();
355 if (UNLIKELY(state->argumentCount() < 1))
356 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
357 auto index = convert<IDLLong>(*state, state->uncheckedArgument(0));
358 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
359 propagateException(*state, throwScope, impl.deleteRow(WTFMove(index)));
360 return JSValue::encode(jsUndefined());
361}
362
363EncodedJSValue JSC_HOST_CALL jsHTMLTableSectionElementPrototypeFunctionDeleteRow(ExecState* state)
364{
365 return IDLOperation<JSHTMLTableSectionElement>::call<jsHTMLTableSectionElementPrototypeFunctionDeleteRowBody>(*state, "deleteRow");
366}
367
368void JSHTMLTableSectionElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
369{
370 auto* thisObject = jsCast<JSHTMLTableSectionElement*>(cell);
371 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
372 if (thisObject->scriptExecutionContext())
373 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
374 Base::heapSnapshot(cell, builder);
375}
376
377HTMLTableSectionElement* JSHTMLTableSectionElement::toWrapped(JSC::VM& vm, JSC::JSValue value)
378{
379 if (auto* wrapper = jsDynamicCast<JSHTMLTableSectionElement*>(vm, value))
380 return &wrapper->wrapped();
381 return nullptr;
382}
383
384}
385