|
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) |
|
24 |
|
25 #include "JSSVGRect.h" |
|
26 |
|
27 #include <runtime/JSNumberCell.h> |
|
28 #include <wtf/GetPtr.h> |
|
29 |
|
30 using namespace JSC; |
|
31 |
|
32 namespace WebCore { |
|
33 |
|
34 ASSERT_CLASS_FITS_IN_CELL(JSSVGRect); |
|
35 |
|
36 /* Hash table */ |
|
37 #if ENABLE(JIT) |
|
38 #define THUNK_GENERATOR(generator) , generator |
|
39 #else |
|
40 #define THUNK_GENERATOR(generator) |
|
41 #endif |
|
42 |
|
43 static const HashTableValue JSSVGRectTableValues[6] = |
|
44 { |
|
45 { "x", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectX), (intptr_t)setJSSVGRectX THUNK_GENERATOR(0) }, |
|
46 { "y", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectY), (intptr_t)setJSSVGRectY THUNK_GENERATOR(0) }, |
|
47 { "width", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectWidth), (intptr_t)setJSSVGRectWidth THUNK_GENERATOR(0) }, |
|
48 { "height", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectHeight), (intptr_t)setJSSVGRectHeight THUNK_GENERATOR(0) }, |
|
49 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
51 }; |
|
52 |
|
53 #undef THUNK_GENERATOR |
|
54 static JSC_CONST_HASHTABLE HashTable JSSVGRectTable = { 17, 15, JSSVGRectTableValues, 0 }; |
|
55 /* Hash table for constructor */ |
|
56 #if ENABLE(JIT) |
|
57 #define THUNK_GENERATOR(generator) , generator |
|
58 #else |
|
59 #define THUNK_GENERATOR(generator) |
|
60 #endif |
|
61 |
|
62 static const HashTableValue JSSVGRectConstructorTableValues[1] = |
|
63 { |
|
64 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
65 }; |
|
66 |
|
67 #undef THUNK_GENERATOR |
|
68 static JSC_CONST_HASHTABLE HashTable JSSVGRectConstructorTable = { 1, 0, JSSVGRectConstructorTableValues, 0 }; |
|
69 class JSSVGRectConstructor : public DOMConstructorObject { |
|
70 public: |
|
71 JSSVGRectConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
72 |
|
73 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
74 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
75 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
76 static const JSC::ClassInfo s_info; |
|
77 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
78 { |
|
79 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
80 } |
|
81 protected: |
|
82 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
83 }; |
|
84 |
|
85 const ClassInfo JSSVGRectConstructor::s_info = { "SVGRectConstructor", 0, &JSSVGRectConstructorTable, 0 }; |
|
86 |
|
87 JSSVGRectConstructor::JSSVGRectConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
88 : DOMConstructorObject(JSSVGRectConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
89 { |
|
90 putDirect(exec->propertyNames().prototype, JSSVGRectPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
91 } |
|
92 |
|
93 bool JSSVGRectConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
94 { |
|
95 return getStaticValueSlot<JSSVGRectConstructor, DOMObject>(exec, &JSSVGRectConstructorTable, this, propertyName, slot); |
|
96 } |
|
97 |
|
98 bool JSSVGRectConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
99 { |
|
100 return getStaticValueDescriptor<JSSVGRectConstructor, DOMObject>(exec, &JSSVGRectConstructorTable, this, propertyName, descriptor); |
|
101 } |
|
102 |
|
103 /* Hash table for prototype */ |
|
104 #if ENABLE(JIT) |
|
105 #define THUNK_GENERATOR(generator) , generator |
|
106 #else |
|
107 #define THUNK_GENERATOR(generator) |
|
108 #endif |
|
109 |
|
110 static const HashTableValue JSSVGRectPrototypeTableValues[1] = |
|
111 { |
|
112 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
113 }; |
|
114 |
|
115 #undef THUNK_GENERATOR |
|
116 static JSC_CONST_HASHTABLE HashTable JSSVGRectPrototypeTable = { 1, 0, JSSVGRectPrototypeTableValues, 0 }; |
|
117 const ClassInfo JSSVGRectPrototype::s_info = { "SVGRectPrototype", 0, &JSSVGRectPrototypeTable, 0 }; |
|
118 |
|
119 JSObject* JSSVGRectPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
120 { |
|
121 return getDOMPrototype<JSSVGRect>(exec, globalObject); |
|
122 } |
|
123 |
|
124 const ClassInfo JSSVGRect::s_info = { "SVGRect", 0, &JSSVGRectTable, 0 }; |
|
125 |
|
126 JSSVGRect::JSSVGRect(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<JSSVGPODTypeWrapper<FloatRect> > impl) |
|
127 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
128 , m_impl(impl) |
|
129 { |
|
130 } |
|
131 |
|
132 JSSVGRect::~JSSVGRect() |
|
133 { |
|
134 forgetDOMObject(this, impl()); |
|
135 JSSVGContextCache::forgetWrapper(this); |
|
136 } |
|
137 |
|
138 JSObject* JSSVGRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
139 { |
|
140 return new (exec) JSSVGRectPrototype(globalObject, JSSVGRectPrototype::createStructure(globalObject->objectPrototype())); |
|
141 } |
|
142 |
|
143 bool JSSVGRect::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
144 { |
|
145 return getStaticValueSlot<JSSVGRect, Base>(exec, &JSSVGRectTable, this, propertyName, slot); |
|
146 } |
|
147 |
|
148 bool JSSVGRect::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
149 { |
|
150 return getStaticValueDescriptor<JSSVGRect, Base>(exec, &JSSVGRectTable, this, propertyName, descriptor); |
|
151 } |
|
152 |
|
153 JSValue jsSVGRectX(ExecState* exec, JSValue slotBase, const Identifier&) |
|
154 { |
|
155 JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase)); |
|
156 UNUSED_PARAM(exec); |
|
157 FloatRect imp(*castedThis->impl()); |
|
158 JSValue result = jsNumber(exec, imp.x()); |
|
159 return result; |
|
160 } |
|
161 |
|
162 JSValue jsSVGRectY(ExecState* exec, JSValue slotBase, const Identifier&) |
|
163 { |
|
164 JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase)); |
|
165 UNUSED_PARAM(exec); |
|
166 FloatRect imp(*castedThis->impl()); |
|
167 JSValue result = jsNumber(exec, imp.y()); |
|
168 return result; |
|
169 } |
|
170 |
|
171 JSValue jsSVGRectWidth(ExecState* exec, JSValue slotBase, const Identifier&) |
|
172 { |
|
173 JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase)); |
|
174 UNUSED_PARAM(exec); |
|
175 FloatRect imp(*castedThis->impl()); |
|
176 JSValue result = jsNumber(exec, imp.width()); |
|
177 return result; |
|
178 } |
|
179 |
|
180 JSValue jsSVGRectHeight(ExecState* exec, JSValue slotBase, const Identifier&) |
|
181 { |
|
182 JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase)); |
|
183 UNUSED_PARAM(exec); |
|
184 FloatRect imp(*castedThis->impl()); |
|
185 JSValue result = jsNumber(exec, imp.height()); |
|
186 return result; |
|
187 } |
|
188 |
|
189 JSValue jsSVGRectConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
190 { |
|
191 JSSVGRect* domObject = static_cast<JSSVGRect*>(asObject(slotBase)); |
|
192 return JSSVGRect::getConstructor(exec, domObject->globalObject()); |
|
193 } |
|
194 void JSSVGRect::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
195 { |
|
196 lookupPut<JSSVGRect, Base>(exec, propertyName, value, &JSSVGRectTable, this, slot); |
|
197 } |
|
198 |
|
199 void setJSSVGRectX(ExecState* exec, JSObject* thisObject, JSValue value) |
|
200 { |
|
201 JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject); |
|
202 JSSVGPODTypeWrapper<FloatRect> * imp = static_cast<JSSVGPODTypeWrapper<FloatRect> *>(castedThis->impl()); |
|
203 FloatRect podImp(*imp); |
|
204 podImp.setX(value.toFloat(exec)); |
|
205 imp->commitChange(podImp, castedThis); |
|
206 } |
|
207 |
|
208 void setJSSVGRectY(ExecState* exec, JSObject* thisObject, JSValue value) |
|
209 { |
|
210 JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject); |
|
211 JSSVGPODTypeWrapper<FloatRect> * imp = static_cast<JSSVGPODTypeWrapper<FloatRect> *>(castedThis->impl()); |
|
212 FloatRect podImp(*imp); |
|
213 podImp.setY(value.toFloat(exec)); |
|
214 imp->commitChange(podImp, castedThis); |
|
215 } |
|
216 |
|
217 void setJSSVGRectWidth(ExecState* exec, JSObject* thisObject, JSValue value) |
|
218 { |
|
219 JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject); |
|
220 JSSVGPODTypeWrapper<FloatRect> * imp = static_cast<JSSVGPODTypeWrapper<FloatRect> *>(castedThis->impl()); |
|
221 FloatRect podImp(*imp); |
|
222 podImp.setWidth(value.toFloat(exec)); |
|
223 imp->commitChange(podImp, castedThis); |
|
224 } |
|
225 |
|
226 void setJSSVGRectHeight(ExecState* exec, JSObject* thisObject, JSValue value) |
|
227 { |
|
228 JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject); |
|
229 JSSVGPODTypeWrapper<FloatRect> * imp = static_cast<JSSVGPODTypeWrapper<FloatRect> *>(castedThis->impl()); |
|
230 FloatRect podImp(*imp); |
|
231 podImp.setHeight(value.toFloat(exec)); |
|
232 imp->commitChange(podImp, castedThis); |
|
233 } |
|
234 |
|
235 JSValue JSSVGRect::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
236 { |
|
237 return getDOMConstructor<JSSVGRectConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
238 } |
|
239 |
|
240 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JSSVGPODTypeWrapper<FloatRect>* object, SVGElement* context) |
|
241 { |
|
242 return getDOMObjectWrapper<JSSVGRect, JSSVGPODTypeWrapper<FloatRect> >(exec, globalObject, object, context); |
|
243 } |
|
244 FloatRect toSVGRect(JSC::JSValue value) |
|
245 { |
|
246 return value.inherits(&JSSVGRect::s_info) ? (FloatRect) *static_cast<JSSVGRect*>(asObject(value))->impl() : FloatRect(); |
|
247 } |
|
248 |
|
249 } |
|
250 |
|
251 #endif // ENABLE(SVG) |