|
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 "JSTouchEvent.h" |
|
26 |
|
27 #include "JSDOMWindow.h" |
|
28 #include "JSTouchList.h" |
|
29 #include "TouchEvent.h" |
|
30 #include "TouchList.h" |
|
31 #include <runtime/Error.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSTouchEvent); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSTouchEventTableValues[9] = |
|
48 { |
|
49 { "touches", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventTouches), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "targetTouches", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventTargetTouches), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "changedTouches", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventChangedTouches), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "ctrlKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventCtrlKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "shiftKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventShiftKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "altKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventAltKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "metaKey", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventMetaKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTouchEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
58 }; |
|
59 |
|
60 #undef THUNK_GENERATOR |
|
61 static JSC_CONST_HASHTABLE HashTable JSTouchEventTable = { 19, 15, JSTouchEventTableValues, 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 |
|
69 static const HashTableValue JSTouchEventConstructorTableValues[1] = |
|
70 { |
|
71 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
72 }; |
|
73 |
|
74 #undef THUNK_GENERATOR |
|
75 static JSC_CONST_HASHTABLE HashTable JSTouchEventConstructorTable = { 1, 0, JSTouchEventConstructorTableValues, 0 }; |
|
76 class JSTouchEventConstructor : public DOMConstructorObject { |
|
77 public: |
|
78 JSTouchEventConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
79 |
|
80 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
81 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
82 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
83 static const JSC::ClassInfo s_info; |
|
84 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
85 { |
|
86 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
87 } |
|
88 protected: |
|
89 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
90 }; |
|
91 |
|
92 const ClassInfo JSTouchEventConstructor::s_info = { "TouchEventConstructor", 0, &JSTouchEventConstructorTable, 0 }; |
|
93 |
|
94 JSTouchEventConstructor::JSTouchEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
95 : DOMConstructorObject(JSTouchEventConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
96 { |
|
97 putDirect(exec->propertyNames().prototype, JSTouchEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
98 } |
|
99 |
|
100 bool JSTouchEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
101 { |
|
102 return getStaticValueSlot<JSTouchEventConstructor, DOMObject>(exec, &JSTouchEventConstructorTable, this, propertyName, slot); |
|
103 } |
|
104 |
|
105 bool JSTouchEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
106 { |
|
107 return getStaticValueDescriptor<JSTouchEventConstructor, DOMObject>(exec, &JSTouchEventConstructorTable, this, propertyName, descriptor); |
|
108 } |
|
109 |
|
110 /* Hash table for prototype */ |
|
111 #if ENABLE(JIT) |
|
112 #define THUNK_GENERATOR(generator) , generator |
|
113 #else |
|
114 #define THUNK_GENERATOR(generator) |
|
115 #endif |
|
116 |
|
117 static const HashTableValue JSTouchEventPrototypeTableValues[2] = |
|
118 { |
|
119 { "initTouchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTouchEventPrototypeFunctionInitTouchEvent), (intptr_t)13 THUNK_GENERATOR(0) }, |
|
120 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
121 }; |
|
122 |
|
123 #undef THUNK_GENERATOR |
|
124 static JSC_CONST_HASHTABLE HashTable JSTouchEventPrototypeTable = { 2, 1, JSTouchEventPrototypeTableValues, 0 }; |
|
125 const ClassInfo JSTouchEventPrototype::s_info = { "TouchEventPrototype", 0, &JSTouchEventPrototypeTable, 0 }; |
|
126 |
|
127 JSObject* JSTouchEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
128 { |
|
129 return getDOMPrototype<JSTouchEvent>(exec, globalObject); |
|
130 } |
|
131 |
|
132 bool JSTouchEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
133 { |
|
134 return getStaticFunctionSlot<JSObject>(exec, &JSTouchEventPrototypeTable, this, propertyName, slot); |
|
135 } |
|
136 |
|
137 bool JSTouchEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
138 { |
|
139 return getStaticFunctionDescriptor<JSObject>(exec, &JSTouchEventPrototypeTable, this, propertyName, descriptor); |
|
140 } |
|
141 |
|
142 const ClassInfo JSTouchEvent::s_info = { "TouchEvent", &JSUIEvent::s_info, &JSTouchEventTable, 0 }; |
|
143 |
|
144 JSTouchEvent::JSTouchEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TouchEvent> impl) |
|
145 : JSUIEvent(structure, globalObject, impl) |
|
146 { |
|
147 } |
|
148 |
|
149 JSObject* JSTouchEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
150 { |
|
151 return new (exec) JSTouchEventPrototype(globalObject, JSTouchEventPrototype::createStructure(JSUIEventPrototype::self(exec, globalObject))); |
|
152 } |
|
153 |
|
154 bool JSTouchEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
155 { |
|
156 return getStaticValueSlot<JSTouchEvent, Base>(exec, &JSTouchEventTable, this, propertyName, slot); |
|
157 } |
|
158 |
|
159 bool JSTouchEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
160 { |
|
161 return getStaticValueDescriptor<JSTouchEvent, Base>(exec, &JSTouchEventTable, this, propertyName, descriptor); |
|
162 } |
|
163 |
|
164 JSValue jsTouchEventTouches(ExecState* exec, JSValue slotBase, const Identifier&) |
|
165 { |
|
166 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
167 UNUSED_PARAM(exec); |
|
168 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
169 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->touches())); |
|
170 return result; |
|
171 } |
|
172 |
|
173 JSValue jsTouchEventTargetTouches(ExecState* exec, JSValue slotBase, const Identifier&) |
|
174 { |
|
175 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
176 UNUSED_PARAM(exec); |
|
177 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
178 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->targetTouches())); |
|
179 return result; |
|
180 } |
|
181 |
|
182 JSValue jsTouchEventChangedTouches(ExecState* exec, JSValue slotBase, const Identifier&) |
|
183 { |
|
184 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
185 UNUSED_PARAM(exec); |
|
186 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
187 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->changedTouches())); |
|
188 return result; |
|
189 } |
|
190 |
|
191 JSValue jsTouchEventCtrlKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
192 { |
|
193 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
194 UNUSED_PARAM(exec); |
|
195 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
196 JSValue result = jsBoolean(imp->ctrlKey()); |
|
197 return result; |
|
198 } |
|
199 |
|
200 JSValue jsTouchEventShiftKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
201 { |
|
202 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
203 UNUSED_PARAM(exec); |
|
204 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
205 JSValue result = jsBoolean(imp->shiftKey()); |
|
206 return result; |
|
207 } |
|
208 |
|
209 JSValue jsTouchEventAltKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
210 { |
|
211 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
212 UNUSED_PARAM(exec); |
|
213 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
214 JSValue result = jsBoolean(imp->altKey()); |
|
215 return result; |
|
216 } |
|
217 |
|
218 JSValue jsTouchEventMetaKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
219 { |
|
220 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
221 UNUSED_PARAM(exec); |
|
222 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
223 JSValue result = jsBoolean(imp->metaKey()); |
|
224 return result; |
|
225 } |
|
226 |
|
227 JSValue jsTouchEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
228 { |
|
229 JSTouchEvent* domObject = static_cast<JSTouchEvent*>(asObject(slotBase)); |
|
230 return JSTouchEvent::getConstructor(exec, domObject->globalObject()); |
|
231 } |
|
232 JSValue JSTouchEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
233 { |
|
234 return getDOMConstructor<JSTouchEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
235 } |
|
236 |
|
237 EncodedJSValue JSC_HOST_CALL jsTouchEventPrototypeFunctionInitTouchEvent(ExecState* exec) |
|
238 { |
|
239 JSValue thisValue = exec->hostThisValue(); |
|
240 if (!thisValue.inherits(&JSTouchEvent::s_info)) |
|
241 return throwVMTypeError(exec); |
|
242 JSTouchEvent* castedThis = static_cast<JSTouchEvent*>(asObject(thisValue)); |
|
243 TouchEvent* imp = static_cast<TouchEvent*>(castedThis->impl()); |
|
244 TouchList* touches = toTouchList(exec->argument(0)); |
|
245 TouchList* targetTouches = toTouchList(exec->argument(1)); |
|
246 TouchList* changedTouches = toTouchList(exec->argument(2)); |
|
247 const String& type = ustringToString(exec->argument(3).toString(exec)); |
|
248 DOMWindow* view = toDOMWindow(exec->argument(4)); |
|
249 int screenX = exec->argument(5).toInt32(exec); |
|
250 int screenY = exec->argument(6).toInt32(exec); |
|
251 int clientX = exec->argument(7).toInt32(exec); |
|
252 int clientY = exec->argument(8).toInt32(exec); |
|
253 bool ctrlKey = exec->argument(9).toBoolean(exec); |
|
254 bool altKey = exec->argument(10).toBoolean(exec); |
|
255 bool shiftKey = exec->argument(11).toBoolean(exec); |
|
256 bool metaKey = exec->argument(12).toBoolean(exec); |
|
257 |
|
258 imp->initTouchEvent(touches, targetTouches, changedTouches, type, view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey); |
|
259 return JSValue::encode(jsUndefined()); |
|
260 } |
|
261 |
|
262 |
|
263 } |
|
264 |
|
265 #endif // ENABLE(TOUCH_EVENTS) |