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 "JSSVGUseElement.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 "JSSVGAnimatedLength.h" |
33 | #include "JSSVGAnimatedString.h" |
34 | #include "ScriptExecutionContext.h" |
35 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
36 | #include <JavaScriptCore/JSCInlines.h> |
37 | #include <wtf/GetPtr.h> |
38 | #include <wtf/PointerPreparations.h> |
39 | #include <wtf/URL.h> |
40 | |
41 | |
42 | namespace WebCore { |
43 | using namespace JSC; |
44 | |
45 | // Attributes |
46 | |
47 | JSC::EncodedJSValue jsSVGUseElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | bool setJSSVGUseElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
49 | JSC::EncodedJSValue jsSVGUseElementX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | JSC::EncodedJSValue jsSVGUseElementY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsSVGUseElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | JSC::EncodedJSValue jsSVGUseElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | JSC::EncodedJSValue jsSVGUseElementExternalResourcesRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | JSC::EncodedJSValue jsSVGUseElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
55 | |
56 | class JSSVGUseElementPrototype : public JSC::JSNonFinalObject { |
57 | public: |
58 | using Base = JSC::JSNonFinalObject; |
59 | static JSSVGUseElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
60 | { |
61 | JSSVGUseElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGUseElementPrototype>(vm.heap)) JSSVGUseElementPrototype(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 | JSSVGUseElementPrototype(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 JSSVGUseElementConstructor = JSDOMConstructorNotConstructable<JSSVGUseElement>; |
82 | |
83 | template<> JSValue JSSVGUseElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
84 | { |
85 | return JSSVGGraphicsElement::getConstructor(vm, &globalObject); |
86 | } |
87 | |
88 | template<> void JSSVGUseElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
89 | { |
90 | putDirect(vm, vm.propertyNames->prototype, JSSVGUseElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
91 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGUseElement"_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 JSSVGUseElementConstructor::s_info = { "SVGUseElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGUseElementConstructor) }; |
96 | |
97 | /* Hash table for prototype */ |
98 | |
99 | static const HashTableValue JSSVGUseElementPrototypeTableValues[] = |
100 | { |
101 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGUseElementConstructor) } }, |
102 | { "x" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
103 | { "y" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
104 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
105 | { "height" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
106 | { "externalResourcesRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementExternalResourcesRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
107 | { "href" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGUseElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
108 | }; |
109 | |
110 | const ClassInfo JSSVGUseElementPrototype::s_info = { "SVGUseElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGUseElementPrototype) }; |
111 | |
112 | void JSSVGUseElementPrototype::finishCreation(VM& vm) |
113 | { |
114 | Base::finishCreation(vm); |
115 | reifyStaticProperties(vm, JSSVGUseElement::info(), JSSVGUseElementPrototypeTableValues, *this); |
116 | } |
117 | |
118 | const ClassInfo JSSVGUseElement::s_info = { "SVGUseElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGUseElement) }; |
119 | |
120 | JSSVGUseElement::JSSVGUseElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGUseElement>&& impl) |
121 | : JSSVGGraphicsElement(structure, globalObject, WTFMove(impl)) |
122 | { |
123 | } |
124 | |
125 | void JSSVGUseElement::finishCreation(VM& vm) |
126 | { |
127 | Base::finishCreation(vm); |
128 | ASSERT(inherits(vm, info())); |
129 | |
130 | } |
131 | |
132 | JSObject* JSSVGUseElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
133 | { |
134 | return JSSVGUseElementPrototype::create(vm, &globalObject, JSSVGUseElementPrototype::createStructure(vm, &globalObject, JSSVGGraphicsElement::prototype(vm, globalObject))); |
135 | } |
136 | |
137 | JSObject* JSSVGUseElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
138 | { |
139 | return getDOMPrototype<JSSVGUseElement>(vm, globalObject); |
140 | } |
141 | |
142 | JSValue JSSVGUseElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
143 | { |
144 | return getDOMConstructor<JSSVGUseElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
145 | } |
146 | |
147 | template<> inline JSSVGUseElement* IDLAttribute<JSSVGUseElement>::cast(ExecState& state, EncodedJSValue thisValue) |
148 | { |
149 | return jsDynamicCast<JSSVGUseElement*>(state.vm(), JSValue::decode(thisValue)); |
150 | } |
151 | |
152 | EncodedJSValue jsSVGUseElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
153 | { |
154 | VM& vm = state->vm(); |
155 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
156 | auto* prototype = jsDynamicCast<JSSVGUseElementPrototype*>(vm, JSValue::decode(thisValue)); |
157 | if (UNLIKELY(!prototype)) |
158 | return throwVMTypeError(state, throwScope); |
159 | return JSValue::encode(JSSVGUseElement::getConstructor(state->vm(), prototype->globalObject())); |
160 | } |
161 | |
162 | bool setJSSVGUseElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
163 | { |
164 | VM& vm = state->vm(); |
165 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
166 | auto* prototype = jsDynamicCast<JSSVGUseElementPrototype*>(vm, JSValue::decode(thisValue)); |
167 | if (UNLIKELY(!prototype)) { |
168 | throwVMTypeError(state, throwScope); |
169 | return false; |
170 | } |
171 | // Shadowing a built-in constructor |
172 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
173 | } |
174 | |
175 | static inline JSValue jsSVGUseElementXGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
176 | { |
177 | UNUSED_PARAM(throwScope); |
178 | UNUSED_PARAM(state); |
179 | auto& impl = thisObject.wrapped(); |
180 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.xAnimated()); |
181 | return result; |
182 | } |
183 | |
184 | EncodedJSValue jsSVGUseElementX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
185 | { |
186 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x" ); |
187 | } |
188 | |
189 | static inline JSValue jsSVGUseElementYGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
190 | { |
191 | UNUSED_PARAM(throwScope); |
192 | UNUSED_PARAM(state); |
193 | auto& impl = thisObject.wrapped(); |
194 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.yAnimated()); |
195 | return result; |
196 | } |
197 | |
198 | EncodedJSValue jsSVGUseElementY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
199 | { |
200 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y" ); |
201 | } |
202 | |
203 | static inline JSValue jsSVGUseElementWidthGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
204 | { |
205 | UNUSED_PARAM(throwScope); |
206 | UNUSED_PARAM(state); |
207 | auto& impl = thisObject.wrapped(); |
208 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.widthAnimated()); |
209 | return result; |
210 | } |
211 | |
212 | EncodedJSValue jsSVGUseElementWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
213 | { |
214 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
215 | } |
216 | |
217 | static inline JSValue jsSVGUseElementHeightGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
218 | { |
219 | UNUSED_PARAM(throwScope); |
220 | UNUSED_PARAM(state); |
221 | auto& impl = thisObject.wrapped(); |
222 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.heightAnimated()); |
223 | return result; |
224 | } |
225 | |
226 | EncodedJSValue jsSVGUseElementHeight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
227 | { |
228 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "height" ); |
229 | } |
230 | |
231 | static inline JSValue jsSVGUseElementExternalResourcesRequiredGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
232 | { |
233 | UNUSED_PARAM(throwScope); |
234 | UNUSED_PARAM(state); |
235 | auto& impl = thisObject.wrapped(); |
236 | JSValue result = toJS<IDLInterface<SVGAnimatedBoolean>>(state, *thisObject.globalObject(), throwScope, impl.externalResourcesRequiredAnimated()); |
237 | return result; |
238 | } |
239 | |
240 | EncodedJSValue jsSVGUseElementExternalResourcesRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
241 | { |
242 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementExternalResourcesRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalResourcesRequired" ); |
243 | } |
244 | |
245 | static inline JSValue jsSVGUseElementHrefGetter(ExecState& state, JSSVGUseElement& thisObject, ThrowScope& throwScope) |
246 | { |
247 | UNUSED_PARAM(throwScope); |
248 | UNUSED_PARAM(state); |
249 | auto& impl = thisObject.wrapped(); |
250 | JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated()); |
251 | return result; |
252 | } |
253 | |
254 | EncodedJSValue jsSVGUseElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName) |
255 | { |
256 | return IDLAttribute<JSSVGUseElement>::get<jsSVGUseElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href" ); |
257 | } |
258 | |
259 | void JSSVGUseElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
260 | { |
261 | auto* thisObject = jsCast<JSSVGUseElement*>(cell); |
262 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
263 | if (thisObject->scriptExecutionContext()) |
264 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
265 | Base::heapSnapshot(cell, builder); |
266 | } |
267 | |
268 | |
269 | } |
270 | |