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