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 "JSSVGTextPathElement.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 "JSSVGAnimatedEnumeration.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
42namespace WebCore {
43using namespace JSC;
44
45// Attributes
46
47JSC::EncodedJSValue jsSVGTextPathElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSSVGTextPathElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsSVGTextPathElementStartOffset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50JSC::EncodedJSValue jsSVGTextPathElementMethod(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsSVGTextPathElementSpacing(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsSVGTextPathElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53
54class JSSVGTextPathElementPrototype : public JSC::JSNonFinalObject {
55public:
56 using Base = JSC::JSNonFinalObject;
57 static JSSVGTextPathElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58 {
59 JSSVGTextPathElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGTextPathElementPrototype>(vm.heap)) JSSVGTextPathElementPrototype(vm, globalObject, structure);
60 ptr->finishCreation(vm);
61 return ptr;
62 }
63
64 DECLARE_INFO;
65 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66 {
67 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68 }
69
70private:
71 JSSVGTextPathElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72 : JSC::JSNonFinalObject(vm, structure)
73 {
74 }
75
76 void finishCreation(JSC::VM&);
77};
78
79using JSSVGTextPathElementConstructor = JSDOMConstructorNotConstructable<JSSVGTextPathElement>;
80
81/* Hash table for constructor */
82
83static const HashTableValue JSSVGTextPathElementConstructorTableValues[] =
84{
85 { "TEXTPATH_METHODTYPE_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
86 { "TEXTPATH_METHODTYPE_ALIGN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
87 { "TEXTPATH_METHODTYPE_STRETCH", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
88 { "TEXTPATH_SPACINGTYPE_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
89 { "TEXTPATH_SPACINGTYPE_AUTO", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
90 { "TEXTPATH_SPACINGTYPE_EXACT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
91};
92
93static_assert(SVGTextPathElement::TEXTPATH_METHODTYPE_UNKNOWN == 0, "TEXTPATH_METHODTYPE_UNKNOWN in SVGTextPathElement does not match value from IDL");
94static_assert(SVGTextPathElement::TEXTPATH_METHODTYPE_ALIGN == 1, "TEXTPATH_METHODTYPE_ALIGN in SVGTextPathElement does not match value from IDL");
95static_assert(SVGTextPathElement::TEXTPATH_METHODTYPE_STRETCH == 2, "TEXTPATH_METHODTYPE_STRETCH in SVGTextPathElement does not match value from IDL");
96static_assert(SVGTextPathElement::TEXTPATH_SPACINGTYPE_UNKNOWN == 0, "TEXTPATH_SPACINGTYPE_UNKNOWN in SVGTextPathElement does not match value from IDL");
97static_assert(SVGTextPathElement::TEXTPATH_SPACINGTYPE_AUTO == 1, "TEXTPATH_SPACINGTYPE_AUTO in SVGTextPathElement does not match value from IDL");
98static_assert(SVGTextPathElement::TEXTPATH_SPACINGTYPE_EXACT == 2, "TEXTPATH_SPACINGTYPE_EXACT in SVGTextPathElement does not match value from IDL");
99
100template<> JSValue JSSVGTextPathElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
101{
102 return JSSVGTextContentElement::getConstructor(vm, &globalObject);
103}
104
105template<> void JSSVGTextPathElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
106{
107 putDirect(vm, vm.propertyNames->prototype, JSSVGTextPathElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
108 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGTextPathElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
109 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
110 reifyStaticProperties(vm, JSSVGTextPathElement::info(), JSSVGTextPathElementConstructorTableValues, *this);
111}
112
113template<> const ClassInfo JSSVGTextPathElementConstructor::s_info = { "SVGTextPathElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPathElementConstructor) };
114
115/* Hash table for prototype */
116
117static const HashTableValue JSSVGTextPathElementPrototypeTableValues[] =
118{
119 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPathElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGTextPathElementConstructor) } },
120 { "startOffset", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPathElementStartOffset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
121 { "method", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPathElementMethod), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
122 { "spacing", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPathElementSpacing), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
123 { "href", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGTextPathElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
124 { "TEXTPATH_METHODTYPE_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
125 { "TEXTPATH_METHODTYPE_ALIGN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
126 { "TEXTPATH_METHODTYPE_STRETCH", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
127 { "TEXTPATH_SPACINGTYPE_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
128 { "TEXTPATH_SPACINGTYPE_AUTO", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
129 { "TEXTPATH_SPACINGTYPE_EXACT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
130};
131
132const ClassInfo JSSVGTextPathElementPrototype::s_info = { "SVGTextPathElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPathElementPrototype) };
133
134void JSSVGTextPathElementPrototype::finishCreation(VM& vm)
135{
136 Base::finishCreation(vm);
137 reifyStaticProperties(vm, JSSVGTextPathElement::info(), JSSVGTextPathElementPrototypeTableValues, *this);
138}
139
140const ClassInfo JSSVGTextPathElement::s_info = { "SVGTextPathElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGTextPathElement) };
141
142JSSVGTextPathElement::JSSVGTextPathElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGTextPathElement>&& impl)
143 : JSSVGTextContentElement(structure, globalObject, WTFMove(impl))
144{
145}
146
147void JSSVGTextPathElement::finishCreation(VM& vm)
148{
149 Base::finishCreation(vm);
150 ASSERT(inherits(vm, info()));
151
152}
153
154JSObject* JSSVGTextPathElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
155{
156 return JSSVGTextPathElementPrototype::create(vm, &globalObject, JSSVGTextPathElementPrototype::createStructure(vm, &globalObject, JSSVGTextContentElement::prototype(vm, globalObject)));
157}
158
159JSObject* JSSVGTextPathElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
160{
161 return getDOMPrototype<JSSVGTextPathElement>(vm, globalObject);
162}
163
164JSValue JSSVGTextPathElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
165{
166 return getDOMConstructor<JSSVGTextPathElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
167}
168
169template<> inline JSSVGTextPathElement* IDLAttribute<JSSVGTextPathElement>::cast(ExecState& state, EncodedJSValue thisValue)
170{
171 return jsDynamicCast<JSSVGTextPathElement*>(state.vm(), JSValue::decode(thisValue));
172}
173
174EncodedJSValue jsSVGTextPathElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
175{
176 VM& vm = state->vm();
177 auto throwScope = DECLARE_THROW_SCOPE(vm);
178 auto* prototype = jsDynamicCast<JSSVGTextPathElementPrototype*>(vm, JSValue::decode(thisValue));
179 if (UNLIKELY(!prototype))
180 return throwVMTypeError(state, throwScope);
181 return JSValue::encode(JSSVGTextPathElement::getConstructor(state->vm(), prototype->globalObject()));
182}
183
184bool setJSSVGTextPathElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
185{
186 VM& vm = state->vm();
187 auto throwScope = DECLARE_THROW_SCOPE(vm);
188 auto* prototype = jsDynamicCast<JSSVGTextPathElementPrototype*>(vm, JSValue::decode(thisValue));
189 if (UNLIKELY(!prototype)) {
190 throwVMTypeError(state, throwScope);
191 return false;
192 }
193 // Shadowing a built-in constructor
194 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
195}
196
197static inline JSValue jsSVGTextPathElementStartOffsetGetter(ExecState& state, JSSVGTextPathElement& thisObject, ThrowScope& throwScope)
198{
199 UNUSED_PARAM(throwScope);
200 UNUSED_PARAM(state);
201 auto& impl = thisObject.wrapped();
202 JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.startOffsetAnimated());
203 return result;
204}
205
206EncodedJSValue jsSVGTextPathElementStartOffset(ExecState* state, EncodedJSValue thisValue, PropertyName)
207{
208 return IDLAttribute<JSSVGTextPathElement>::get<jsSVGTextPathElementStartOffsetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "startOffset");
209}
210
211static inline JSValue jsSVGTextPathElementMethodGetter(ExecState& state, JSSVGTextPathElement& thisObject, ThrowScope& throwScope)
212{
213 UNUSED_PARAM(throwScope);
214 UNUSED_PARAM(state);
215 auto& impl = thisObject.wrapped();
216 JSValue result = toJS<IDLInterface<SVGAnimatedEnumeration>>(state, *thisObject.globalObject(), throwScope, impl.methodAnimated());
217 return result;
218}
219
220EncodedJSValue jsSVGTextPathElementMethod(ExecState* state, EncodedJSValue thisValue, PropertyName)
221{
222 return IDLAttribute<JSSVGTextPathElement>::get<jsSVGTextPathElementMethodGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "method");
223}
224
225static inline JSValue jsSVGTextPathElementSpacingGetter(ExecState& state, JSSVGTextPathElement& thisObject, ThrowScope& throwScope)
226{
227 UNUSED_PARAM(throwScope);
228 UNUSED_PARAM(state);
229 auto& impl = thisObject.wrapped();
230 JSValue result = toJS<IDLInterface<SVGAnimatedEnumeration>>(state, *thisObject.globalObject(), throwScope, impl.spacingAnimated());
231 return result;
232}
233
234EncodedJSValue jsSVGTextPathElementSpacing(ExecState* state, EncodedJSValue thisValue, PropertyName)
235{
236 return IDLAttribute<JSSVGTextPathElement>::get<jsSVGTextPathElementSpacingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "spacing");
237}
238
239static inline JSValue jsSVGTextPathElementHrefGetter(ExecState& state, JSSVGTextPathElement& thisObject, ThrowScope& throwScope)
240{
241 UNUSED_PARAM(throwScope);
242 UNUSED_PARAM(state);
243 auto& impl = thisObject.wrapped();
244 JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated());
245 return result;
246}
247
248EncodedJSValue jsSVGTextPathElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName)
249{
250 return IDLAttribute<JSSVGTextPathElement>::get<jsSVGTextPathElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href");
251}
252
253void JSSVGTextPathElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
254{
255 auto* thisObject = jsCast<JSSVGTextPathElement*>(cell);
256 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
257 if (thisObject->scriptExecutionContext())
258 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
259 Base::heapSnapshot(cell, builder);
260}
261
262
263}
264