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