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
40namespace WebCore {
41using namespace JSC;
42
43// Attributes
44
45JSC::EncodedJSValue jsSVGStyleElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSSVGStyleElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsSVGStyleElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSSVGStyleElementDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsSVGStyleElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSSVGStyleElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsSVGStyleElementMedia(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSSVGStyleElementMedia(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53JSC::EncodedJSValue jsSVGStyleElementTitle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54bool setJSSVGStyleElementTitle(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55
56class JSSVGStyleElementPrototype : public JSC::JSNonFinalObject {
57public:
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
72private:
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
81using JSSVGStyleElementConstructor = JSDOMConstructorNotConstructable<JSSVGStyleElement>;
82
83template<> JSValue JSSVGStyleElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
84{
85 return JSSVGElement::getConstructor(vm, &globalObject);
86}
87
88template<> 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
95template<> const ClassInfo JSSVGStyleElementConstructor::s_info = { "SVGStyleElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElementConstructor) };
96
97/* Hash table for prototype */
98
99static 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
108const ClassInfo JSSVGStyleElementPrototype::s_info = { "SVGStyleElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElementPrototype) };
109
110void JSSVGStyleElementPrototype::finishCreation(VM& vm)
111{
112 Base::finishCreation(vm);
113 reifyStaticProperties(vm, JSSVGStyleElement::info(), JSSVGStyleElementPrototypeTableValues, *this);
114}
115
116const ClassInfo JSSVGStyleElement::s_info = { "SVGStyleElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStyleElement) };
117
118JSSVGStyleElement::JSSVGStyleElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGStyleElement>&& impl)
119 : JSSVGElement(structure, globalObject, WTFMove(impl))
120{
121}
122
123void JSSVGStyleElement::finishCreation(VM& vm)
124{
125 Base::finishCreation(vm);
126 ASSERT(inherits(vm, info()));
127
128}
129
130JSObject* JSSVGStyleElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return JSSVGStyleElementPrototype::create(vm, &globalObject, JSSVGStyleElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject)));
133}
134
135JSObject* JSSVGStyleElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
136{
137 return getDOMPrototype<JSSVGStyleElement>(vm, globalObject);
138}
139
140JSValue JSSVGStyleElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
141{
142 return getDOMConstructor<JSSVGStyleElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
143}
144
145template<> inline JSSVGStyleElement* IDLAttribute<JSSVGStyleElement>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSSVGStyleElement*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue 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
160bool 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
173static 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
182EncodedJSValue jsSVGStyleElementDisabled(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementDisabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "disabled");
185}
186
187static 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
199bool setJSSVGStyleElementDisabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
200{
201 return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementDisabledSetter>(*state, thisValue, encodedValue, "disabled");
202}
203
204static 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
213EncodedJSValue jsSVGStyleElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
214{
215 return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type");
216}
217
218static 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
230bool setJSSVGStyleElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
231{
232 return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementTypeSetter>(*state, thisValue, encodedValue, "type");
233}
234
235static 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
244EncodedJSValue jsSVGStyleElementMedia(ExecState* state, EncodedJSValue thisValue, PropertyName)
245{
246 return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementMediaGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "media");
247}
248
249static 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
261bool setJSSVGStyleElementMedia(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
262{
263 return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementMediaSetter>(*state, thisValue, encodedValue, "media");
264}
265
266static 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
275EncodedJSValue jsSVGStyleElementTitle(ExecState* state, EncodedJSValue thisValue, PropertyName)
276{
277 return IDLAttribute<JSSVGStyleElement>::get<jsSVGStyleElementTitleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "title");
278}
279
280static 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
292bool setJSSVGStyleElementTitle(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
293{
294 return IDLAttribute<JSSVGStyleElement>::set<setJSSVGStyleElementTitleSetter>(*state, thisValue, encodedValue, "title");
295}
296
297void 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