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 "JSSVGFontFaceSrcElement.h"
26
27#include "JSDOMBinding.h"
28#include "JSDOMConstructorNotConstructable.h"
29#include "JSDOMExceptionHandling.h"
30#include "JSDOMWrapperCache.h"
31#include "ScriptExecutionContext.h"
32#include <JavaScriptCore/HeapSnapshotBuilder.h>
33#include <JavaScriptCore/JSCInlines.h>
34#include <wtf/GetPtr.h>
35#include <wtf/PointerPreparations.h>
36#include <wtf/URL.h>
37
38
39namespace WebCore {
40using namespace JSC;
41
42// Attributes
43
44JSC::EncodedJSValue jsSVGFontFaceSrcElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45bool setJSSVGFontFaceSrcElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46
47class JSSVGFontFaceSrcElementPrototype : public JSC::JSNonFinalObject {
48public:
49 using Base = JSC::JSNonFinalObject;
50 static JSSVGFontFaceSrcElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
51 {
52 JSSVGFontFaceSrcElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGFontFaceSrcElementPrototype>(vm.heap)) JSSVGFontFaceSrcElementPrototype(vm, globalObject, structure);
53 ptr->finishCreation(vm);
54 return ptr;
55 }
56
57 DECLARE_INFO;
58 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
59 {
60 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
61 }
62
63private:
64 JSSVGFontFaceSrcElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
65 : JSC::JSNonFinalObject(vm, structure)
66 {
67 }
68
69 void finishCreation(JSC::VM&);
70};
71
72using JSSVGFontFaceSrcElementConstructor = JSDOMConstructorNotConstructable<JSSVGFontFaceSrcElement>;
73
74template<> JSValue JSSVGFontFaceSrcElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
75{
76 return JSSVGElement::getConstructor(vm, &globalObject);
77}
78
79template<> void JSSVGFontFaceSrcElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
80{
81 putDirect(vm, vm.propertyNames->prototype, JSSVGFontFaceSrcElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
82 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGFontFaceSrcElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
83 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
84}
85
86template<> const ClassInfo JSSVGFontFaceSrcElementConstructor::s_info = { "SVGFontFaceSrcElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFontFaceSrcElementConstructor) };
87
88/* Hash table for prototype */
89
90static const HashTableValue JSSVGFontFaceSrcElementPrototypeTableValues[] =
91{
92 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGFontFaceSrcElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGFontFaceSrcElementConstructor) } },
93};
94
95const ClassInfo JSSVGFontFaceSrcElementPrototype::s_info = { "SVGFontFaceSrcElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFontFaceSrcElementPrototype) };
96
97void JSSVGFontFaceSrcElementPrototype::finishCreation(VM& vm)
98{
99 Base::finishCreation(vm);
100 reifyStaticProperties(vm, JSSVGFontFaceSrcElement::info(), JSSVGFontFaceSrcElementPrototypeTableValues, *this);
101}
102
103const ClassInfo JSSVGFontFaceSrcElement::s_info = { "SVGFontFaceSrcElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGFontFaceSrcElement) };
104
105JSSVGFontFaceSrcElement::JSSVGFontFaceSrcElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGFontFaceSrcElement>&& impl)
106 : JSSVGElement(structure, globalObject, WTFMove(impl))
107{
108}
109
110void JSSVGFontFaceSrcElement::finishCreation(VM& vm)
111{
112 Base::finishCreation(vm);
113 ASSERT(inherits(vm, info()));
114
115}
116
117JSObject* JSSVGFontFaceSrcElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
118{
119 return JSSVGFontFaceSrcElementPrototype::create(vm, &globalObject, JSSVGFontFaceSrcElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject)));
120}
121
122JSObject* JSSVGFontFaceSrcElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
123{
124 return getDOMPrototype<JSSVGFontFaceSrcElement>(vm, globalObject);
125}
126
127JSValue JSSVGFontFaceSrcElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
128{
129 return getDOMConstructor<JSSVGFontFaceSrcElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
130}
131
132EncodedJSValue jsSVGFontFaceSrcElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
133{
134 VM& vm = state->vm();
135 auto throwScope = DECLARE_THROW_SCOPE(vm);
136 auto* prototype = jsDynamicCast<JSSVGFontFaceSrcElementPrototype*>(vm, JSValue::decode(thisValue));
137 if (UNLIKELY(!prototype))
138 return throwVMTypeError(state, throwScope);
139 return JSValue::encode(JSSVGFontFaceSrcElement::getConstructor(state->vm(), prototype->globalObject()));
140}
141
142bool setJSSVGFontFaceSrcElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
143{
144 VM& vm = state->vm();
145 auto throwScope = DECLARE_THROW_SCOPE(vm);
146 auto* prototype = jsDynamicCast<JSSVGFontFaceSrcElementPrototype*>(vm, JSValue::decode(thisValue));
147 if (UNLIKELY(!prototype)) {
148 throwVMTypeError(state, throwScope);
149 return false;
150 }
151 // Shadowing a built-in constructor
152 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
153}
154
155void JSSVGFontFaceSrcElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
156{
157 auto* thisObject = jsCast<JSSVGFontFaceSrcElement*>(cell);
158 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
159 if (thisObject->scriptExecutionContext())
160 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
161 Base::heapSnapshot(cell, builder);
162}
163
164
165}
166
167#endif // ENABLE(SVG_FONTS)
168