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 "JSSVGStyleElement.h" |
23 | |
24 | #include "JSDOMAttribute.h" |
25 | #include "JSDOMBinding.h" |
26 | #include "JSDOMConstructorNotConstructable.h" |
27 | #include "JSDOMConvertBoolean.h" |
28 | #include "JSDOMConvertStrings.h" |
29 | #include "JSDOMExceptionHandling.h" |
30 | #include "JSDOMWrapperCache.h" |
31 | #include "SVGNames.h" |
32 | #include "ScriptExecutionContext.h" |
33 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
34 | #include <JavaScriptCore/JSCInlines.h> |
35 | #include <wtf/GetPtr.h> |
36 | #include <wtf/PointerPreparations.h> |
37 | #include <wtf/URL.h> |
38 | |
39 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Attributes |
44 | |
45 | JSC::EncodedJSValue jsSVGStyleElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSSVGStyleElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | JSC::EncodedJSValue jsSVGStyleElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | bool setJSSVGStyleElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
49 | JSC::EncodedJSValue jsSVGStyleElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | bool setJSSVGStyleElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
51 | JSC::EncodedJSValue jsSVGStyleElementMedia(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | bool setJSSVGStyleElementMedia(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
53 | JSC::EncodedJSValue jsSVGStyleElementTitle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | bool setJSSVGStyleElementTitle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
55 | |
56 | class JSSVGStyleElementPrototype : public JSC::JSNonFinalObject { |
57 | public: |
58 | using Base = JSC::JSNonFinalObject; |
59 | static JSSVGStyleElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
60 | { |
61 | JSSVGStyleElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGStyleElementPrototype>(vm.heap)) JSSVGStyleElementPrototype(vm, globalObject, structure); |
62 | ptr->finishCreation(vm); |
63 | return ptr; |
64 | } |
65 | |
66 | DECLARE_INFO; |
67 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
68 | { |
69 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
70 | } |
71 | |
72 | private: |
73 | JSSVGStyleElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
74 | : JSC::JSNonFinalObject(vm, structure) |
75 | { |
76 | } |
77 | |
78 | void finishCreation(JSC::VM&); |
79 | }; |
80 | |
81 | using JSSVGStyleElementConstructor = JSDOMConstructorNotConstructable<JSSVGStyleElement>; |
82 | |
83 | template<> JSValue JSSVGStyleElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
84 | { |
85 | return JSSVGElement::getConstructor(vm, &globalObject); |
86 | } |
87 | |
88 | template<> void JSSVGStyleElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
89 | { |
90 | putDirect(vm, vm.propertyNames->prototype, JSSVGStyleElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGStyleElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
92 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
93 | } |
94 | |
95 | template<> const ClassInfo JSSVGStyleElementConstructor::s_info = { "SVGStyleElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElementConstructor) }; |
96 | |
97 | /* Hash table for prototype */ |
98 | |
99 | static const HashTableValue JSSVGStyleElementPrototypeTableValues[] = |
100 | { |
101 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStyleElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStyleElementConstructor) } }, |
102 | { "disabled" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStyleElementDisabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStyleElementDisabled) } }, |
103 | { "type" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStyleElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStyleElementType) } }, |
104 | { "media" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStyleElementMedia), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStyleElementMedia) } }, |
105 | { "title" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStyleElementTitle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStyleElementTitle) } }, |
106 | }; |
107 | |
108 | const ClassInfo JSSVGStyleElementPrototype::s_info = { "SVGStyleElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElementPrototype) }; |
109 | |
110 | void JSSVGStyleElementPrototype::finishCreation(VM& vm) |
111 | { |
112 | Base::finishCreation(vm); |
113 | reifyStaticProperties(vm, JSSVGStyleElement::info(), JSSVGStyleElementPrototypeTableValues, *this); |
114 | } |
115 | |
116 | const ClassInfo JSSVGStyleElement::s_info = { "SVGStyleElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElement) }; |
117 | |
118 | JSSVGStyleElement::JSSVGStyleElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGStyleElement>&& impl) |
119 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
120 | { |
121 | } |
122 | |
123 | void JSSVGStyleElement::finishCreation(VM& vm) |
124 | { |
125 | Base::finishCreation(vm); |
126 | ASSERT(inherits(vm, info())); |
127 | |
128 | } |
129 | |
130 | JSObject* JSSVGStyleElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
131 | { |
132 | return JSSVGStyleElementPrototype::create(vm, &globalObject, JSSVGStyleElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
133 | } |
134 | |
135 | JSObject* JSSVGStyleElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
136 | { |
137 | return getDOMPrototype<JSSVGStyleElement>(vm, globalObject); |
138 | } |
139 | |
140 | JSValue JSSVGStyleElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
141 | { |
142 | return getDOMConstructor<JSSVGStyleElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
143 | } |
144 | |
145 | template<> inline JSSVGStyleElement* IDLAttribute<JSSVGStyleElement>::cast(ExecState& state, EncodedJSValue thisValue) |
146 | { |
147 | return jsDynamicCast<JSSVGStyleElement*>(state.vm(), JSValue::decode(thisValue)); |
148 | } |
149 | |
150 | EncodedJSValue jsSVGStyleElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSSVGStyleElementPrototype*>(vm, JSValue::decode(thisValue)); |
155 | if (UNLIKELY(!prototype)) |
156 | return throwVMTypeError(state, throwScope); |
157 | return JSValue::encode(JSSVGStyleElement::getConstructor(state->vm(), prototype->globalObject())); |
158 | } |
159 | |
160 | bool setJSSVGStyleElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
161 | { |
162 | VM& vm = state->vm(); |
163 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
164 | auto* prototype = jsDynamicCast<JSSVGStyleElementPrototype*>(vm, JSValue::decode(thisValue)); |
165 | if (UNLIKELY(!prototype)) { |
166 | throwVMTypeError(state, throwScope); |
167 | return false; |
168 | } |
169 | // Shadowing a built-in constructor |
170 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
171 | } |
172 | |
173 | static inline JSValue jsSVGStyleElementDisabledGetter(ExecState& state, JSSVGStyleElement& thisObject, ThrowScope& throwScope) |
174 | { |
175 | UNUSED_PARAM(throwScope); |
176 | UNUSED_PARAM(state); |
177 | auto& impl = thisObject.wrapped(); |
178 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.disabled()); |
179 | return result; |
180 | } |
181 | |
182 | EncodedJSValue jsSVGStyleElementDisabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
183 | { |
184 | return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementDisabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "disabled" ); |
185 | } |
186 | |
187 | static inline bool setJSSVGStyleElementDisabledSetter(ExecState& state, JSSVGStyleElement& thisObject, JSValue value, ThrowScope& throwScope) |
188 | { |
189 | UNUSED_PARAM(throwScope); |
190 | auto& impl = thisObject.wrapped(); |
191 | auto nativeValue = convert<IDLBoolean>(state, value); |
192 | RETURN_IF_EXCEPTION(throwScope, false); |
193 | AttributeSetter::call(state, throwScope, [&] { |
194 | return impl.setDisabled(WTFMove(nativeValue)); |
195 | }); |
196 | return true; |
197 | } |
198 | |
199 | bool setJSSVGStyleElementDisabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
200 | { |
201 | return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementDisabledSetter>(*state, thisValue, encodedValue, "disabled" ); |
202 | } |
203 | |
204 | static inline JSValue jsSVGStyleElementTypeGetter(ExecState& state, JSSVGStyleElement& thisObject, ThrowScope& throwScope) |
205 | { |
206 | UNUSED_PARAM(throwScope); |
207 | UNUSED_PARAM(state); |
208 | auto& impl = thisObject.wrapped(); |
209 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.type()); |
210 | return result; |
211 | } |
212 | |
213 | EncodedJSValue jsSVGStyleElementType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
214 | { |
215 | return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type" ); |
216 | } |
217 | |
218 | static inline bool setJSSVGStyleElementTypeSetter(ExecState& state, JSSVGStyleElement& thisObject, JSValue value, ThrowScope& throwScope) |
219 | { |
220 | UNUSED_PARAM(throwScope); |
221 | auto& impl = thisObject.wrapped(); |
222 | auto nativeValue = convert<IDLDOMString>(state, value); |
223 | RETURN_IF_EXCEPTION(throwScope, false); |
224 | AttributeSetter::call(state, throwScope, [&] { |
225 | return impl.setType(WTFMove(nativeValue)); |
226 | }); |
227 | return true; |
228 | } |
229 | |
230 | bool setJSSVGStyleElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
231 | { |
232 | return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementTypeSetter>(*state, thisValue, encodedValue, "type" ); |
233 | } |
234 | |
235 | static inline JSValue jsSVGStyleElementMediaGetter(ExecState& state, JSSVGStyleElement& thisObject, ThrowScope& throwScope) |
236 | { |
237 | UNUSED_PARAM(throwScope); |
238 | UNUSED_PARAM(state); |
239 | auto& impl = thisObject.wrapped(); |
240 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.media()); |
241 | return result; |
242 | } |
243 | |
244 | EncodedJSValue jsSVGStyleElementMedia(ExecState* state, EncodedJSValue thisValue, PropertyName) |
245 | { |
246 | return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementMediaGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "media" ); |
247 | } |
248 | |
249 | static inline bool setJSSVGStyleElementMediaSetter(ExecState& state, JSSVGStyleElement& thisObject, JSValue value, ThrowScope& throwScope) |
250 | { |
251 | UNUSED_PARAM(throwScope); |
252 | auto& impl = thisObject.wrapped(); |
253 | auto nativeValue = convert<IDLDOMString>(state, value); |
254 | RETURN_IF_EXCEPTION(throwScope, false); |
255 | AttributeSetter::call(state, throwScope, [&] { |
256 | return impl.setMedia(WTFMove(nativeValue)); |
257 | }); |
258 | return true; |
259 | } |
260 | |
261 | bool setJSSVGStyleElementMedia(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
262 | { |
263 | return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementMediaSetter>(*state, thisValue, encodedValue, "media" ); |
264 | } |
265 | |
266 | static inline JSValue jsSVGStyleElementTitleGetter(ExecState& state, JSSVGStyleElement& thisObject, ThrowScope& throwScope) |
267 | { |
268 | UNUSED_PARAM(throwScope); |
269 | UNUSED_PARAM(state); |
270 | auto& impl = thisObject.wrapped(); |
271 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::SVGNames::titleAttr)); |
272 | return result; |
273 | } |
274 | |
275 | EncodedJSValue jsSVGStyleElementTitle(ExecState* state, EncodedJSValue thisValue, PropertyName) |
276 | { |
277 | return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementTitleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "title" ); |
278 | } |
279 | |
280 | static inline bool setJSSVGStyleElementTitleSetter(ExecState& state, JSSVGStyleElement& thisObject, JSValue value, ThrowScope& throwScope) |
281 | { |
282 | UNUSED_PARAM(throwScope); |
283 | auto& impl = thisObject.wrapped(); |
284 | auto nativeValue = convert<IDLDOMString>(state, value); |
285 | RETURN_IF_EXCEPTION(throwScope, false); |
286 | AttributeSetter::call(state, throwScope, [&] { |
287 | return impl.setAttributeWithoutSynchronization(WebCore::SVGNames::titleAttr, WTFMove(nativeValue)); |
288 | }); |
289 | return true; |
290 | } |
291 | |
292 | bool setJSSVGStyleElementTitle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
293 | { |
294 | return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementTitleSetter>(*state, thisValue, encodedValue, "title" ); |
295 | } |
296 | |
297 | void JSSVGStyleElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
298 | { |
299 | auto* thisObject = jsCast<JSSVGStyleElement*>(cell); |
300 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
301 | if (thisObject->scriptExecutionContext()) |
302 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
303 | Base::heapSnapshot(cell, builder); |
304 | } |
305 | |
306 | |
307 | } |
308 | |