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 "JSHTMLLegendElement.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 "JSHTMLFormElement.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 | |
43 | namespace WebCore { |
44 | using namespace JSC; |
45 | |
46 | // Attributes |
47 | |
48 | JSC::EncodedJSValue jsHTMLLegendElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSHTMLLegendElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsHTMLLegendElementForm(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsHTMLLegendElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | bool setJSHTMLLegendElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
53 | |
54 | class JSHTMLLegendElementPrototype : public JSC::JSNonFinalObject { |
55 | public: |
56 | using Base = JSC::JSNonFinalObject; |
57 | static JSHTMLLegendElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
58 | { |
59 | JSHTMLLegendElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLLegendElementPrototype>(vm.heap)) JSHTMLLegendElementPrototype(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 | |
70 | private: |
71 | JSHTMLLegendElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
72 | : JSC::JSNonFinalObject(vm, structure) |
73 | { |
74 | } |
75 | |
76 | void finishCreation(JSC::VM&); |
77 | }; |
78 | |
79 | using JSHTMLLegendElementConstructor = JSDOMConstructorNotConstructable<JSHTMLLegendElement>; |
80 | |
81 | template<> JSValue JSHTMLLegendElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
82 | { |
83 | return JSHTMLElement::getConstructor(vm, &globalObject); |
84 | } |
85 | |
86 | template<> void JSHTMLLegendElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
87 | { |
88 | putDirect(vm, vm.propertyNames->prototype, JSHTMLLegendElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLLegendElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
90 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | } |
92 | |
93 | template<> const ClassInfo JSHTMLLegendElementConstructor::s_info = { "HTMLLegendElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLegendElementConstructor) }; |
94 | |
95 | /* Hash table for prototype */ |
96 | |
97 | static const HashTableValue JSHTMLLegendElementPrototypeTableValues[] = |
98 | { |
99 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLegendElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLLegendElementConstructor) } }, |
100 | { "form" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLegendElementForm), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
101 | { "align" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLLegendElementAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLLegendElementAlign) } }, |
102 | }; |
103 | |
104 | const ClassInfo JSHTMLLegendElementPrototype::s_info = { "HTMLLegendElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLegendElementPrototype) }; |
105 | |
106 | void JSHTMLLegendElementPrototype::finishCreation(VM& vm) |
107 | { |
108 | Base::finishCreation(vm); |
109 | reifyStaticProperties(vm, JSHTMLLegendElement::info(), JSHTMLLegendElementPrototypeTableValues, *this); |
110 | } |
111 | |
112 | const ClassInfo JSHTMLLegendElement::s_info = { "HTMLLegendElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLLegendElement) }; |
113 | |
114 | JSHTMLLegendElement::JSHTMLLegendElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLLegendElement>&& impl) |
115 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
116 | { |
117 | } |
118 | |
119 | void JSHTMLLegendElement::finishCreation(VM& vm) |
120 | { |
121 | Base::finishCreation(vm); |
122 | ASSERT(inherits(vm, info())); |
123 | |
124 | } |
125 | |
126 | JSObject* JSHTMLLegendElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
127 | { |
128 | return JSHTMLLegendElementPrototype::create(vm, &globalObject, JSHTMLLegendElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
129 | } |
130 | |
131 | JSObject* JSHTMLLegendElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
132 | { |
133 | return getDOMPrototype<JSHTMLLegendElement>(vm, globalObject); |
134 | } |
135 | |
136 | JSValue JSHTMLLegendElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
137 | { |
138 | return getDOMConstructor<JSHTMLLegendElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
139 | } |
140 | |
141 | template<> inline JSHTMLLegendElement* IDLAttribute<JSHTMLLegendElement>::cast(ExecState& state, EncodedJSValue thisValue) |
142 | { |
143 | return jsDynamicCast<JSHTMLLegendElement*>(state.vm(), JSValue::decode(thisValue)); |
144 | } |
145 | |
146 | EncodedJSValue jsHTMLLegendElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
147 | { |
148 | VM& vm = state->vm(); |
149 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
150 | auto* prototype = jsDynamicCast<JSHTMLLegendElementPrototype*>(vm, JSValue::decode(thisValue)); |
151 | if (UNLIKELY(!prototype)) |
152 | return throwVMTypeError(state, throwScope); |
153 | return JSValue::encode(JSHTMLLegendElement::getConstructor(state->vm(), prototype->globalObject())); |
154 | } |
155 | |
156 | bool setJSHTMLLegendElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
157 | { |
158 | VM& vm = state->vm(); |
159 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
160 | auto* prototype = jsDynamicCast<JSHTMLLegendElementPrototype*>(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 | |
169 | static inline JSValue jsHTMLLegendElementFormGetter(ExecState& state, JSHTMLLegendElement& thisObject, ThrowScope& throwScope) |
170 | { |
171 | UNUSED_PARAM(throwScope); |
172 | UNUSED_PARAM(state); |
173 | auto& impl = thisObject.wrapped(); |
174 | JSValue result = toJS<IDLInterface<HTMLFormElement>>(state, *thisObject.globalObject(), throwScope, impl.form()); |
175 | return result; |
176 | } |
177 | |
178 | EncodedJSValue jsHTMLLegendElementForm(ExecState* state, EncodedJSValue thisValue, PropertyName) |
179 | { |
180 | return IDLAttribute<JSHTMLLegendElement>::get<jsHTMLLegendElementFormGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "form" ); |
181 | } |
182 | |
183 | static inline JSValue jsHTMLLegendElementAlignGetter(ExecState& state, JSHTMLLegendElement& 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.attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr)); |
189 | return result; |
190 | } |
191 | |
192 | EncodedJSValue jsHTMLLegendElementAlign(ExecState* state, EncodedJSValue thisValue, PropertyName) |
193 | { |
194 | return IDLAttribute<JSHTMLLegendElement>::get<jsHTMLLegendElementAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align" ); |
195 | } |
196 | |
197 | static inline bool setJSHTMLLegendElementAlignSetter(ExecState& state, JSHTMLLegendElement& 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::alignAttr, WTFMove(nativeValue)); |
206 | }); |
207 | return true; |
208 | } |
209 | |
210 | bool setJSHTMLLegendElementAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
211 | { |
212 | return IDLAttribute<JSHTMLLegendElement>::set<setJSHTMLLegendElementAlignSetter>(*state, thisValue, encodedValue, "align" ); |
213 | } |
214 | |
215 | void JSHTMLLegendElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
216 | { |
217 | auto* thisObject = jsCast<JSHTMLLegendElement*>(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 | |