tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSVGRect.cpp
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 "ExceptionCode.h"
28 #include "SVGRect.h"
29 #include <runtime/Error.h>
30 #include <wtf/GetPtr.h>
31
32 using namespace JSC;
33
34 namespace WebCore {
35
36 ASSERT_CLASS_FITS_IN_CELL(JSSVGRect);
37
38 /* Hash table */
39 #if ENABLE(JIT)
40 #define THUNK_GENERATOR(generator) , generator
41 #else
42 #define THUNK_GENERATOR(generator)
43 #endif
44 #if ENABLE(DFG_JIT)
45 #define INTRINSIC(intrinsic) , intrinsic
46 #else
47 #define INTRINSIC(intrinsic)
48 #endif
49
50 static const HashTableValue JSSVGRectTableValues[] =
51 {
52     { "x", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectX), (intptr_t)setJSSVGRectX THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "y", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectY), (intptr_t)setJSSVGRectY THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { "width", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectWidth), (intptr_t)setJSSVGRectWidth THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { "height", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectHeight), (intptr_t)setJSSVGRectHeight THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRectConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
58 };
59
60 #undef THUNK_GENERATOR
61 static const HashTable JSSVGRectTable = { 17, 15, JSSVGRectTableValues, 0 };
62 /* Hash table for constructor */
63 #if ENABLE(JIT)
64 #define THUNK_GENERATOR(generator) , generator
65 #else
66 #define THUNK_GENERATOR(generator)
67 #endif
68 #if ENABLE(DFG_JIT)
69 #define INTRINSIC(intrinsic) , intrinsic
70 #else
71 #define INTRINSIC(intrinsic)
72 #endif
73
74 static const HashTableValue JSSVGRectConstructorTableValues[] =
75 {
76     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
77 };
78
79 #undef THUNK_GENERATOR
80 static const HashTable JSSVGRectConstructorTable = { 1, 0, JSSVGRectConstructorTableValues, 0 };
81 const ClassInfo JSSVGRectConstructor::s_info = { "SVGRectConstructor", &DOMConstructorObject::s_info, &JSSVGRectConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGRectConstructor) };
82
83 JSSVGRectConstructor::JSSVGRectConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
84     : DOMConstructorObject(structure, globalObject)
85 {
86 }
87
88 void JSSVGRectConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
89 {
90     Base::finishCreation(exec->globalData());
91     ASSERT(inherits(&s_info));
92     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGRectPrototype::self(exec, globalObject), DontDelete | ReadOnly);
93 }
94
95 bool JSSVGRectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
96 {
97     return getStaticValueSlot<JSSVGRectConstructor, JSDOMWrapper>(exec, &JSSVGRectConstructorTable, static_cast<JSSVGRectConstructor*>(cell), propertyName, slot);
98 }
99
100 bool JSSVGRectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
101 {
102     return getStaticValueDescriptor<JSSVGRectConstructor, JSDOMWrapper>(exec, &JSSVGRectConstructorTable, static_cast<JSSVGRectConstructor*>(object), propertyName, descriptor);
103 }
104
105 /* Hash table for prototype */
106 #if ENABLE(JIT)
107 #define THUNK_GENERATOR(generator) , generator
108 #else
109 #define THUNK_GENERATOR(generator)
110 #endif
111 #if ENABLE(DFG_JIT)
112 #define INTRINSIC(intrinsic) , intrinsic
113 #else
114 #define INTRINSIC(intrinsic)
115 #endif
116
117 static const HashTableValue JSSVGRectPrototypeTableValues[] =
118 {
119     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
120 };
121
122 #undef THUNK_GENERATOR
123 static const HashTable JSSVGRectPrototypeTable = { 1, 0, JSSVGRectPrototypeTableValues, 0 };
124 const ClassInfo JSSVGRectPrototype::s_info = { "SVGRectPrototype", &JSC::JSNonFinalObject::s_info, &JSSVGRectPrototypeTable, 0, CREATE_METHOD_TABLE(JSSVGRectPrototype) };
125
126 JSObject* JSSVGRectPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
127 {
128     return getDOMPrototype<JSSVGRect>(exec, globalObject);
129 }
130
131 const ClassInfo JSSVGRect::s_info = { "SVGRect", &JSDOMWrapper::s_info, &JSSVGRectTable, 0 , CREATE_METHOD_TABLE(JSSVGRect) };
132
133 JSSVGRect::JSSVGRect(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGPropertyTearOff<FloatRect> > impl)
134     : JSDOMWrapper(structure, globalObject)
135     , m_impl(impl.leakRef())
136 {
137 }
138
139 void JSSVGRect::finishCreation(JSGlobalData& globalData)
140 {
141     Base::finishCreation(globalData);
142     ASSERT(inherits(&s_info));
143 }
144
145 JSObject* JSSVGRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
146 {
147     return JSSVGRectPrototype::create(exec->globalData(), globalObject, JSSVGRectPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
148 }
149
150 bool JSSVGRect::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
151 {
152     JSSVGRect* thisObject = jsCast<JSSVGRect*>(cell);
153     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
154     return getStaticValueSlot<JSSVGRect, Base>(exec, &JSSVGRectTable, thisObject, propertyName, slot);
155 }
156
157 bool JSSVGRect::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
158 {
159     JSSVGRect* thisObject = jsCast<JSSVGRect*>(object);
160     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
161     return getStaticValueDescriptor<JSSVGRect, Base>(exec, &JSSVGRectTable, thisObject, propertyName, descriptor);
162 }
163
164 JSValue jsSVGRectX(ExecState* exec, JSValue slotBase, const Identifier&)
165 {
166     JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase));
167     UNUSED_PARAM(exec);
168     FloatRect& imp = castedThis->impl()->propertyReference();
169     JSValue result =  jsNumber(imp.x());
170     return result;
171 }
172
173
174 JSValue jsSVGRectY(ExecState* exec, JSValue slotBase, const Identifier&)
175 {
176     JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase));
177     UNUSED_PARAM(exec);
178     FloatRect& imp = castedThis->impl()->propertyReference();
179     JSValue result =  jsNumber(imp.y());
180     return result;
181 }
182
183
184 JSValue jsSVGRectWidth(ExecState* exec, JSValue slotBase, const Identifier&)
185 {
186     JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase));
187     UNUSED_PARAM(exec);
188     FloatRect& imp = castedThis->impl()->propertyReference();
189     JSValue result =  jsNumber(imp.width());
190     return result;
191 }
192
193
194 JSValue jsSVGRectHeight(ExecState* exec, JSValue slotBase, const Identifier&)
195 {
196     JSSVGRect* castedThis = static_cast<JSSVGRect*>(asObject(slotBase));
197     UNUSED_PARAM(exec);
198     FloatRect& imp = castedThis->impl()->propertyReference();
199     JSValue result =  jsNumber(imp.height());
200     return result;
201 }
202
203
204 JSValue jsSVGRectConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
205 {
206     JSSVGRect* domObject = static_cast<JSSVGRect*>(asObject(slotBase));
207     return JSSVGRect::getConstructor(exec, domObject->globalObject());
208 }
209
210 void JSSVGRect::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
211 {
212     JSSVGRect* thisObject = jsCast<JSSVGRect*>(cell);
213     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
214     lookupPut<JSSVGRect, Base>(exec, propertyName, value, &JSSVGRectTable, thisObject, slot);
215 }
216
217 void setJSSVGRectX(ExecState* exec, JSObject* thisObject, JSValue value)
218 {
219     JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject);
220     SVGPropertyTearOff<FloatRect> * imp = static_cast<SVGPropertyTearOff<FloatRect> *>(castedThis->impl());
221     if (imp->role() == AnimValRole) {
222         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
223         return;
224     }
225     FloatRect& podImp = imp->propertyReference();
226     podImp.setX(value.toFloat(exec));
227     imp->commitChange();
228 }
229
230
231 void setJSSVGRectY(ExecState* exec, JSObject* thisObject, JSValue value)
232 {
233     JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject);
234     SVGPropertyTearOff<FloatRect> * imp = static_cast<SVGPropertyTearOff<FloatRect> *>(castedThis->impl());
235     if (imp->role() == AnimValRole) {
236         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
237         return;
238     }
239     FloatRect& podImp = imp->propertyReference();
240     podImp.setY(value.toFloat(exec));
241     imp->commitChange();
242 }
243
244
245 void setJSSVGRectWidth(ExecState* exec, JSObject* thisObject, JSValue value)
246 {
247     JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject);
248     SVGPropertyTearOff<FloatRect> * imp = static_cast<SVGPropertyTearOff<FloatRect> *>(castedThis->impl());
249     if (imp->role() == AnimValRole) {
250         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
251         return;
252     }
253     FloatRect& podImp = imp->propertyReference();
254     podImp.setWidth(value.toFloat(exec));
255     imp->commitChange();
256 }
257
258
259 void setJSSVGRectHeight(ExecState* exec, JSObject* thisObject, JSValue value)
260 {
261     JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject);
262     SVGPropertyTearOff<FloatRect> * imp = static_cast<SVGPropertyTearOff<FloatRect> *>(castedThis->impl());
263     if (imp->role() == AnimValRole) {
264         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
265         return;
266     }
267     FloatRect& podImp = imp->propertyReference();
268     podImp.setHeight(value.toFloat(exec));
269     imp->commitChange();
270 }
271
272
273 JSValue JSSVGRect::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
274 {
275     return getDOMConstructor<JSSVGRectConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
276 }
277
278 static inline bool isObservable(JSSVGRect* jsSVGRect)
279 {
280     if (jsSVGRect->hasCustomProperties())
281         return true;
282     return false;
283 }
284
285 bool JSSVGRectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
286 {
287     JSSVGRect* jsSVGRect = static_cast<JSSVGRect*>(handle.get().asCell());
288     if (!isObservable(jsSVGRect))
289         return false;
290     UNUSED_PARAM(visitor);
291     return false;
292 }
293
294 void JSSVGRectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
295 {
296     JSSVGRect* jsSVGRect = static_cast<JSSVGRect*>(handle.get().asCell());
297     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
298     uncacheWrapper(world, jsSVGRect->impl(), jsSVGRect);
299     jsSVGRect->releaseImpl();
300 }
301
302 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SVGPropertyTearOff<FloatRect> * impl)
303 {
304     return wrap<JSSVGRect, SVGPropertyTearOff<FloatRect> >(exec, globalObject, impl);
305 }
306
307 SVGPropertyTearOff<FloatRect> * toSVGRect(JSC::JSValue value)
308 {
309     return value.inherits(&JSSVGRect::s_info) ? static_cast<JSSVGRect*>(asObject(value))->impl() : 0;
310 }
311
312 }
313
314 #endif // ENABLE(SVG)