tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSTouch.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(TOUCH_EVENTS)
24
25 #include "JSTouch.h"
26
27 #include "EventTarget.h"
28 #include "JSEventTarget.h"
29 #include "Touch.h"
30 #include <wtf/GetPtr.h>
31
32 using namespace JSC;
33
34 namespace WebCore {
35
36 ASSERT_CLASS_FITS_IN_CELL(JSTouch);
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 JSTouchTableValues[] =
51 {
52     { "clientX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchClientX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "clientY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchClientY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { "screenX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchScreenX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { "screenY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchScreenY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "pageX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchPageX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "pageY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchPageY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { "target", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchTarget), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59     { "identifier", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchIdentifier), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60     { "webkitRadiusX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRadiusX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61     { "webkitRadiusY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRadiusY), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
62     { "webkitRotationAngle", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitRotationAngle), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
63     { "webkitForce", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchWebkitForce), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
64     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
65     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
66 };
67
68 #undef THUNK_GENERATOR
69 static const HashTable JSTouchTable = { 33, 31, JSTouchTableValues, 0 };
70 /* Hash table for constructor */
71 #if ENABLE(JIT)
72 #define THUNK_GENERATOR(generator) , generator
73 #else
74 #define THUNK_GENERATOR(generator)
75 #endif
76 #if ENABLE(DFG_JIT)
77 #define INTRINSIC(intrinsic) , intrinsic
78 #else
79 #define INTRINSIC(intrinsic)
80 #endif
81
82 static const HashTableValue JSTouchConstructorTableValues[] =
83 {
84     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
85 };
86
87 #undef THUNK_GENERATOR
88 static const HashTable JSTouchConstructorTable = { 1, 0, JSTouchConstructorTableValues, 0 };
89 const ClassInfo JSTouchConstructor::s_info = { "TouchConstructor", &DOMConstructorObject::s_info, &JSTouchConstructorTable, 0, CREATE_METHOD_TABLE(JSTouchConstructor) };
90
91 JSTouchConstructor::JSTouchConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
92     : DOMConstructorObject(structure, globalObject)
93 {
94 }
95
96 void JSTouchConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
97 {
98     Base::finishCreation(exec->globalData());
99     ASSERT(inherits(&s_info));
100     putDirect(exec->globalData(), exec->propertyNames().prototype, JSTouchPrototype::self(exec, globalObject), DontDelete | ReadOnly);
101 }
102
103 bool JSTouchConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
104 {
105     return getStaticValueSlot<JSTouchConstructor, JSDOMWrapper>(exec, &JSTouchConstructorTable, static_cast<JSTouchConstructor*>(cell), propertyName, slot);
106 }
107
108 bool JSTouchConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
109 {
110     return getStaticValueDescriptor<JSTouchConstructor, JSDOMWrapper>(exec, &JSTouchConstructorTable, static_cast<JSTouchConstructor*>(object), propertyName, descriptor);
111 }
112
113 /* Hash table for prototype */
114 #if ENABLE(JIT)
115 #define THUNK_GENERATOR(generator) , generator
116 #else
117 #define THUNK_GENERATOR(generator)
118 #endif
119 #if ENABLE(DFG_JIT)
120 #define INTRINSIC(intrinsic) , intrinsic
121 #else
122 #define INTRINSIC(intrinsic)
123 #endif
124
125 static const HashTableValue JSTouchPrototypeTableValues[] =
126 {
127     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
128 };
129
130 #undef THUNK_GENERATOR
131 static const HashTable JSTouchPrototypeTable = { 1, 0, JSTouchPrototypeTableValues, 0 };
132 const ClassInfo JSTouchPrototype::s_info = { "TouchPrototype", &JSC::JSNonFinalObject::s_info, &JSTouchPrototypeTable, 0, CREATE_METHOD_TABLE(JSTouchPrototype) };
133
134 JSObject* JSTouchPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
135 {
136     return getDOMPrototype<JSTouch>(exec, globalObject);
137 }
138
139 const ClassInfo JSTouch::s_info = { "Touch", &JSDOMWrapper::s_info, &JSTouchTable, 0 , CREATE_METHOD_TABLE(JSTouch) };
140
141 JSTouch::JSTouch(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Touch> impl)
142     : JSDOMWrapper(structure, globalObject)
143     , m_impl(impl.leakRef())
144 {
145 }
146
147 void JSTouch::finishCreation(JSGlobalData& globalData)
148 {
149     Base::finishCreation(globalData);
150     ASSERT(inherits(&s_info));
151 }
152
153 JSObject* JSTouch::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
154 {
155     return JSTouchPrototype::create(exec->globalData(), globalObject, JSTouchPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
156 }
157
158 bool JSTouch::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
159 {
160     JSTouch* thisObject = jsCast<JSTouch*>(cell);
161     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
162     return getStaticValueSlot<JSTouch, Base>(exec, &JSTouchTable, thisObject, propertyName, slot);
163 }
164
165 bool JSTouch::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
166 {
167     JSTouch* thisObject = jsCast<JSTouch*>(object);
168     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
169     return getStaticValueDescriptor<JSTouch, Base>(exec, &JSTouchTable, thisObject, propertyName, descriptor);
170 }
171
172 JSValue jsTouchClientX(ExecState* exec, JSValue slotBase, const Identifier&)
173 {
174     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
175     UNUSED_PARAM(exec);
176     Touch* imp = static_cast<Touch*>(castedThis->impl());
177     JSValue result = jsNumber(imp->clientX());
178     return result;
179 }
180
181
182 JSValue jsTouchClientY(ExecState* exec, JSValue slotBase, const Identifier&)
183 {
184     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
185     UNUSED_PARAM(exec);
186     Touch* imp = static_cast<Touch*>(castedThis->impl());
187     JSValue result = jsNumber(imp->clientY());
188     return result;
189 }
190
191
192 JSValue jsTouchScreenX(ExecState* exec, JSValue slotBase, const Identifier&)
193 {
194     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
195     UNUSED_PARAM(exec);
196     Touch* imp = static_cast<Touch*>(castedThis->impl());
197     JSValue result = jsNumber(imp->screenX());
198     return result;
199 }
200
201
202 JSValue jsTouchScreenY(ExecState* exec, JSValue slotBase, const Identifier&)
203 {
204     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
205     UNUSED_PARAM(exec);
206     Touch* imp = static_cast<Touch*>(castedThis->impl());
207     JSValue result = jsNumber(imp->screenY());
208     return result;
209 }
210
211
212 JSValue jsTouchPageX(ExecState* exec, JSValue slotBase, const Identifier&)
213 {
214     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
215     UNUSED_PARAM(exec);
216     Touch* imp = static_cast<Touch*>(castedThis->impl());
217     JSValue result = jsNumber(imp->pageX());
218     return result;
219 }
220
221
222 JSValue jsTouchPageY(ExecState* exec, JSValue slotBase, const Identifier&)
223 {
224     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
225     UNUSED_PARAM(exec);
226     Touch* imp = static_cast<Touch*>(castedThis->impl());
227     JSValue result = jsNumber(imp->pageY());
228     return result;
229 }
230
231
232 JSValue jsTouchTarget(ExecState* exec, JSValue slotBase, const Identifier&)
233 {
234     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
235     UNUSED_PARAM(exec);
236     Touch* imp = static_cast<Touch*>(castedThis->impl());
237     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->target()));
238     return result;
239 }
240
241
242 JSValue jsTouchIdentifier(ExecState* exec, JSValue slotBase, const Identifier&)
243 {
244     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
245     UNUSED_PARAM(exec);
246     Touch* imp = static_cast<Touch*>(castedThis->impl());
247     JSValue result = jsNumber(imp->identifier());
248     return result;
249 }
250
251
252 JSValue jsTouchWebkitRadiusX(ExecState* exec, JSValue slotBase, const Identifier&)
253 {
254     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
255     UNUSED_PARAM(exec);
256     Touch* imp = static_cast<Touch*>(castedThis->impl());
257     JSValue result = jsNumber(imp->webkitRadiusX());
258     return result;
259 }
260
261
262 JSValue jsTouchWebkitRadiusY(ExecState* exec, JSValue slotBase, const Identifier&)
263 {
264     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
265     UNUSED_PARAM(exec);
266     Touch* imp = static_cast<Touch*>(castedThis->impl());
267     JSValue result = jsNumber(imp->webkitRadiusY());
268     return result;
269 }
270
271
272 JSValue jsTouchWebkitRotationAngle(ExecState* exec, JSValue slotBase, const Identifier&)
273 {
274     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
275     UNUSED_PARAM(exec);
276     Touch* imp = static_cast<Touch*>(castedThis->impl());
277     JSValue result = jsNumber(imp->webkitRotationAngle());
278     return result;
279 }
280
281
282 JSValue jsTouchWebkitForce(ExecState* exec, JSValue slotBase, const Identifier&)
283 {
284     JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
285     UNUSED_PARAM(exec);
286     Touch* imp = static_cast<Touch*>(castedThis->impl());
287     JSValue result = jsNumber(imp->webkitForce());
288     return result;
289 }
290
291
292 JSValue jsTouchConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
293 {
294     JSTouch* domObject = static_cast<JSTouch*>(asObject(slotBase));
295     return JSTouch::getConstructor(exec, domObject->globalObject());
296 }
297
298 JSValue JSTouch::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
299 {
300     return getDOMConstructor<JSTouchConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
301 }
302
303 static inline bool isObservable(JSTouch* jsTouch)
304 {
305     if (jsTouch->hasCustomProperties())
306         return true;
307     return false;
308 }
309
310 bool JSTouchOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
311 {
312     JSTouch* jsTouch = static_cast<JSTouch*>(handle.get().asCell());
313     if (!isObservable(jsTouch))
314         return false;
315     UNUSED_PARAM(visitor);
316     return false;
317 }
318
319 void JSTouchOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
320 {
321     JSTouch* jsTouch = static_cast<JSTouch*>(handle.get().asCell());
322     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
323     uncacheWrapper(world, jsTouch->impl(), jsTouch);
324     jsTouch->releaseImpl();
325 }
326
327 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Touch* impl)
328 {
329     return wrap<JSTouch>(exec, globalObject, impl);
330 }
331
332 Touch* toTouch(JSC::JSValue value)
333 {
334     return value.inherits(&JSTouch::s_info) ? static_cast<JSTouch*>(asObject(value))->impl() : 0;
335 }
336
337 }
338
339 #endif // ENABLE(TOUCH_EVENTS)