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
23#if ENABLE(SVG_FONTS)
24
25#include "JSSVGAltGlyphElement.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertInterface.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMWrapperCache.h"
35#include "JSSVGAnimatedString.h"
36#include "ScriptExecutionContext.h"
37#include <JavaScriptCore/HeapSnapshotBuilder.h>
38#include <JavaScriptCore/JSCInlines.h>
39#include <wtf/GetPtr.h>
40#include <wtf/PointerPreparations.h>
41#include <wtf/URL.h>
42
43
44namespace WebCore {
45using namespace JSC;
46
47// Attributes
48
49JSC::EncodedJSValue jsSVGAltGlyphElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSSVGAltGlyphElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsSVGAltGlyphElementGlyphRef(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSSVGAltGlyphElementGlyphRef(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53JSC::EncodedJSValue jsSVGAltGlyphElementFormat(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54bool setJSSVGAltGlyphElementFormat(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55JSC::EncodedJSValue jsSVGAltGlyphElementHref(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56
57class JSSVGAltGlyphElementPrototype : public JSC::JSNonFinalObject {
58public:
59 using Base = JSC::JSNonFinalObject;
60 static JSSVGAltGlyphElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
61 {
62 JSSVGAltGlyphElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGAltGlyphElementPrototype>(vm.heap)) JSSVGAltGlyphElementPrototype(vm, globalObject, structure);
63 ptr->finishCreation(vm);
64 return ptr;
65 }
66
67 DECLARE_INFO;
68 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
69 {
70 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
71 }
72
73private:
74 JSSVGAltGlyphElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
75 : JSC::JSNonFinalObject(vm, structure)
76 {
77 }
78
79 void finishCreation(JSC::VM&);
80};
81
82using JSSVGAltGlyphElementConstructor = JSDOMConstructorNotConstructable<JSSVGAltGlyphElement>;
83
84template<> JSValue JSSVGAltGlyphElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
85{
86 return JSSVGTextPositioningElement::getConstructor(vm, &globalObject);
87}
88
89template<> void JSSVGAltGlyphElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
90{
91 putDirect(vm, vm.propertyNames->prototype, JSSVGAltGlyphElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
92 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGAltGlyphElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
93 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
94}
95
96template<> const ClassInfo JSSVGAltGlyphElementConstructor::s_info = { "SVGAltGlyphElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAltGlyphElementConstructor) };
97
98/* Hash table for prototype */
99
100static const HashTableValue JSSVGAltGlyphElementPrototypeTableValues[] =
101{
102 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAltGlyphElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAltGlyphElementConstructor) } },
103 { "glyphRef", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAltGlyphElementGlyphRef), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAltGlyphElementGlyphRef) } },
104 { "format", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAltGlyphElementFormat), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGAltGlyphElementFormat) } },
105 { "href", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGAltGlyphElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
106};
107
108const ClassInfo JSSVGAltGlyphElementPrototype::s_info = { "SVGAltGlyphElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAltGlyphElementPrototype) };
109
110void JSSVGAltGlyphElementPrototype::finishCreation(VM& vm)
111{
112 Base::finishCreation(vm);
113 reifyStaticProperties(vm, JSSVGAltGlyphElement::info(), JSSVGAltGlyphElementPrototypeTableValues, *this);
114}
115
116const ClassInfo JSSVGAltGlyphElement::s_info = { "SVGAltGlyphElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGAltGlyphElement) };
117
118JSSVGAltGlyphElement::JSSVGAltGlyphElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGAltGlyphElement>&& impl)
119 : JSSVGTextPositioningElement(structure, globalObject, WTFMove(impl))
120{
121}
122
123void JSSVGAltGlyphElement::finishCreation(VM& vm)
124{
125 Base::finishCreation(vm);
126 ASSERT(inherits(vm, info()));
127
128}
129
130JSObject* JSSVGAltGlyphElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
131{
132 return JSSVGAltGlyphElementPrototype::create(vm, &globalObject, JSSVGAltGlyphElementPrototype::createStructure(vm, &globalObject, JSSVGTextPositioningElement::prototype(vm, globalObject)));
133}
134
135JSObject* JSSVGAltGlyphElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
136{
137 return getDOMPrototype<JSSVGAltGlyphElement>(vm, globalObject);
138}
139
140JSValue JSSVGAltGlyphElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
141{
142 return getDOMConstructor<JSSVGAltGlyphElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
143}
144
145template<> inline JSSVGAltGlyphElement* IDLAttribute<JSSVGAltGlyphElement>::cast(ExecState& state, EncodedJSValue thisValue)
146{
147 return jsDynamicCast<JSSVGAltGlyphElement*>(state.vm(), JSValue::decode(thisValue));
148}
149
150EncodedJSValue jsSVGAltGlyphElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
151{
152 VM& vm = state->vm();
153 auto throwScope = DECLARE_THROW_SCOPE(vm);
154 auto* prototype = jsDynamicCast<JSSVGAltGlyphElementPrototype*>(vm, JSValue::decode(thisValue));
155 if (UNLIKELY(!prototype))
156 return throwVMTypeError(state, throwScope);
157 return JSValue::encode(JSSVGAltGlyphElement::getConstructor(state->vm(), prototype->globalObject()));
158}
159
160bool setJSSVGAltGlyphElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
161{
162 VM& vm = state->vm();
163 auto throwScope = DECLARE_THROW_SCOPE(vm);
164 auto* prototype = jsDynamicCast<JSSVGAltGlyphElementPrototype*>(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 jsSVGAltGlyphElementGlyphRefGetter(ExecState& state, JSSVGAltGlyphElement& thisObject, ThrowScope& throwScope)
174{
175 UNUSED_PARAM(throwScope);
176 UNUSED_PARAM(state);
177 auto& impl = thisObject.wrapped();
178 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.glyphRef());
179 return result;
180}
181
182EncodedJSValue jsSVGAltGlyphElementGlyphRef(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 return IDLAttribute<JSSVGAltGlyphElement>::get<jsSVGAltGlyphElementGlyphRefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "glyphRef");
185}
186
187static inline bool setJSSVGAltGlyphElementGlyphRefSetter(ExecState& state, JSSVGAltGlyphElement& thisObject, JSValue value, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 auto& impl = thisObject.wrapped();
191 auto nativeValue = convert<IDLDOMString>(state, value);
192 RETURN_IF_EXCEPTION(throwScope, false);
193 AttributeSetter::call(state, throwScope, [&] {
194 return impl.setGlyphRef(WTFMove(nativeValue));
195 });
196 return true;
197}
198
199bool setJSSVGAltGlyphElementGlyphRef(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
200{
201 return IDLAttribute<JSSVGAltGlyphElement>::set<setJSSVGAltGlyphElementGlyphRefSetter>(*state, thisValue, encodedValue, "glyphRef");
202}
203
204static inline JSValue jsSVGAltGlyphElementFormatGetter(ExecState& state, JSSVGAltGlyphElement& 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.format());
210 return result;
211}
212
213EncodedJSValue jsSVGAltGlyphElementFormat(ExecState* state, EncodedJSValue thisValue, PropertyName)
214{
215 return IDLAttribute<JSSVGAltGlyphElement>::get<jsSVGAltGlyphElementFormatGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "format");
216}
217
218static inline bool setJSSVGAltGlyphElementFormatSetter(ExecState& state, JSSVGAltGlyphElement& 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.setFormat(WTFMove(nativeValue));
226 });
227 return true;
228}
229
230bool setJSSVGAltGlyphElementFormat(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
231{
232 return IDLAttribute<JSSVGAltGlyphElement>::set<setJSSVGAltGlyphElementFormatSetter>(*state, thisValue, encodedValue, "format");
233}
234
235static inline JSValue jsSVGAltGlyphElementHrefGetter(ExecState& state, JSSVGAltGlyphElement& thisObject, ThrowScope& throwScope)
236{
237 UNUSED_PARAM(throwScope);
238 UNUSED_PARAM(state);
239 auto& impl = thisObject.wrapped();
240 JSValue result = toJS<IDLInterface<SVGAnimatedString>>(state, *thisObject.globalObject(), throwScope, impl.hrefAnimated());
241 return result;
242}
243
244EncodedJSValue jsSVGAltGlyphElementHref(ExecState* state, EncodedJSValue thisValue, PropertyName)
245{
246 return IDLAttribute<JSSVGAltGlyphElement>::get<jsSVGAltGlyphElementHrefGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "href");
247}
248
249void JSSVGAltGlyphElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
250{
251 auto* thisObject = jsCast<JSSVGAltGlyphElement*>(cell);
252 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
253 if (thisObject->scriptExecutionContext())
254 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
255 Base::heapSnapshot(cell, builder);
256}
257
258
259}
260
261#endif // ENABLE(SVG_FONTS)
262