tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSRect.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 #include "JSRect.h"
23
24 #include "CSSPrimitiveValue.h"
25 #include "JSCSSPrimitiveValue.h"
26 #include "Rect.h"
27 #include <wtf/GetPtr.h>
28
29 using namespace JSC;
30
31 namespace WebCore {
32
33 ASSERT_CLASS_FITS_IN_CELL(JSRect);
34
35 /* Hash table */
36 #if ENABLE(JIT)
37 #define THUNK_GENERATOR(generator) , generator
38 #else
39 #define THUNK_GENERATOR(generator)
40 #endif
41 #if ENABLE(DFG_JIT)
42 #define INTRINSIC(intrinsic) , intrinsic
43 #else
44 #define INTRINSIC(intrinsic)
45 #endif
46
47 static const HashTableValue JSRectTableValues[] =
48 {
49     { "top", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRectTop), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
50     { "right", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRectRight), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51     { "bottom", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRectBottom), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
52     { "left", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRectLeft), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRectConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
55 };
56
57 #undef THUNK_GENERATOR
58 static const HashTable JSRectTable = { 16, 15, JSRectTableValues, 0 };
59 /* Hash table for constructor */
60 #if ENABLE(JIT)
61 #define THUNK_GENERATOR(generator) , generator
62 #else
63 #define THUNK_GENERATOR(generator)
64 #endif
65 #if ENABLE(DFG_JIT)
66 #define INTRINSIC(intrinsic) , intrinsic
67 #else
68 #define INTRINSIC(intrinsic)
69 #endif
70
71 static const HashTableValue JSRectConstructorTableValues[] =
72 {
73     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
74 };
75
76 #undef THUNK_GENERATOR
77 static const HashTable JSRectConstructorTable = { 1, 0, JSRectConstructorTableValues, 0 };
78 const ClassInfo JSRectConstructor::s_info = { "RectConstructor", &DOMConstructorObject::s_info, &JSRectConstructorTable, 0, CREATE_METHOD_TABLE(JSRectConstructor) };
79
80 JSRectConstructor::JSRectConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
81     : DOMConstructorObject(structure, globalObject)
82 {
83 }
84
85 void JSRectConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
86 {
87     Base::finishCreation(exec->globalData());
88     ASSERT(inherits(&s_info));
89     putDirect(exec->globalData(), exec->propertyNames().prototype, JSRectPrototype::self(exec, globalObject), DontDelete | ReadOnly);
90 }
91
92 bool JSRectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
93 {
94     return getStaticValueSlot<JSRectConstructor, JSDOMWrapper>(exec, &JSRectConstructorTable, static_cast<JSRectConstructor*>(cell), propertyName, slot);
95 }
96
97 bool JSRectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
98 {
99     return getStaticValueDescriptor<JSRectConstructor, JSDOMWrapper>(exec, &JSRectConstructorTable, static_cast<JSRectConstructor*>(object), propertyName, descriptor);
100 }
101
102 /* Hash table for prototype */
103 #if ENABLE(JIT)
104 #define THUNK_GENERATOR(generator) , generator
105 #else
106 #define THUNK_GENERATOR(generator)
107 #endif
108 #if ENABLE(DFG_JIT)
109 #define INTRINSIC(intrinsic) , intrinsic
110 #else
111 #define INTRINSIC(intrinsic)
112 #endif
113
114 static const HashTableValue JSRectPrototypeTableValues[] =
115 {
116     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
117 };
118
119 #undef THUNK_GENERATOR
120 static const HashTable JSRectPrototypeTable = { 1, 0, JSRectPrototypeTableValues, 0 };
121 const ClassInfo JSRectPrototype::s_info = { "RectPrototype", &JSC::JSNonFinalObject::s_info, &JSRectPrototypeTable, 0, CREATE_METHOD_TABLE(JSRectPrototype) };
122
123 JSObject* JSRectPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
124 {
125     return getDOMPrototype<JSRect>(exec, globalObject);
126 }
127
128 const ClassInfo JSRect::s_info = { "Rect", &JSDOMWrapper::s_info, &JSRectTable, 0 , CREATE_METHOD_TABLE(JSRect) };
129
130 JSRect::JSRect(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Rect> impl)
131     : JSDOMWrapper(structure, globalObject)
132     , m_impl(impl.leakRef())
133 {
134 }
135
136 void JSRect::finishCreation(JSGlobalData& globalData)
137 {
138     Base::finishCreation(globalData);
139     ASSERT(inherits(&s_info));
140 }
141
142 JSObject* JSRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
143 {
144     return JSRectPrototype::create(exec->globalData(), globalObject, JSRectPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
145 }
146
147 bool JSRect::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
148 {
149     JSRect* thisObject = jsCast<JSRect*>(cell);
150     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
151     return getStaticValueSlot<JSRect, Base>(exec, &JSRectTable, thisObject, propertyName, slot);
152 }
153
154 bool JSRect::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
155 {
156     JSRect* thisObject = jsCast<JSRect*>(object);
157     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
158     return getStaticValueDescriptor<JSRect, Base>(exec, &JSRectTable, thisObject, propertyName, descriptor);
159 }
160
161 JSValue jsRectTop(ExecState* exec, JSValue slotBase, const Identifier&)
162 {
163     JSRect* castedThis = static_cast<JSRect*>(asObject(slotBase));
164     UNUSED_PARAM(exec);
165     Rect* imp = static_cast<Rect*>(castedThis->impl());
166     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->top()));
167     return result;
168 }
169
170
171 JSValue jsRectRight(ExecState* exec, JSValue slotBase, const Identifier&)
172 {
173     JSRect* castedThis = static_cast<JSRect*>(asObject(slotBase));
174     UNUSED_PARAM(exec);
175     Rect* imp = static_cast<Rect*>(castedThis->impl());
176     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->right()));
177     return result;
178 }
179
180
181 JSValue jsRectBottom(ExecState* exec, JSValue slotBase, const Identifier&)
182 {
183     JSRect* castedThis = static_cast<JSRect*>(asObject(slotBase));
184     UNUSED_PARAM(exec);
185     Rect* imp = static_cast<Rect*>(castedThis->impl());
186     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->bottom()));
187     return result;
188 }
189
190
191 JSValue jsRectLeft(ExecState* exec, JSValue slotBase, const Identifier&)
192 {
193     JSRect* castedThis = static_cast<JSRect*>(asObject(slotBase));
194     UNUSED_PARAM(exec);
195     Rect* imp = static_cast<Rect*>(castedThis->impl());
196     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->left()));
197     return result;
198 }
199
200
201 JSValue jsRectConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
202 {
203     JSRect* domObject = static_cast<JSRect*>(asObject(slotBase));
204     return JSRect::getConstructor(exec, domObject->globalObject());
205 }
206
207 JSValue JSRect::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
208 {
209     return getDOMConstructor<JSRectConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
210 }
211
212 static inline bool isObservable(JSRect* jsRect)
213 {
214     if (jsRect->hasCustomProperties())
215         return true;
216     return false;
217 }
218
219 bool JSRectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
220 {
221     JSRect* jsRect = static_cast<JSRect*>(handle.get().asCell());
222     if (!isObservable(jsRect))
223         return false;
224     UNUSED_PARAM(visitor);
225     return false;
226 }
227
228 void JSRectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
229 {
230     JSRect* jsRect = static_cast<JSRect*>(handle.get().asCell());
231     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
232     uncacheWrapper(world, jsRect->impl(), jsRect);
233     jsRect->releaseImpl();
234 }
235
236 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Rect* impl)
237 {
238     return wrap<JSRect>(exec, globalObject, impl);
239 }
240
241 Rect* toRect(JSC::JSValue value)
242 {
243     return value.inherits(&JSRect::s_info) ? static_cast<JSRect*>(asObject(value))->impl() : 0;
244 }
245
246 }