OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2005, 2007 Apple Inc. All rights reserved. | |
3 * Copyright (C) 2006 Jon Shier (jshier@iastate.edu) | |
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 | |
22 #ifndef EventNames_h | |
23 #define EventNames_h | |
24 | |
25 #include "EventInterfaces.h" | |
26 #include "EventTargetInterfaces.h" | |
27 #include "core/platform/ThreadGlobalData.h" | |
28 #include "wtf/text/AtomicString.h" | |
29 | |
30 namespace WebCore { | |
31 | |
32 #define EVENT_NAMES_FOR_EACH(macro) \ | |
33 \ | |
34 macro(abort) \ | |
35 macro(beforecopy) \ | |
36 macro(beforecut) \ | |
37 macro(beforeload) \ | |
38 macro(beforepaste) \ | |
39 macro(beforeunload) \ | |
40 macro(blocked) \ | |
41 macro(blur) \ | |
42 macro(cached) \ | |
43 macro(cancel) \ | |
44 macro(change) \ | |
45 macro(chargingchange) \ | |
46 macro(chargingtimechange) \ | |
47 macro(checking) \ | |
48 macro(click) \ | |
49 macro(close) \ | |
50 macro(complete) \ | |
51 macro(compositionend) \ | |
52 macro(compositionstart) \ | |
53 macro(compositionupdate) \ | |
54 macro(connect) \ | |
55 macro(contextmenu) \ | |
56 macro(copy) \ | |
57 macro(cut) \ | |
58 macro(dblclick) \ | |
59 macro(devicemotion) \ | |
60 macro(deviceorientation) \ | |
61 macro(dischargingtimechange) \ | |
62 macro(disconnect) \ | |
63 macro(display) \ | |
64 macro(downloading) \ | |
65 macro(drag) \ | |
66 macro(dragend) \ | |
67 macro(dragenter) \ | |
68 macro(dragleave) \ | |
69 macro(dragover) \ | |
70 macro(dragstart) \ | |
71 macro(drop) \ | |
72 macro(error) \ | |
73 macro(focus) \ | |
74 macro(focusin) \ | |
75 macro(focusout) \ | |
76 macro(gesturetap) \ | |
77 macro(gesturetapunconfirmed) \ | |
78 macro(gesturetapdown) \ | |
79 macro(gesturescrollstart) \ | |
80 macro(gesturescrollend) \ | |
81 macro(gesturescrollupdate) \ | |
82 macro(hashchange) \ | |
83 macro(input) \ | |
84 macro(invalid) \ | |
85 macro(keydown) \ | |
86 macro(keypress) \ | |
87 macro(keyup) \ | |
88 macro(levelchange) \ | |
89 macro(load) \ | |
90 macro(loading) \ | |
91 macro(loadingdone) \ | |
92 macro(loadingerror) \ | |
93 macro(loadstart) \ | |
94 macro(message) \ | |
95 macro(midimessage) \ | |
96 macro(mousedown) \ | |
97 macro(mouseenter) \ | |
98 macro(mouseleave) \ | |
99 macro(mousemove) \ | |
100 macro(mouseout) \ | |
101 macro(mouseover) \ | |
102 macro(mouseup) \ | |
103 macro(mousewheel) \ | |
104 macro(noupdate) \ | |
105 macro(obsolete) \ | |
106 macro(offline) \ | |
107 macro(online) \ | |
108 macro(open) \ | |
109 macro(overflowchanged) \ | |
110 macro(pagehide) \ | |
111 macro(pageshow) \ | |
112 macro(paste) \ | |
113 macro(popstate) \ | |
114 macro(readystatechange) \ | |
115 macro(reset) \ | |
116 macro(resize) \ | |
117 macro(scroll) \ | |
118 macro(search) \ | |
119 macro(select) \ | |
120 macro(selectstart) \ | |
121 macro(selectionchange) \ | |
122 macro(storage) \ | |
123 macro(submit) \ | |
124 macro(textInput) \ | |
125 macro(unload) \ | |
126 macro(updateready) \ | |
127 macro(upgradeneeded) \ | |
128 macro(versionchange) \ | |
129 macro(webkitvisibilitychange) \ | |
130 macro(wheel) \ | |
131 macro(write) \ | |
132 macro(writeend) \ | |
133 macro(writestart) \ | |
134 macro(zoom) \ | |
135 \ | |
136 macro(DOMActivate) \ | |
137 macro(DOMFocusIn) \ | |
138 macro(DOMFocusOut) \ | |
139 macro(DOMCharacterDataModified) \ | |
140 macro(DOMNodeInserted) \ | |
141 macro(DOMNodeInsertedIntoDocument) \ | |
142 macro(DOMNodeRemoved) \ | |
143 macro(DOMNodeRemovedFromDocument) \ | |
144 macro(DOMSubtreeModified) \ | |
145 macro(DOMContentLoaded) \ | |
146 \ | |
147 macro(webkitBeforeTextInserted) \ | |
148 macro(webkitEditableContentChanged) \ | |
149 \ | |
150 macro(canplay) \ | |
151 macro(canplaythrough) \ | |
152 macro(durationchange) \ | |
153 macro(emptied) \ | |
154 macro(ended) \ | |
155 macro(loadeddata) \ | |
156 macro(loadedmetadata) \ | |
157 macro(pause) \ | |
158 macro(play) \ | |
159 macro(playing) \ | |
160 macro(ratechange) \ | |
161 macro(seeked) \ | |
162 macro(seeking) \ | |
163 macro(timeupdate) \ | |
164 macro(volumechange) \ | |
165 macro(waiting) \ | |
166 \ | |
167 macro(addtrack) \ | |
168 macro(cuechange) \ | |
169 macro(enter) \ | |
170 macro(exit) \ | |
171 \ | |
172 macro(addsourcebuffer) \ | |
173 macro(removesourcebuffer) \ | |
174 macro(sourceopen) \ | |
175 macro(sourceended) \ | |
176 macro(sourceclose) \ | |
177 macro(update) \ | |
178 macro(updateend) \ | |
179 macro(updatestart) \ | |
180 macro(webkitaddsourcebuffer) \ | |
181 macro(webkitremovesourcebuffer) \ | |
182 macro(webkitsourceopen) \ | |
183 macro(webkitsourceended) \ | |
184 macro(webkitsourceclose) \ | |
185 \ | |
186 macro(webkitkeyadded) \ | |
187 macro(webkitkeyerror) \ | |
188 macro(webkitkeymessage) \ | |
189 macro(webkitneedkey) \ | |
190 \ | |
191 macro(progress) \ | |
192 macro(stalled) \ | |
193 macro(suspend) \ | |
194 \ | |
195 macro(animationend) \ | |
196 macro(webkitAnimationEnd) \ | |
197 macro(animationstart) \ | |
198 macro(webkitAnimationStart) \ | |
199 macro(animationiteration) \ | |
200 macro(webkitAnimationIteration) \ | |
201 \ | |
202 macro(webkitTransitionEnd) \ | |
203 macro(transitionend) \ | |
204 \ | |
205 macro(orientationchange) \ | |
206 \ | |
207 macro(timeout) \ | |
208 \ | |
209 macro(touchstart) \ | |
210 macro(touchmove) \ | |
211 macro(touchend) \ | |
212 macro(touchcancel) \ | |
213 \ | |
214 macro(success) \ | |
215 \ | |
216 macro(loadend) \ | |
217 \ | |
218 macro(webkitfullscreenchange) \ | |
219 macro(webkitfullscreenerror) \ | |
220 \ | |
221 macro(webkitspeechchange) \ | |
222 \ | |
223 macro(audiostart) \ | |
224 macro(soundstart) \ | |
225 macro(speechstart) \ | |
226 macro(speechend) \ | |
227 macro(soundend) \ | |
228 macro(audioend) \ | |
229 macro(result) \ | |
230 macro(nomatch) \ | |
231 macro(start) \ | |
232 macro(end) \ | |
233 macro(mark) \ | |
234 macro(boundary) \ | |
235 macro(resume) \ | |
236 \ | |
237 macro(webglcontextlost) \ | |
238 macro(webglcontextrestored) \ | |
239 macro(webglcontextcreationerror) \ | |
240 \ | |
241 macro(audioprocess) \ | |
242 \ | |
243 macro(connecting) \ | |
244 macro(addstream) \ | |
245 macro(removestream) \ | |
246 macro(signalingstatechange) \ | |
247 macro(removetrack) \ | |
248 macro(mute) \ | |
249 macro(unmute) \ | |
250 macro(iceconnectionstatechange) \ | |
251 macro(icecandidate) \ | |
252 macro(negotiationneeded) \ | |
253 macro(datachannel) \ | |
254 macro(tonechange) \ | |
255 \ | |
256 macro(show) \ | |
257 \ | |
258 macro(webkitpointerlockchange) \ | |
259 macro(webkitpointerlockerror) \ | |
260 \ | |
261 macro(webkitregionlayoutupdate) \ | |
262 \ | |
263 macro(webkitregionoversetchange) \ | |
264 \ | |
265 macro(webkitnetworkinfochange) \ | |
266 \ | |
267 macro(webkitresourcetimingbufferfull) \ | |
268 \ | |
269 macro(webkitdeviceproximity) \ | |
270 \ | |
271 macro(autocomplete) \ | |
272 macro(autocompleteerror) \ | |
273 \ | |
274 macro(webkitprerenderstart) \ | |
275 macro(webkitprerenderstop) \ | |
276 macro(webkitprerenderload) \ | |
277 macro(webkitprerenderdomcontentloaded) \ | |
278 \ | |
279 macro(securitypolicyviolation) \ | |
280 \ | |
281 | |
282 // end of EVENT_NAMES_FOR_EACH | |
283 | |
284 class EventNames { | |
285 WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED; | |
286 int dummy; // Needed to make initialization macro work. | |
287 // Private to prevent accidental call to EventNames() instead of eventNa
mes() | |
288 EventNames(); | |
289 friend class ThreadGlobalData; | |
290 | |
291 public: | |
292 #define EVENT_NAMES_DECLARE(name) AtomicString name##Event; | |
293 EVENT_NAMES_FOR_EACH(EVENT_NAMES_DECLARE) | |
294 #undef EVENT_NAMES_DECLARE | |
295 | |
296 #define EVENT_INTERFACE_DECLARE(name) AtomicString interfaceFor##name; | |
297 EVENT_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE) | |
298 EVENT_TARGET_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE) | |
299 #undef EVENT_INTERFACE_DECLARE | |
300 | |
301 inline bool isTouchEventType(const AtomicString& eventType) const | |
302 { | |
303 return eventType == touchstartEvent | |
304 || eventType == touchmoveEvent | |
305 || eventType == touchendEvent | |
306 || eventType == touchcancelEvent; | |
307 } | |
308 | |
309 inline bool isGestureEventType(const AtomicString& eventType) const | |
310 { | |
311 return eventType == gesturetapEvent | |
312 || eventType == gesturetapunconfirmedEvent | |
313 || eventType == gesturetapdownEvent | |
314 || eventType == gesturescrollstartEvent | |
315 || eventType == gesturescrollendEvent | |
316 || eventType == gesturescrollupdateEvent; | |
317 } | |
318 | |
319 Vector<AtomicString> touchEventNames() const | |
320 { | |
321 Vector<AtomicString> names; | |
322 names.reserveCapacity(4); | |
323 names.append(touchstartEvent); | |
324 names.append(touchmoveEvent); | |
325 names.append(touchendEvent); | |
326 names.append(touchcancelEvent); | |
327 return names; | |
328 } | |
329 }; | |
330 | |
331 inline EventNames& eventNames() | |
332 { | |
333 return threadGlobalData().eventNames(); | |
334 } | |
335 | |
336 } | |
337 | |
338 #endif | |
OLD | NEW |