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 "JSHTMLHRElement.h" |
23 | |
24 | #include "CustomElementReactionQueue.h" |
25 | #include "HTMLNames.h" |
26 | #include "JSDOMAttribute.h" |
27 | #include "JSDOMBinding.h" |
28 | #include "JSDOMConstructorNotConstructable.h" |
29 | #include "JSDOMConvertBoolean.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 | |
41 | namespace WebCore { |
42 | using namespace JSC; |
43 | |
44 | // Attributes |
45 | |
46 | JSC::EncodedJSValue jsHTMLHRElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | bool setJSHTMLHRElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
48 | JSC::EncodedJSValue jsHTMLHRElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSHTMLHRElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsHTMLHRElementColor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | bool setJSHTMLHRElementColor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
52 | JSC::EncodedJSValue jsHTMLHRElementNoShade(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | bool setJSHTMLHRElementNoShade(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
54 | JSC::EncodedJSValue jsHTMLHRElementSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
55 | bool setJSHTMLHRElementSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
56 | JSC::EncodedJSValue jsHTMLHRElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
57 | bool setJSHTMLHRElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
58 | |
59 | class JSHTMLHRElementPrototype : public JSC::JSNonFinalObject { |
60 | public: |
61 | using Base = JSC::JSNonFinalObject; |
62 | static JSHTMLHRElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
63 | { |
64 | JSHTMLHRElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLHRElementPrototype>(vm.heap)) JSHTMLHRElementPrototype(vm, globalObject, structure); |
65 | ptr->finishCreation(vm); |
66 | return ptr; |
67 | } |
68 | |
69 | DECLARE_INFO; |
70 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
71 | { |
72 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
73 | } |
74 | |
75 | private: |
76 | JSHTMLHRElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
77 | : JSC::JSNonFinalObject(vm, structure) |
78 | { |
79 | } |
80 | |
81 | void finishCreation(JSC::VM&); |
82 | }; |
83 | |
84 | using JSHTMLHRElementConstructor = JSDOMConstructorNotConstructable<JSHTMLHRElement>; |
85 | |
86 | template<> JSValue JSHTMLHRElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
87 | { |
88 | return JSHTMLElement::getConstructor(vm, &globalObject); |
89 | } |
90 | |
91 | template<> void JSHTMLHRElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
92 | { |
93 | putDirect(vm, vm.propertyNames->prototype, JSHTMLHRElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
94 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLHRElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
95 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
96 | } |
97 | |
98 | template<> const ClassInfo JSHTMLHRElementConstructor::s_info = { "HTMLHRElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHRElementConstructor) }; |
99 | |
100 | /* Hash table for prototype */ |
101 | |
102 | static const HashTableValue JSHTMLHRElementPrototypeTableValues[] = |
103 | { |
104 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementConstructor) } }, |
105 | { "align" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementAlign) } }, |
106 | { "color" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementColor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementColor) } }, |
107 | { "noShade" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementNoShade), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementNoShade) } }, |
108 | { "size" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementSize) } }, |
109 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLHRElementWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLHRElementWidth) } }, |
110 | }; |
111 | |
112 | const ClassInfo JSHTMLHRElementPrototype::s_info = { "HTMLHRElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHRElementPrototype) }; |
113 | |
114 | void JSHTMLHRElementPrototype::finishCreation(VM& vm) |
115 | { |
116 | Base::finishCreation(vm); |
117 | reifyStaticProperties(vm, JSHTMLHRElement::info(), JSHTMLHRElementPrototypeTableValues, *this); |
118 | } |
119 | |
120 | const ClassInfo JSHTMLHRElement::s_info = { "HTMLHRElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLHRElement) }; |
121 | |
122 | JSHTMLHRElement::JSHTMLHRElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLHRElement>&& impl) |
123 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
124 | { |
125 | } |
126 | |
127 | void JSHTMLHRElement::finishCreation(VM& vm) |
128 | { |
129 | Base::finishCreation(vm); |
130 | ASSERT(inherits(vm, info())); |
131 | |
132 | } |
133 | |
134 | JSObject* JSHTMLHRElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
135 | { |
136 | return JSHTMLHRElementPrototype::create(vm, &globalObject, JSHTMLHRElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
137 | } |
138 | |
139 | JSObject* JSHTMLHRElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
140 | { |
141 | return getDOMPrototype<JSHTMLHRElement>(vm, globalObject); |
142 | } |
143 | |
144 | JSValue JSHTMLHRElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
145 | { |
146 | return getDOMConstructor<JSHTMLHRElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
147 | } |
148 | |
149 | template<> inline JSHTMLHRElement* IDLAttribute<JSHTMLHRElement>::cast(ExecState& state, EncodedJSValue thisValue) |
150 | { |
151 | return jsDynamicCast<JSHTMLHRElement*>(state.vm(), JSValue::decode(thisValue)); |
152 | } |
153 | |
154 | EncodedJSValue jsHTMLHRElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
155 | { |
156 | VM& vm = state->vm(); |
157 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
158 | auto* prototype = jsDynamicCast<JSHTMLHRElementPrototype*>(vm, JSValue::decode(thisValue)); |
159 | if (UNLIKELY(!prototype)) |
160 | return throwVMTypeError(state, throwScope); |
161 | return JSValue::encode(JSHTMLHRElement::getConstructor(state->vm(), prototype->globalObject())); |
162 | } |
163 | |
164 | bool setJSHTMLHRElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
165 | { |
166 | VM& vm = state->vm(); |
167 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
168 | auto* prototype = jsDynamicCast<JSHTMLHRElementPrototype*>(vm, JSValue::decode(thisValue)); |
169 | if (UNLIKELY(!prototype)) { |
170 | throwVMTypeError(state, throwScope); |
171 | return false; |
172 | } |
173 | // Shadowing a built-in constructor |
174 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
175 | } |
176 | |
177 | static inline JSValue jsHTMLHRElementAlignGetter(ExecState& state, JSHTMLHRElement& thisObject, ThrowScope& throwScope) |
178 | { |
179 | UNUSED_PARAM(throwScope); |
180 | UNUSED_PARAM(state); |
181 | auto& impl = thisObject.wrapped(); |
182 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr)); |
183 | return result; |
184 | } |
185 | |
186 | EncodedJSValue jsHTMLHRElementAlign(ExecState* state, EncodedJSValue thisValue, PropertyName) |
187 | { |
188 | return IDLAttribute<JSHTMLHRElement>::get<jsHTMLHRElementAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align" ); |
189 | } |
190 | |
191 | static inline bool setJSHTMLHRElementAlignSetter(ExecState& state, JSHTMLHRElement& thisObject, JSValue value, ThrowScope& throwScope) |
192 | { |
193 | UNUSED_PARAM(throwScope); |
194 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
195 | auto& impl = thisObject.wrapped(); |
196 | auto nativeValue = convert<IDLDOMString>(state, value); |
197 | RETURN_IF_EXCEPTION(throwScope, false); |
198 | AttributeSetter::call(state, throwScope, [&] { |
199 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, WTFMove(nativeValue)); |
200 | }); |
201 | return true; |
202 | } |
203 | |
204 | bool setJSHTMLHRElementAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
205 | { |
206 | return IDLAttribute<JSHTMLHRElement>::set<setJSHTMLHRElementAlignSetter>(*state, thisValue, encodedValue, "align" ); |
207 | } |
208 | |
209 | static inline JSValue jsHTMLHRElementColorGetter(ExecState& state, JSHTMLHRElement& thisObject, ThrowScope& throwScope) |
210 | { |
211 | UNUSED_PARAM(throwScope); |
212 | UNUSED_PARAM(state); |
213 | auto& impl = thisObject.wrapped(); |
214 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::colorAttr)); |
215 | return result; |
216 | } |
217 | |
218 | EncodedJSValue jsHTMLHRElementColor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
219 | { |
220 | return IDLAttribute<JSHTMLHRElement>::get<jsHTMLHRElementColorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "color" ); |
221 | } |
222 | |
223 | static inline bool setJSHTMLHRElementColorSetter(ExecState& state, JSHTMLHRElement& thisObject, JSValue value, ThrowScope& throwScope) |
224 | { |
225 | UNUSED_PARAM(throwScope); |
226 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
227 | auto& impl = thisObject.wrapped(); |
228 | auto nativeValue = convert<IDLDOMString>(state, value); |
229 | RETURN_IF_EXCEPTION(throwScope, false); |
230 | AttributeSetter::call(state, throwScope, [&] { |
231 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::colorAttr, WTFMove(nativeValue)); |
232 | }); |
233 | return true; |
234 | } |
235 | |
236 | bool setJSHTMLHRElementColor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
237 | { |
238 | return IDLAttribute<JSHTMLHRElement>::set<setJSHTMLHRElementColorSetter>(*state, thisValue, encodedValue, "color" ); |
239 | } |
240 | |
241 | static inline JSValue jsHTMLHRElementNoShadeGetter(ExecState& state, JSHTMLHRElement& thisObject, ThrowScope& throwScope) |
242 | { |
243 | UNUSED_PARAM(throwScope); |
244 | UNUSED_PARAM(state); |
245 | auto& impl = thisObject.wrapped(); |
246 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::noshadeAttr)); |
247 | return result; |
248 | } |
249 | |
250 | EncodedJSValue jsHTMLHRElementNoShade(ExecState* state, EncodedJSValue thisValue, PropertyName) |
251 | { |
252 | return IDLAttribute<JSHTMLHRElement>::get<jsHTMLHRElementNoShadeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "noShade" ); |
253 | } |
254 | |
255 | static inline bool setJSHTMLHRElementNoShadeSetter(ExecState& state, JSHTMLHRElement& thisObject, JSValue value, ThrowScope& throwScope) |
256 | { |
257 | UNUSED_PARAM(throwScope); |
258 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
259 | auto& impl = thisObject.wrapped(); |
260 | auto nativeValue = convert<IDLBoolean>(state, value); |
261 | RETURN_IF_EXCEPTION(throwScope, false); |
262 | AttributeSetter::call(state, throwScope, [&] { |
263 | return impl.setBooleanAttribute(WebCore::HTMLNames::noshadeAttr, WTFMove(nativeValue)); |
264 | }); |
265 | return true; |
266 | } |
267 | |
268 | bool setJSHTMLHRElementNoShade(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
269 | { |
270 | return IDLAttribute<JSHTMLHRElement>::set<setJSHTMLHRElementNoShadeSetter>(*state, thisValue, encodedValue, "noShade" ); |
271 | } |
272 | |
273 | static inline JSValue jsHTMLHRElementSizeGetter(ExecState& state, JSHTMLHRElement& thisObject, ThrowScope& throwScope) |
274 | { |
275 | UNUSED_PARAM(throwScope); |
276 | UNUSED_PARAM(state); |
277 | auto& impl = thisObject.wrapped(); |
278 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::sizeAttr)); |
279 | return result; |
280 | } |
281 | |
282 | EncodedJSValue jsHTMLHRElementSize(ExecState* state, EncodedJSValue thisValue, PropertyName) |
283 | { |
284 | return IDLAttribute<JSHTMLHRElement>::get<jsHTMLHRElementSizeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "size" ); |
285 | } |
286 | |
287 | static inline bool setJSHTMLHRElementSizeSetter(ExecState& state, JSHTMLHRElement& thisObject, JSValue value, ThrowScope& throwScope) |
288 | { |
289 | UNUSED_PARAM(throwScope); |
290 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
291 | auto& impl = thisObject.wrapped(); |
292 | auto nativeValue = convert<IDLDOMString>(state, value); |
293 | RETURN_IF_EXCEPTION(throwScope, false); |
294 | AttributeSetter::call(state, throwScope, [&] { |
295 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::sizeAttr, WTFMove(nativeValue)); |
296 | }); |
297 | return true; |
298 | } |
299 | |
300 | bool setJSHTMLHRElementSize(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
301 | { |
302 | return IDLAttribute<JSHTMLHRElement>::set<setJSHTMLHRElementSizeSetter>(*state, thisValue, encodedValue, "size" ); |
303 | } |
304 | |
305 | static inline JSValue jsHTMLHRElementWidthGetter(ExecState& state, JSHTMLHRElement& thisObject, ThrowScope& throwScope) |
306 | { |
307 | UNUSED_PARAM(throwScope); |
308 | UNUSED_PARAM(state); |
309 | auto& impl = thisObject.wrapped(); |
310 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::widthAttr)); |
311 | return result; |
312 | } |
313 | |
314 | EncodedJSValue jsHTMLHRElementWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
315 | { |
316 | return IDLAttribute<JSHTMLHRElement>::get<jsHTMLHRElementWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
317 | } |
318 | |
319 | static inline bool setJSHTMLHRElementWidthSetter(ExecState& state, JSHTMLHRElement& thisObject, JSValue value, ThrowScope& throwScope) |
320 | { |
321 | UNUSED_PARAM(throwScope); |
322 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
323 | auto& impl = thisObject.wrapped(); |
324 | auto nativeValue = convert<IDLDOMString>(state, value); |
325 | RETURN_IF_EXCEPTION(throwScope, false); |
326 | AttributeSetter::call(state, throwScope, [&] { |
327 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::widthAttr, WTFMove(nativeValue)); |
328 | }); |
329 | return true; |
330 | } |
331 | |
332 | bool setJSHTMLHRElementWidth(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
333 | { |
334 | return IDLAttribute<JSHTMLHRElement>::set<setJSHTMLHRElementWidthSetter>(*state, thisValue, encodedValue, "width" ); |
335 | } |
336 | |
337 | void JSHTMLHRElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
338 | { |
339 | auto* thisObject = jsCast<JSHTMLHRElement*>(cell); |
340 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
341 | if (thisObject->scriptExecutionContext()) |
342 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
343 | Base::heapSnapshot(cell, builder); |
344 | } |
345 | |
346 | |
347 | } |
348 | |