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 "JSSVGScriptElement.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertInterface.h"
28#include "JSDOMConvertStrings.h"
29#include "JSDOMExceptionHandling.h"
30#include "JSDOMGlobalObject.h"
31#include "JSDOMWrapperCache.h"
32#include "JSSVGAnimatedBoolean.h"
33#include "JSSVGAnimatedString.h"
34#include "SVGNames.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
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsSVGScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSSVGScriptElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsSVGScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51bool setJSSVGScriptElementType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52JSC::EncodedJSValue jsSVGScriptElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53JSC::EncodedJSValue jsSVGScriptElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54
55class JSSVGScriptElementPrototype : public JSC::JSNonFinalObject {
56public:
57 using Base = JSC::JSNonFinalObject;
58 static JSSVGScriptElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
59 {
60 JSSVGScriptElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGScriptElementPrototype>(vm.heap)) JSSVGScriptElementPrototype(vm, globalObject, structure);
61 ptr->finishCreation(vm);
62 return ptr;
63 }
64
65 DECLARE_INFO;
66 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
67 {
68 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
69 }
70
71private:
72 JSSVGScriptElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
73 : JSC::JSNonFinalObject(vm, structure)
74 {
75 }
76
77 void finishCreation(JSC::VM&);
78};
79
80using JSSVGScriptElementConstructor = JSDOMConstructorNotConstructable<JSSVGScriptElement>;
81
82template<> JSValue JSSVGScriptElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
83{
84 return JSSVGElement::getConstructor(vm, &globalObject);
85}
86
87template<> void JSSVGScriptElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
88{
89 putDirect(vm, vm.propertyNames->prototype, JSSVGScriptElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGScriptElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
92}
93
94template<> const ClassInfo JSSVGScriptElementConstructor::s_info = { "SVGScriptElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGScriptElementConstructor) };
95
96/* Hash table for prototype */
97
98static const HashTableValue JSSVGScriptElementPrototypeTableValues[] =
99{
100 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGScriptElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGScriptElementConstructor) } },
101 { "type", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGScriptElementType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGScriptElementType) } },
102 { "externalResourcesRequired", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGScriptElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
103 { "href", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGScriptElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
104};
105
106const ClassInfo JSSVGScriptElementPrototype::s_info = { "SVGScriptElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGScriptElementPrototype) };
107
108void JSSVGScriptElementPrototype::finishCreation(VM& vm)
109{
110 Base::finishCreation(vm);
111 reifyStaticProperties(vm, JSSVGScriptElement::info(), JSSVGScriptElementPrototypeTableValues, *this);
112}
113
114const ClassInfo JSSVGScriptElement::s_info = { "SVGScriptElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGScriptElement) };
115
116JSSVGScriptElement::JSSVGScriptElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGScriptElement>&& impl)
117 : JSSVGElement(structure, globalObject, WTFMove(impl))
118{
119}
120
121void JSSVGScriptElement::finishCreation(VM& vm)
122{
123 Base::finishCreation(vm);
124 ASSERT(inherits(vm, info()));
125
126}
127
128JSObject* JSSVGScriptElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return JSSVGScriptElementPrototype::create(vm, &globalObject, JSSVGScriptElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject)));
131}
132
133JSObject* JSSVGScriptElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
134{
135 return getDOMPrototype<JSSVGScriptElement>(vm, globalObject);
136}
137
138JSValue JSSVGScriptElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
139{
140 return getDOMConstructor<JSSVGScriptElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
141}
142
143template<> inline JSSVGScriptElement* IDLAttribute<JSSVGScriptElement>::cast(ExecState& state, EncodedJSValue thisValue)
144{
145 return jsDynamicCast<JSSVGScriptElement*>(state.vm(), JSValue::decode(thisValue));
146}
147
148EncodedJSValue jsSVGScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
149{
150 VM& vm = state->vm();
151 auto throwScope = DECLARE_THROW_SCOPE(vm);
152 auto* prototype = jsDynamicCast<JSSVGScriptElementPrototype*>(vm, JSValue::decode(thisValue));
153 if (UNLIKELY(!prototype))
154 return throwVMTypeError(state, throwScope);
155 return JSValue::encode(JSSVGScriptElement::getConstructor(state->vm(), prototype->globalObject()));
156}
157
158bool setJSSVGScriptElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
159{
160 VM& vm = state->vm();
161 auto throwScope = DECLARE_THROW_SCOPE(vm);
162 auto* prototype = jsDynamicCast<JSSVGScriptElementPrototype*>(vm, JSValue::decode(thisValue));
163 if (UNLIKELY(!prototype)) {
164 throwVMTypeError(state, throwScope);
165 return false;
166 }
167 // Shadowing a built-in constructor
168 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
169}
170
171static inline JSValue jsSVGScriptElementTypeGetter(ExecState& state, JSSVGScriptElement& thisObject, ThrowScope& throwScope)
172{
173 UNUSED_PARAM(throwScope);
174 UNUSED_PARAM(state);
175 auto& impl = thisObject.wrapped();
176 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::SVGNames::typeAttr));
177 return result;
178}
179
180EncodedJSValue jsSVGScriptElementType(ExecState* state, EncodedJSValue thisValue, PropertyName)
181{
182 return IDLAttribute<JSSVGScriptElement>::get<jsSVGScriptElementTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "type");
183}
184
185static inline bool setJSSVGScriptElementTypeSetter(ExecState& state, JSSVGScriptElement& thisObject, JSValue value, ThrowScope& throwScope)
186{
187 UNUSED_PARAM(throwScope);
188 auto& impl = thisObject.wrapped();
189 auto nativeValue = convert<IDLDOMString>(state, value);
190 RETURN_IF_EXCEPTION(throwScope, false);
191 AttributeSetter::call(state, throwScope, [&] {
192 return impl.setAttributeWithoutSynchronization(WebCore::SVGNames::typeAttr, WTFMove(nativeValue));
193 });
194 return true;
195}
196
197bool setJSSVGScriptElementType(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
198{
199 return IDLAttribute<JSSVGScriptElement>::set<setJSSVGScriptElementTypeSetter>(*state, thisValue, encodedValue, "type");
200}
201
202static inline JSValue jsSVGScriptElementExternalResourcesRequiredGetter(ExecState& state, JSSVGScriptElement& thisObject, ThrowScope& throwScope)
203{
204 UNUSED_PARAM(throwScope);
205 UNUSED_PARAM(state);
206 auto& impl = thisObject.wrapped();
207 JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated());
208 return result;
209}
210
211EncodedJSValue jsSVGScriptElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName)
212{
213 return IDLAttribute<JSSVGScriptElement>::get<jsSVGScriptElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired");
214}
215
216static inline JSValue jsSVGScriptElementHrefGetter(ExecState& state, JSSVGScriptElement& thisObject, ThrowScope& throwScope)
217{
218 UNUSED_PARAM(throwScope);
219 UNUSED_PARAM(state);
220 auto& impl = thisObject.wrapped();
221 JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated());
222 return result;
223}
224
225EncodedJSValue jsSVGScriptElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName)
226{
227 return IDLAttribute<JSSVGScriptElement>::get<jsSVGScriptElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href");
228}
229
230void JSSVGScriptElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
231{
232 auto* thisObject = jsCast<JSSVGScriptElement*>(cell);
233 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
234 if (thisObject->scriptExecutionContext())
235 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
236 Base::heapSnapshot(cell, builder);
237}
238
239
240}
241