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 "JSSVGLinearGradientElement.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 "JSSVGAnimatedLength.h" |
32 | #include "ScriptExecutionContext.h" |
33 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
34 | #include <JavaScriptCore/JSCInlines.h> |
35 | #include <wtf/GetPtr.h> |
36 | #include <wtf/PointerPreparations.h> |
37 | #include <wtf/URL.h> |
38 | |
39 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Attributes |
44 | |
45 | JSC::EncodedJSValue jsSVGLinearGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSSVGLinearGradientElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | JSC::EncodedJSValue jsSVGLinearGradientElementX1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | JSC::EncodedJSValue jsSVGLinearGradientElementY1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | JSC::EncodedJSValue jsSVGLinearGradientElementX2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | JSC::EncodedJSValue jsSVGLinearGradientElementY2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | |
52 | class JSSVGLinearGradientElementPrototype : public JSC::JSNonFinalObject { |
53 | public: |
54 | using Base = JSC::JSNonFinalObject; |
55 | static JSSVGLinearGradientElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
56 | { |
57 | JSSVGLinearGradientElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGLinearGradientElementPrototype>(vm.heap)) JSSVGLinearGradientElementPrototype(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 | |
68 | private: |
69 | JSSVGLinearGradientElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
70 | : JSC::JSNonFinalObject(vm, structure) |
71 | { |
72 | } |
73 | |
74 | void finishCreation(JSC::VM&); |
75 | }; |
76 | |
77 | using JSSVGLinearGradientElementConstructor = JSDOMConstructorNotConstructable<JSSVGLinearGradientElement>; |
78 | |
79 | template<> JSValue JSSVGLinearGradientElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
80 | { |
81 | return JSSVGGradientElement::getConstructor(vm, &globalObject); |
82 | } |
83 | |
84 | template<> void JSSVGLinearGradientElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
85 | { |
86 | putDirect(vm, vm.propertyNames->prototype, JSSVGLinearGradientElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
87 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGLinearGradientElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
88 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | } |
90 | |
91 | template<> const ClassInfo JSSVGLinearGradientElementConstructor::s_info = { "SVGLinearGradientElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElementConstructor) }; |
92 | |
93 | /* Hash table for prototype */ |
94 | |
95 | static const HashTableValue JSSVGLinearGradientElementPrototypeTableValues[] = |
96 | { |
97 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGLinearGradientElementConstructor) } }, |
98 | { "x1" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementX1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
99 | { "y1" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementY1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
100 | { "x2" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementX2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
101 | { "y2" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLinearGradientElementY2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
102 | }; |
103 | |
104 | const ClassInfo JSSVGLinearGradientElementPrototype::s_info = { "SVGLinearGradientElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElementPrototype) }; |
105 | |
106 | void JSSVGLinearGradientElementPrototype::finishCreation(VM& vm) |
107 | { |
108 | Base::finishCreation(vm); |
109 | reifyStaticProperties(vm, JSSVGLinearGradientElement::info(), JSSVGLinearGradientElementPrototypeTableValues, *this); |
110 | } |
111 | |
112 | const ClassInfo JSSVGLinearGradientElement::s_info = { "SVGLinearGradientElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGLinearGradientElement) }; |
113 | |
114 | JSSVGLinearGradientElement::JSSVGLinearGradientElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGLinearGradientElement>&& impl) |
115 | : JSSVGGradientElement(structure, globalObject, WTFMove(impl)) |
116 | { |
117 | } |
118 | |
119 | void JSSVGLinearGradientElement::finishCreation(VM& vm) |
120 | { |
121 | Base::finishCreation(vm); |
122 | ASSERT(inherits(vm, info())); |
123 | |
124 | } |
125 | |
126 | JSObject* JSSVGLinearGradientElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
127 | { |
128 | return JSSVGLinearGradientElementPrototype::create(vm, &globalObject, JSSVGLinearGradientElementPrototype::createStructure(vm, &globalObject, JSSVGGradientElement::prototype(vm, globalObject))); |
129 | } |
130 | |
131 | JSObject* JSSVGLinearGradientElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
132 | { |
133 | return getDOMPrototype<JSSVGLinearGradientElement>(vm, globalObject); |
134 | } |
135 | |
136 | JSValue JSSVGLinearGradientElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
137 | { |
138 | return getDOMConstructor<JSSVGLinearGradientElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
139 | } |
140 | |
141 | template<> inline JSSVGLinearGradientElement* IDLAttribute<JSSVGLinearGradientElement>::cast(ExecState& state, EncodedJSValue thisValue) |
142 | { |
143 | return jsDynamicCast<JSSVGLinearGradientElement*>(state.vm(), JSValue::decode(thisValue)); |
144 | } |
145 | |
146 | EncodedJSValue jsSVGLinearGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
147 | { |
148 | VM& vm = state->vm(); |
149 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
150 | auto* prototype = jsDynamicCast<JSSVGLinearGradientElementPrototype*>(vm, JSValue::decode(thisValue)); |
151 | if (UNLIKELY(!prototype)) |
152 | return throwVMTypeError(state, throwScope); |
153 | return JSValue::encode(JSSVGLinearGradientElement::getConstructor(state->vm(), prototype->globalObject())); |
154 | } |
155 | |
156 | bool setJSSVGLinearGradientElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
157 | { |
158 | VM& vm = state->vm(); |
159 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
160 | auto* prototype = jsDynamicCast<JSSVGLinearGradientElementPrototype*>(vm, JSValue::decode(thisValue)); |
161 | if (UNLIKELY(!prototype)) { |
162 | throwVMTypeError(state, throwScope); |
163 | return false; |
164 | } |
165 | // Shadowing a built-in constructor |
166 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
167 | } |
168 | |
169 | static inline JSValue jsSVGLinearGradientElementX1Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope) |
170 | { |
171 | UNUSED_PARAM(throwScope); |
172 | UNUSED_PARAM(state); |
173 | auto& impl = thisObject.wrapped(); |
174 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.x1Animated()); |
175 | return result; |
176 | } |
177 | |
178 | EncodedJSValue jsSVGLinearGradientElementX1(ExecState* state, EncodedJSValue thisValue, PropertyName) |
179 | { |
180 | return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementX1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x1" ); |
181 | } |
182 | |
183 | static inline JSValue jsSVGLinearGradientElementY1Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope) |
184 | { |
185 | UNUSED_PARAM(throwScope); |
186 | UNUSED_PARAM(state); |
187 | auto& impl = thisObject.wrapped(); |
188 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y1Animated()); |
189 | return result; |
190 | } |
191 | |
192 | EncodedJSValue jsSVGLinearGradientElementY1(ExecState* state, EncodedJSValue thisValue, PropertyName) |
193 | { |
194 | return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementY1Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y1" ); |
195 | } |
196 | |
197 | static inline JSValue jsSVGLinearGradientElementX2Getter(ExecState& state, JSSVGLinearGradientElement& 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.x2Animated()); |
203 | return result; |
204 | } |
205 | |
206 | EncodedJSValue jsSVGLinearGradientElementX2(ExecState* state, EncodedJSValue thisValue, PropertyName) |
207 | { |
208 | return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementX2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x2" ); |
209 | } |
210 | |
211 | static inline JSValue jsSVGLinearGradientElementY2Getter(ExecState& state, JSSVGLinearGradientElement& thisObject, ThrowScope& throwScope) |
212 | { |
213 | UNUSED_PARAM(throwScope); |
214 | UNUSED_PARAM(state); |
215 | auto& impl = thisObject.wrapped(); |
216 | JSValue result = toJS<IDLInterface<SVGAnimatedLength>>(state, *thisObject.globalObject(), throwScope, impl.y2Animated()); |
217 | return result; |
218 | } |
219 | |
220 | EncodedJSValue jsSVGLinearGradientElementY2(ExecState* state, EncodedJSValue thisValue, PropertyName) |
221 | { |
222 | return IDLAttribute<JSSVGLinearGradientElement>::get<jsSVGLinearGradientElementY2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y2" ); |
223 | } |
224 | |
225 | void JSSVGLinearGradientElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
226 | { |
227 | auto* thisObject = jsCast<JSSVGLinearGradientElement*>(cell); |
228 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
229 | if (thisObject->scriptExecutionContext()) |
230 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
231 | Base::heapSnapshot(cell, builder); |
232 | } |
233 | |
234 | |
235 | } |
236 | |