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 "JSSVGStopElement.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 "JSSVGAnimatedNumber.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 jsSVGStopElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSSVGStopElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | JSC::EncodedJSValue jsSVGStopElementOffset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | |
49 | class JSSVGStopElementPrototype : public JSC::JSNonFinalObject { |
50 | public: |
51 | using Base = JSC::JSNonFinalObject; |
52 | static JSSVGStopElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
53 | { |
54 | JSSVGStopElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGStopElementPrototype>(vm.heap)) JSSVGStopElementPrototype(vm, globalObject, structure); |
55 | ptr->finishCreation(vm); |
56 | return ptr; |
57 | } |
58 | |
59 | DECLARE_INFO; |
60 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
61 | { |
62 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
63 | } |
64 | |
65 | private: |
66 | JSSVGStopElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
67 | : JSC::JSNonFinalObject(vm, structure) |
68 | { |
69 | } |
70 | |
71 | void finishCreation(JSC::VM&); |
72 | }; |
73 | |
74 | using JSSVGStopElementConstructor = JSDOMConstructorNotConstructable<JSSVGStopElement>; |
75 | |
76 | template<> JSValue JSSVGStopElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
77 | { |
78 | return JSSVGElement::getConstructor(vm, &globalObject); |
79 | } |
80 | |
81 | template<> void JSSVGStopElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
82 | { |
83 | putDirect(vm, vm.propertyNames->prototype, JSSVGStopElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
84 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGStopElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
85 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
86 | } |
87 | |
88 | template<> const ClassInfo JSSVGStopElementConstructor::s_info = { "SVGStopElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStopElementConstructor) }; |
89 | |
90 | /* Hash table for prototype */ |
91 | |
92 | static const HashTableValue JSSVGStopElementPrototypeTableValues[] = |
93 | { |
94 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStopElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGStopElementConstructor) } }, |
95 | { "offset" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGStopElementOffset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
96 | }; |
97 | |
98 | const ClassInfo JSSVGStopElementPrototype::s_info = { "SVGStopElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStopElementPrototype) }; |
99 | |
100 | void JSSVGStopElementPrototype::finishCreation(VM& vm) |
101 | { |
102 | Base::finishCreation(vm); |
103 | reifyStaticProperties(vm, JSSVGStopElement::info(), JSSVGStopElementPrototypeTableValues, *this); |
104 | } |
105 | |
106 | const ClassInfo JSSVGStopElement::s_info = { "SVGStopElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGStopElement) }; |
107 | |
108 | JSSVGStopElement::JSSVGStopElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGStopElement>&& impl) |
109 | : JSSVGElement(structure, globalObject, WTFMove(impl)) |
110 | { |
111 | } |
112 | |
113 | void JSSVGStopElement::finishCreation(VM& vm) |
114 | { |
115 | Base::finishCreation(vm); |
116 | ASSERT(inherits(vm, info())); |
117 | |
118 | } |
119 | |
120 | JSObject* JSSVGStopElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
121 | { |
122 | return JSSVGStopElementPrototype::create(vm, &globalObject, JSSVGStopElementPrototype::createStructure(vm, &globalObject, JSSVGElement::prototype(vm, globalObject))); |
123 | } |
124 | |
125 | JSObject* JSSVGStopElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
126 | { |
127 | return getDOMPrototype<JSSVGStopElement>(vm, globalObject); |
128 | } |
129 | |
130 | JSValue JSSVGStopElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
131 | { |
132 | return getDOMConstructor<JSSVGStopElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
133 | } |
134 | |
135 | template<> inline JSSVGStopElement* IDLAttribute<JSSVGStopElement>::cast(ExecState& state, EncodedJSValue thisValue) |
136 | { |
137 | return jsDynamicCast<JSSVGStopElement*>(state.vm(), JSValue::decode(thisValue)); |
138 | } |
139 | |
140 | EncodedJSValue jsSVGStopElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
141 | { |
142 | VM& vm = state->vm(); |
143 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
144 | auto* prototype = jsDynamicCast<JSSVGStopElementPrototype*>(vm, JSValue::decode(thisValue)); |
145 | if (UNLIKELY(!prototype)) |
146 | return throwVMTypeError(state, throwScope); |
147 | return JSValue::encode(JSSVGStopElement::getConstructor(state->vm(), prototype->globalObject())); |
148 | } |
149 | |
150 | bool setJSSVGStopElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSSVGStopElementPrototype*>(vm, JSValue::decode(thisValue)); |
155 | if (UNLIKELY(!prototype)) { |
156 | throwVMTypeError(state, throwScope); |
157 | return false; |
158 | } |
159 | // Shadowing a built-in constructor |
160 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
161 | } |
162 | |
163 | static inline JSValue jsSVGStopElementOffsetGetter(ExecState& state, JSSVGStopElement& thisObject, ThrowScope& throwScope) |
164 | { |
165 | UNUSED_PARAM(throwScope); |
166 | UNUSED_PARAM(state); |
167 | auto& impl = thisObject.wrapped(); |
168 | JSValue result = toJS<IDLInterface<SVGAnimatedNumber>>(state, *thisObject.globalObject(), throwScope, impl.offsetAnimated()); |
169 | return result; |
170 | } |
171 | |
172 | EncodedJSValue jsSVGStopElementOffset(ExecState* state, EncodedJSValue thisValue, PropertyName) |
173 | { |
174 | return IDLAttribute<JSSVGStopElement>::get<jsSVGStopElementOffsetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "offset" ); |
175 | } |
176 | |
177 | void JSSVGStopElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
178 | { |
179 | auto* thisObject = jsCast<JSSVGStopElement*>(cell); |
180 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
181 | if (thisObject->scriptExecutionContext()) |
182 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
183 | Base::heapSnapshot(cell, builder); |
184 | } |
185 | |
186 | |
187 | } |
188 | |