Changeset 98044 in webkit
- Timestamp:
- Oct 20, 2011 5:00:37 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 78 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98039 r98044 1 2011-10-20 Adam Barth <abarth@webkit.org> 2 3 Event.h shouldn't need to know about every ifdef and feature that uses events 4 https://bugs.webkit.org/show_bug.cgi?id=70483 5 6 Reviewed by Eric Seidel. 7 8 This patch expands make_event_factory.pl to create a 9 DOM_EVENT_INTERFACES_FOR_EACH macro that we can use to generate code 10 for each Event interface. We then apply that macro to removing a large 11 number of virtual functions on Event. Instead of having a Boolean 12 virtual function for each subclass of Event, we have a single virtual 13 interfaceName function, which returns an AtomicString. We then use the 14 AtomicString to jump through a HashMap to find the appropriate 15 JavaScript wrapper type. 16 17 This patch does not remove all of the Boolean virtual functions because 18 I got exhausted making all of these edits, but I did remove all the 19 ones that involve ifdefs. A future patch will remove more. 20 21 * WebCore.xcodeproj/project.pbxproj: 22 * bindings/js/JSEventCustom.cpp: 23 (WebCore::toJS): 24 * bindings/v8/custom/V8EventCustom.cpp: 25 (WebCore::toV8): 26 * dom/BeforeLoadEvent.h: 27 (WebCore::BeforeLoadEvent::interfaceName): 28 (WebCore::BeforeLoadEvent::isBeforeLoadEvent): 29 * dom/BeforeTextInsertedEvent.cpp: 30 (WebCore::BeforeTextInsertedEvent::interfaceName): 31 * dom/BeforeTextInsertedEvent.h: 32 * dom/ClipboardEvent.cpp: 33 (WebCore::ClipboardEvent::interfaceName): 34 * dom/ClipboardEvent.h: 35 * dom/CompositionEvent.cpp: 36 (WebCore::CompositionEvent::interfaceName): 37 * dom/CompositionEvent.h: 38 * dom/CustomEvent.cpp: 39 (WebCore::CustomEvent::interfaceName): 40 * dom/CustomEvent.h: 41 * dom/DeviceMotionEvent.cpp: 42 (WebCore::DeviceMotionEvent::interfaceName): 43 * dom/DeviceMotionEvent.h: 44 * dom/DeviceOrientationEvent.cpp: 45 (WebCore::DeviceOrientationEvent::interfaceName): 46 * dom/DeviceOrientationEvent.h: 47 * dom/ErrorEvent.cpp: 48 (WebCore::ErrorEvent::interfaceName): 49 * dom/ErrorEvent.h: 50 * dom/Event.cpp: 51 (WebCore::Event::interfaceName): 52 * dom/Event.h: 53 * dom/EventNames.cpp: 54 (WebCore::EventNames::EventNames): 55 * dom/EventNames.h: 56 * dom/HashChangeEvent.h: 57 (WebCore::HashChangeEvent::interfaceName): 58 * dom/KeyboardEvent.cpp: 59 (WebCore::KeyboardEvent::interfaceName): 60 * dom/KeyboardEvent.h: 61 * dom/MessageEvent.cpp: 62 (WebCore::MessageEvent::interfaceName): 63 * dom/MessageEvent.h: 64 * dom/MouseEvent.cpp: 65 (WebCore::MouseEvent::interfaceName): 66 * dom/MouseEvent.h: 67 * dom/MutationEvent.cpp: 68 (WebCore::MutationEvent::interfaceName): 69 * dom/MutationEvent.h: 70 * dom/OverflowEvent.cpp: 71 (WebCore::OverflowEvent::interfaceName): 72 * dom/OverflowEvent.h: 73 * dom/PageTransitionEvent.cpp: 74 (WebCore::PageTransitionEvent::interfaceName): 75 * dom/PageTransitionEvent.h: 76 * dom/PopStateEvent.cpp: 77 (WebCore::PopStateEvent::interfaceName): 78 * dom/PopStateEvent.h: 79 * dom/ProgressEvent.cpp: 80 (WebCore::ProgressEvent::interfaceName): 81 * dom/ProgressEvent.h: 82 * dom/TextEvent.cpp: 83 (WebCore::TextEvent::interfaceName): 84 * dom/TextEvent.h: 85 * dom/TouchEvent.cpp: 86 (WebCore::TouchEvent::interfaceName): 87 * dom/TouchEvent.h: 88 * dom/UIEvent.h: 89 * dom/WebKitAnimationEvent.cpp: 90 (WebCore::WebKitAnimationEvent::interfaceName): 91 * dom/WebKitAnimationEvent.h: 92 * dom/WebKitTransitionEvent.cpp: 93 (WebCore::WebKitTransitionEvent::interfaceName): 94 * dom/WebKitTransitionEvent.h: 95 * dom/WheelEvent.cpp: 96 (WebCore::WheelEvent::interfaceName): 97 * dom/WheelEvent.h: 98 * dom/make_event_factory.pl: 99 (printFactoryFile): 100 (printMacroFile): 101 (printHeadersFile): 102 * html/canvas/WebGLContextEvent.cpp: 103 (WebCore::WebGLContextEvent::interfaceName): 104 * html/canvas/WebGLContextEvent.h: 105 * inspector/InspectorDOMStorageResource.cpp: 106 (WebCore::InspectorDOMStorageResource::handleEvent): 107 * p2p/MediaStreamEvent.cpp: 108 (WebCore::MediaStreamEvent::interfaceName): 109 * p2p/MediaStreamEvent.h: 110 * page/SpeechInputEvent.cpp: 111 (WebCore::SpeechInputEvent::interfaceName): 112 * page/SpeechInputEvent.h: 113 * storage/IDBVersionChangeEvent.cpp: 114 (WebCore::IDBVersionChangeEvent::interfaceName): 115 * storage/IDBVersionChangeEvent.h: 116 * storage/StorageEvent.cpp: 117 (WebCore::StorageEvent::interfaceName): 118 * storage/StorageEvent.h: 119 * svg/SVGZoomEvent.cpp: 120 (WebCore::SVGZoomEvent::interfaceName): 121 * svg/SVGZoomEvent.h: 122 * webaudio/AudioProcessingEvent.cpp: 123 (WebCore::AudioProcessingEvent::interfaceName): 124 * webaudio/AudioProcessingEvent.h: 125 * webaudio/OfflineAudioCompletionEvent.cpp: 126 (WebCore::OfflineAudioCompletionEvent::interfaceName): 127 * webaudio/OfflineAudioCompletionEvent.h: 128 * websockets/CloseEvent.h: 129 (WebCore::CloseEvent::interfaceName): 130 * xml/XMLHttpRequestProgressEvent.h: 131 (WebCore::XMLHttpRequestProgressEvent::interfaceName): 132 1 133 2011-10-20 Nat Duca <nduca@chromium.org> 2 134 -
trunk/Source/WebCore/GNUmakefile.list.am
r98011 r98044 11 11 DerivedSources/WebCore/ColorData.cpp \ 12 12 DerivedSources/WebCore/EventFactory.cpp \ 13 DerivedSources/WebCore/EventHeaders.h \ 14 DerivedSources/WebCore/EventInterfaces.h \ 13 15 DerivedSources/WebCore/HTMLElementFactory.cpp \ 14 16 DerivedSources/WebCore/HTMLElementFactory.h \ -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r97957 r98044 708 708 'outputs': [ 709 709 '<(SHARED_INTERMEDIATE_DIR)/webkit/EventFactory.cpp', 710 '<(SHARED_INTERMEDIATE_DIR)/webkit/EventHeaders.h', 711 '<(SHARED_INTERMEDIATE_DIR)/webkit/EventInterfaces.h', 710 712 ], 711 713 'action': [ -
trunk/Source/WebCore/WebCore.gypi
r98000 r98044 410 410 '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMXPathNSResolver.h', 411 411 '<(PRODUCT_DIR)/DerivedSources/WebCore/DOMXPathResult.h', 412 '<(PRODUCT_DIR)/DerivedSources/WebCore/EventHeaders.h', 413 '<(PRODUCT_DIR)/DerivedSources/WebCore/EventInterfaces.h', 412 414 '<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLNames.h', 413 415 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r97933 r98044 547 547 </File> 548 548 <File 549 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\EventHeaders.h" 550 > 551 </File> 552 <File 553 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\EventInterfaces.h" 554 > 555 </File> 556 <File 549 557 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\HTMLElementFactory.h" 550 558 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r98000 r98044 3214 3214 97059979107D975200A50A7C /* PolicyChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97059975107D975200A50A7C /* PolicyChecker.cpp */; }; 3215 3215 9705997A107D975200A50A7C /* PolicyChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 97059976107D975200A50A7C /* PolicyChecker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3216 970B728A144FFAC600F00A37 /* EventInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 970B7289144FFAC600F00A37 /* EventInterfaces.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3217 970B72A6145008EB00F00A37 /* EventHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 970B72A5145008EB00F00A37 /* EventHeaders.h */; }; 3216 3218 971491DA12FD65E8001BFEB1 /* URLString.h in Headers */ = {isa = PBXBuildFile; fileRef = 971491D912FD65E8001BFEB1 /* URLString.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3217 3219 97205AAF123928CA00B17380 /* FTPDirectoryDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97205AAD123928CA00B17380 /* FTPDirectoryDocument.cpp */; }; … … 10402 10404 97059975107D975200A50A7C /* PolicyChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolicyChecker.cpp; sourceTree = "<group>"; }; 10403 10405 97059976107D975200A50A7C /* PolicyChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolicyChecker.h; sourceTree = "<group>"; }; 10406 970B7289144FFAC600F00A37 /* EventInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventInterfaces.h; sourceTree = "<group>"; }; 10407 970B72A5145008EB00F00A37 /* EventHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventHeaders.h; sourceTree = "<group>"; }; 10404 10408 971491D912FD65E8001BFEB1 /* URLString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLString.h; sourceTree = "<group>"; }; 10405 10409 97205AAD123928CA00B17380 /* FTPDirectoryDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FTPDirectoryDocument.cpp; sourceTree = "<group>"; }; … … 15277 15281 6565814809D13043000E61D7 /* CSSValueKeywords.h */, 15278 15282 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */, 15283 970B72A5145008EB00F00A37 /* EventHeaders.h */, 15284 970B7289144FFAC600F00A37 /* EventInterfaces.h */, 15279 15285 A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */, 15280 15286 A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */, … … 24697 24703 A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */, 24698 24704 A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */, 24705 970B728A144FFAC600F00A37 /* EventInterfaces.h in Headers */, 24706 970B72A6145008EB00F00A37 /* EventHeaders.h in Headers */, 24699 24707 ); 24700 24708 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/bindings/js/JSEventCustom.cpp
r97574 r98044 31 31 32 32 #include "Clipboard.h" 33 #include "CompositionEvent.h"34 #include "CustomEvent.h"35 #include "DeviceMotionEvent.h"36 #include "DeviceOrientationEvent.h"37 33 #include "Event.h" 38 #include "JSBeforeLoadEvent.h" 34 #include "EventHeaders.h" 35 #include "EventInterfaces.h" 36 #include "EventNames.h" 39 37 #include "JSClipboard.h" 40 #include "JSCustomEvent.h"41 #include "JSCompositionEvent.h"42 #include "JSDeviceMotionEvent.h"43 #include "JSDeviceOrientationEvent.h"44 #include "JSErrorEvent.h"45 #include "JSHashChangeEvent.h"46 #include "JSKeyboardEvent.h"47 #include "JSMessageEvent.h"48 #include "JSMouseEvent.h"49 #include "JSMutationEvent.h"50 #include "JSOverflowEvent.h"51 #include "JSPageTransitionEvent.h"52 #include "JSPopStateEvent.h"53 #include "JSProgressEvent.h"54 #include "JSSpeechInputEvent.h"55 #include "JSStorageEvent.h"56 #include "JSTextEvent.h"57 #include "JSUIEvent.h"58 #include "JSWebKitAnimationEvent.h"59 #include "JSWebKitTransitionEvent.h"60 #include "JSWheelEvent.h"61 #include "JSXMLHttpRequestProgressEvent.h"62 #include "BeforeLoadEvent.h"63 #include "ErrorEvent.h"64 #include "HashChangeEvent.h"65 #include "KeyboardEvent.h"66 #include "MessageEvent.h"67 #include "MouseEvent.h"68 #include "MutationEvent.h"69 #include "OverflowEvent.h"70 #include "PageTransitionEvent.h"71 #include "PopStateEvent.h"72 #include "ProgressEvent.h"73 #include "SpeechInputEvent.h"74 #include "StorageEvent.h"75 #include "TextEvent.h"76 #include "UIEvent.h"77 #include "WebKitAnimationEvent.h"78 #include "WebKitTransitionEvent.h"79 #include "WheelEvent.h"80 #include "XMLHttpRequestProgressEvent.h"81 38 #include <runtime/JSLock.h> 82 83 #if ENABLE(SVG) 84 #include "JSSVGZoomEvent.h" 85 #include "SVGZoomEvent.h" 86 #endif 87 88 #if ENABLE(TOUCH_EVENTS) 89 #include "JSTouchEvent.h" 90 #include "TouchEvent.h" 91 #endif 92 93 #if ENABLE(INDEXED_DATABASE) 94 #include "IDBVersionChangeEvent.h" 95 #include "JSIDBVersionChangeEvent.h" 96 #endif 97 98 #if ENABLE(WEB_AUDIO) 99 #include "AudioProcessingEvent.h" 100 #include "JSAudioProcessingEvent.h" 101 #include "JSOfflineAudioCompletionEvent.h" 102 #include "OfflineAudioCompletionEvent.h" 103 #endif 104 105 #if ENABLE(WEB_SOCKETS) 106 #include "CloseEvent.h" 107 #include "JSCloseEvent.h" 108 #endif 109 110 #if ENABLE(MEDIA_STREAM) 111 #include "JSMediaStreamEvent.h" 112 #include "MediaStreamEvent.h" 113 #endif 114 115 #if ENABLE(WEBGL) 116 #include "JSWebGLContextEvent.h" 117 #include "WebGLContextEvent.h" 118 #endif 39 #include <wtf/HashMap.h> 40 #include <wtf/text/AtomicString.h> 119 41 120 42 using namespace JSC; … … 126 48 return impl()->isClipboardEvent() ? toJS(exec, globalObject(), impl()->clipboardData()) : jsUndefined(); 127 49 } 50 51 #define DECLARE_EVENT_WRAPPER(interfaceName) \ 52 static JSDOMWrapper* create##interfaceName##Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event) \ 53 { \ 54 return CREATE_DOM_WRAPPER(exec, globalObject, interfaceName, event); \ 55 } \ 56 57 DOM_EVENT_INTERFACES_FOR_EACH(DECLARE_EVENT_WRAPPER) 58 59 #define ADD_WRAPPER_TO_MAP(interfaceName) \ 60 map.add(eventNames().interfaceFor##interfaceName.impl(), create##interfaceName##Wrapper); 128 61 129 62 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event) … … 138 71 return wrapper; 139 72 140 if (event->isUIEvent()) { 141 if (event->isKeyboardEvent()) 142 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, KeyboardEvent, event); 143 else if (event->isTextEvent()) 144 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, TextEvent, event); 145 else if (event->isMouseEvent()) 146 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, MouseEvent, event); 147 else if (event->isWheelEvent()) 148 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WheelEvent, event); 149 #if ENABLE(SVG) 150 else if (event->isSVGZoomEvent()) 151 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, SVGZoomEvent, event); 152 #endif 153 else if (event->isCompositionEvent()) 154 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CompositionEvent, event); 155 #if ENABLE(TOUCH_EVENTS) 156 else if (event->isTouchEvent()) 157 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, TouchEvent, event); 158 #endif 159 else 160 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, UIEvent, event); 161 } else if (event->isMutationEvent()) 162 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, MutationEvent, event); 163 else if (event->isOverflowEvent()) 164 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, OverflowEvent, event); 165 else if (event->isMessageEvent()) 166 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, MessageEvent, event); 167 else if (event->isPageTransitionEvent()) 168 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, PageTransitionEvent, event); 169 else if (event->isProgressEvent()) { 170 if (event->isXMLHttpRequestProgressEvent()) 171 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, XMLHttpRequestProgressEvent, event); 172 else 173 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ProgressEvent, event); 174 } else if (event->isBeforeLoadEvent()) 175 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, BeforeLoadEvent, event); 176 else if (event->isStorageEvent()) 177 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, StorageEvent, event); 178 #if ENABLE(INDEXED_DATABASE) 179 else if (event->isIDBVersionChangeEvent()) 180 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, IDBVersionChangeEvent, event); 181 #endif 182 else if (event->isWebKitAnimationEvent()) 183 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitAnimationEvent, event); 184 else if (event->isWebKitTransitionEvent()) 185 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebKitTransitionEvent, event); 186 #if ENABLE(WORKERS) 187 else if (event->isErrorEvent()) 188 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ErrorEvent, event); 189 #endif 190 else if (event->isHashChangeEvent()) 191 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HashChangeEvent, event); 192 else if (event->isPopStateEvent()) 193 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, PopStateEvent, event); 194 else if (event->isCustomEvent()) 195 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CustomEvent, event); 196 #if ENABLE(DEVICE_ORIENTATION) 197 else if (event->isDeviceMotionEvent()) 198 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, DeviceMotionEvent, event); 199 else if (event->isDeviceOrientationEvent()) 200 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, DeviceOrientationEvent, event); 201 #endif 202 #if ENABLE(WEB_AUDIO) 203 else if (event->isAudioProcessingEvent()) 204 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, AudioProcessingEvent, event); 205 else if (event->isOfflineAudioCompletionEvent()) 206 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, OfflineAudioCompletionEvent, event); 207 #endif 208 #if ENABLE(INPUT_SPEECH) 209 else if (event->isSpeechInputEvent()) 210 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, SpeechInputEvent, event); 211 #endif 212 #if ENABLE(WEB_SOCKETS) 213 else if (event->isCloseEvent()) 214 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, CloseEvent, event); 215 #endif 216 #if ENABLE(MEDIA_STREAM) 217 else if (event->isMediaStreamEvent()) 218 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, MediaStreamEvent, event); 219 #endif 220 #if ENABLE(WEBGL) 221 else if (event->isWebGLContextEvent()) 222 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebGLContextEvent, event); 223 #endif 224 else 225 wrapper = CREATE_DOM_WRAPPER(exec, globalObject, Event, event); 73 typedef JSDOMWrapper* (*CreateEventWrapperFunction)(ExecState*, JSDOMGlobalObject*, Event*); 74 typedef HashMap<WTF::AtomicStringImpl*, CreateEventWrapperFunction> FunctionMap; 226 75 227 return wrapper; 76 DEFINE_STATIC_LOCAL(FunctionMap, map, ()); 77 if (map.isEmpty()) { 78 DOM_EVENT_INTERFACES_FOR_EACH(ADD_WRAPPER_TO_MAP) 79 } 80 81 CreateEventWrapperFunction createWrapperFunction = map.get(event->interfaceName().impl()); 82 if (createWrapperFunction) 83 return createWrapperFunction(exec, globalObject, event); 84 85 return CREATE_DOM_WRAPPER(exec, globalObject, Event, event); 228 86 } 229 87 -
trunk/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp
r97574 r98044 34 34 #include "Clipboard.h" 35 35 #include "ClipboardEvent.h" 36 #include "CustomEvent.h"37 36 #include "Event.h" 38 #include "V8BeforeLoadEvent.h" 37 #include "EventHeaders.h" 38 #include "EventInterfaces.h" 39 #include "EventNames.h" 39 40 #include "V8Binding.h" 40 41 #include "V8Clipboard.h" 41 #include "V8CloseEvent.h"42 #include "V8CompositionEvent.h"43 #include "V8CustomEvent.h"44 #include "V8DeviceMotionEvent.h"45 #include "V8DeviceOrientationEvent.h"46 #include "V8ErrorEvent.h"47 #include "V8HashChangeEvent.h"48 #include "V8IDBVersionChangeEvent.h"49 #include "V8KeyboardEvent.h"50 #include "V8MessageEvent.h"51 #include "V8MouseEvent.h"52 #include "V8MutationEvent.h"53 #include "V8OverflowEvent.h"54 #include "V8PageTransitionEvent.h"55 #include "V8PopStateEvent.h"56 #include "V8ProgressEvent.h"57 42 #include "V8Proxy.h" 58 #include "V8SpeechInputEvent.h"59 #include "V8StorageEvent.h"60 #include "V8TextEvent.h"61 #include "V8TouchEvent.h"62 #include "V8UIEvent.h"63 #include "V8WebKitAnimationEvent.h"64 #include "V8WebKitTransitionEvent.h"65 #include "V8WheelEvent.h"66 #include "V8XMLHttpRequestProgressEvent.h"67 68 #if ENABLE(SVG)69 #include "V8SVGZoomEvent.h"70 #endif71 72 #if ENABLE(WEB_AUDIO)73 #include "V8AudioProcessingEvent.h"74 #include "V8OfflineAudioCompletionEvent.h"75 #endif76 77 #if ENABLE(MEDIA_STREAM)78 #include "V8MediaStreamEvent.h"79 #endif80 43 81 44 namespace WebCore { … … 107 70 } 108 71 109 v8::Handle<v8::Value> toV8(Event* impl) 72 #define DECLARE_EVENT_WRAPPER(interfaceName) \ 73 static v8::Handle<v8::Value> toV8##interfaceName(Event* event) \ 74 { \ 75 return toV8(static_cast<interfaceName*>(event)); \ 76 } \ 77 78 DOM_EVENT_INTERFACES_FOR_EACH(DECLARE_EVENT_WRAPPER) 79 80 #define ADD_WRAPPER_TO_MAP(interfaceName) \ 81 map.add(eventNames().interfaceFor##interfaceName.impl(), toV8##interfaceName); 82 83 v8::Handle<v8::Value> toV8(Event* event) 110 84 { 111 if (! impl)85 if (!event) 112 86 return v8::Null(); 113 if (impl->isUIEvent()) { 114 if (impl->isKeyboardEvent()) 115 return toV8(static_cast<KeyboardEvent*>(impl)); 116 if (impl->isTextEvent()) 117 return toV8(static_cast<TextEvent*>(impl)); 118 if (impl->isMouseEvent()) 119 return toV8(static_cast<MouseEvent*>(impl)); 120 if (impl->isWheelEvent()) 121 return toV8(static_cast<WheelEvent*>(impl)); 122 #if ENABLE(SVG) 123 if (impl->isSVGZoomEvent()) 124 return toV8(static_cast<SVGZoomEvent*>(impl)); 125 #endif 126 if (impl->isCompositionEvent()) 127 return toV8(static_cast<CompositionEvent*>(impl)); 128 #if ENABLE(TOUCH_EVENTS) 129 if (impl->isTouchEvent()) 130 return toV8(static_cast<TouchEvent*>(impl)); 131 #endif 132 return toV8(static_cast<UIEvent*>(impl)); 87 88 typedef v8::Handle<v8::Value> (*ToV8Function)(Event*); 89 typedef HashMap<WTF::AtomicStringImpl*, ToV8Function> FunctionMap; 90 91 DEFINE_STATIC_LOCAL(FunctionMap, map, ()); 92 if (map.isEmpty()) { 93 DOM_EVENT_INTERFACES_FOR_EACH(ADD_WRAPPER_TO_MAP) 133 94 } 134 if (impl->isHashChangeEvent()) 135 return toV8(static_cast<HashChangeEvent*>(impl)); 136 if (impl->isMutationEvent()) 137 return toV8(static_cast<MutationEvent*>(impl)); 138 if (impl->isOverflowEvent()) 139 return toV8(static_cast<OverflowEvent*>(impl)); 140 if (impl->isMessageEvent()) 141 return toV8(static_cast<MessageEvent*>(impl)); 142 if (impl->isPageTransitionEvent()) 143 return toV8(static_cast<PageTransitionEvent*>(impl)); 144 if (impl->isPopStateEvent()) 145 return toV8(static_cast<PopStateEvent*>(impl)); 146 if (impl->isProgressEvent()) { 147 if (impl->isXMLHttpRequestProgressEvent()) 148 return toV8(static_cast<XMLHttpRequestProgressEvent*>(impl)); 149 return toV8(static_cast<ProgressEvent*>(impl)); 150 } 151 if (impl->isWebKitAnimationEvent()) 152 return toV8(static_cast<WebKitAnimationEvent*>(impl)); 153 if (impl->isWebKitTransitionEvent()) 154 return toV8(static_cast<WebKitTransitionEvent*>(impl)); 155 #if ENABLE(WORKERS) 156 if (impl->isErrorEvent()) 157 return toV8(static_cast<ErrorEvent*>(impl)); 158 #endif 159 if (impl->isStorageEvent()) 160 return toV8(static_cast<StorageEvent*>(impl)); 161 #if ENABLE(INDEXED_DATABASE) 162 if (impl->isIDBVersionChangeEvent()) 163 return toV8(static_cast<IDBVersionChangeEvent*>(impl)); 164 #endif 165 if (impl->isBeforeLoadEvent()) 166 return toV8(static_cast<BeforeLoadEvent*>(impl)); 167 #if ENABLE(DEVICE_ORIENTATION) 168 if (impl->isDeviceMotionEvent()) 169 return toV8(static_cast<DeviceMotionEvent*>(impl)); 170 if (impl->isDeviceOrientationEvent()) 171 return toV8(static_cast<DeviceOrientationEvent*>(impl)); 172 #endif 173 #if ENABLE(WEB_AUDIO) 174 if (impl->isAudioProcessingEvent()) 175 return toV8(static_cast<AudioProcessingEvent*>(impl)); 176 if (impl->isOfflineAudioCompletionEvent()) 177 return toV8(static_cast<OfflineAudioCompletionEvent*>(impl)); 178 #endif 179 #if ENABLE(INPUT_SPEECH) 180 if (impl->isSpeechInputEvent()) 181 return toV8(static_cast<SpeechInputEvent*>(impl)); 182 #endif 183 if (impl->isCustomEvent()) 184 return toV8(static_cast<CustomEvent*>(impl)); 185 #if ENABLE(WEB_SOCKETS) 186 if (impl->isCloseEvent()) 187 return toV8(static_cast<CloseEvent*>(impl)); 188 #endif 189 #if ENABLE(MEDIA_STREAM) 190 if (impl->isMediaStreamEvent()) 191 return toV8(static_cast<MediaStreamEvent*>(impl)); 192 #endif 193 return V8Event::wrap(impl); 95 96 ToV8Function specializedToV8 = map.get(event->interfaceName().impl()); 97 if (specializedToV8) 98 return specializedToV8(event); 99 100 return V8Event::wrap(event); 194 101 } 102 195 103 } // namespace WebCore -
trunk/Source/WebCore/dom/BeforeLoadEvent.h
r97324 r98044 43 43 class BeforeLoadEvent : public Event { 44 44 public: 45 virtual bool isBeforeLoadEvent() const { return true; }46 47 45 static PassRefPtr<BeforeLoadEvent> create() 48 46 { … … 72 70 const String& url() const { return m_url; } 73 71 72 virtual const AtomicString& interfaceName() const { return eventNames().interfaceForBeforeLoadEvent; } 73 virtual bool isBeforeLoadEvent() const { return true; } 74 74 75 private: 75 76 BeforeLoadEvent() -
trunk/Source/WebCore/dom/BeforeTextInsertedEvent.cpp
r69437 r98044 40 40 } 41 41 42 const AtomicString& BeforeTextInsertedEvent::interfaceName() const 43 { 44 // Notice that there is no BeforeTextInsertedEvent.idl. 45 return eventNames().interfaceForEvent; 42 46 } 47 48 } -
trunk/Source/WebCore/dom/BeforeTextInsertedEvent.h
r69437 r98044 40 40 } 41 41 42 virtual const AtomicString& interfaceName() const; 42 43 virtual bool isBeforeTextInsertedEvent() const { return true; } 43 44 44 45 const String& text() const { return m_text; } 45 46 void setText(const String& s) { m_text = s; } -
trunk/Source/WebCore/dom/ClipboardEvent.cpp
r69437 r98044 24 24 #include "ClipboardEvent.h" 25 25 26 #include "EventNames.h" 27 26 28 namespace WebCore { 27 29 … … 39 41 } 40 42 43 const AtomicString& ClipboardEvent::interfaceName() const 44 { 45 // Notice that there is no ClipboardEvent.idl. 46 return eventNames().interfaceForEvent; 47 } 48 41 49 bool ClipboardEvent::isClipboardEvent() const 42 50 { -
trunk/Source/WebCore/dom/ClipboardEvent.h
r69437 r98044 45 45 Clipboard* clipboard() const { return m_clipboard.get(); } 46 46 47 virtual const AtomicString& interfaceName() const; 47 48 virtual bool isClipboardEvent() const; 48 49 -
trunk/Source/WebCore/dom/CompositionEvent.cpp
r95901 r98044 56 56 } 57 57 58 const AtomicString& CompositionEvent::interfaceName() const 59 { 60 return eventNames().interfaceForCompositionEvent; 61 } 62 58 63 bool CompositionEvent::isCompositionEvent() const 59 64 { -
trunk/Source/WebCore/dom/CompositionEvent.h
r95901 r98044 43 43 } 44 44 virtual ~CompositionEvent(); 45 45 46 46 void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data); 47 47 48 48 String data() const { return m_data; } 49 49 50 virtual const AtomicString& interfaceName() const; 50 51 virtual bool isCompositionEvent() const; 51 52 -
trunk/Source/WebCore/dom/CustomEvent.cpp
r95901 r98044 26 26 #include "config.h" 27 27 #include "CustomEvent.h" 28 29 #include "EventNames.h" 28 30 29 31 namespace WebCore { … … 58 60 } 59 61 60 bool CustomEvent::isCustomEvent() const62 const AtomicString& CustomEvent::interfaceName() const 61 63 { 62 return true;64 return eventNames().interfaceForCustomEvent; 63 65 } 64 66 -
trunk/Source/WebCore/dom/CustomEvent.h
r95901 r98044 54 54 void initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValue detail); 55 55 56 virtual bool isCustomEvent() const;56 virtual const AtomicString& interfaceName() const; 57 57 58 58 ScriptValue detail() const { return m_detail; } -
trunk/Source/WebCore/dom/DeviceMotionEvent.cpp
r64845 r98044 28 28 29 29 #include "DeviceMotionData.h" 30 #include "EventNames.h" 30 31 31 32 namespace WebCore { … … 55 56 } 56 57 58 const AtomicString& DeviceMotionEvent::interfaceName() const 59 { 60 #if ENABLE(DEVICE_ORIENTATION) 61 return eventNames().interfaceForDeviceMotionEvent; 62 #else 63 // FIXME: ENABLE(DEVICE_ORIENTATION) seems to be in a strange state where 64 // it is half-guarded by #ifdefs. DeviceMotionEvent.idl is guarded 65 // but DeviceMotionEvent.cpp itself is required by ungarded code. 66 return eventNames().interfaceForEvent; 67 #endif 68 } 69 57 70 } // namespace WebCore -
trunk/Source/WebCore/dom/DeviceMotionEvent.h
r64845 r98044 47 47 void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData*); 48 48 49 virtual bool isDeviceMotionEvent() const { return true; }49 DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); } 50 50 51 DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }51 virtual const AtomicString& interfaceName() const; 52 52 53 53 private: -
trunk/Source/WebCore/dom/DeviceOrientationEvent.cpp
r95901 r98044 28 28 29 29 #include "DeviceOrientation.h" 30 #include "EventNames.h" 30 31 31 32 namespace WebCore { … … 55 56 } 56 57 58 const AtomicString& DeviceOrientationEvent::interfaceName() const 59 { 60 #if ENABLE(DEVICE_ORIENTATION) 61 return eventNames().interfaceForDeviceOrientationEvent; 62 #else 63 // FIXME: ENABLE(DEVICE_ORIENTATION) seems to be in a strange state where 64 // it is half-guarded by #ifdefs. DeviceOrientationEvent.idl is guarded 65 // but DeviceOrientationEvent.cpp itself is required by ungarded code. 66 return eventNames().interfaceForEvent; 67 #endif 68 } 69 57 70 } // namespace WebCore -
trunk/Source/WebCore/dom/DeviceOrientationEvent.h
r95901 r98044 47 47 void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientation*); 48 48 49 virtual bool isDeviceOrientationEvent() const { return true; }49 DeviceOrientation* orientation() const { return m_orientation.get(); } 50 50 51 DeviceOrientation* orientation() const { return m_orientation.get(); }51 virtual const AtomicString& interfaceName() const; 52 52 53 53 private: -
trunk/Source/WebCore/dom/ErrorEvent.cpp
r95901 r98044 30 30 31 31 #include "config.h" 32 33 32 #include "ErrorEvent.h" 34 33 … … 85 84 } 86 85 86 const AtomicString& ErrorEvent::interfaceName() const 87 { 88 return eventNames().interfaceForErrorEvent; 89 } 90 87 91 } // namespace WebCore -
trunk/Source/WebCore/dom/ErrorEvent.h
r95901 r98044 67 67 unsigned lineno() const { return m_lineNumber; } 68 68 69 virtual const AtomicString& interfaceName() const; 69 70 virtual bool isErrorEvent() const; 70 71 -
trunk/Source/WebCore/dom/Event.cpp
r97574 r98044 25 25 26 26 #include "EventDispatcher.h" 27 #include "EventNames.h" 27 28 #include "EventTarget.h" 28 29 #include "UserGestureIndicator.h" … … 97 98 } 98 99 99 bool Event::isCustomEvent() const100 { 101 return false;100 const AtomicString& Event::interfaceName() const 101 { 102 return eventNames().interfaceForEvent; 102 103 } 103 104 … … 167 168 } 168 169 169 bool Event::isPopStateEvent() const170 {171 return false;172 }173 174 170 bool Event::isProgressEvent() const 175 171 { … … 177 173 } 178 174 179 bool Event::isWebKitAnimationEvent() const180 {181 return false;182 }183 184 bool Event::isWebKitTransitionEvent() const185 {186 return false;187 }188 189 bool Event::isXMLHttpRequestProgressEvent() const190 {191 return false;192 }193 194 175 bool Event::isBeforeLoadEvent() const 195 {196 return false;197 }198 199 bool Event::isHashChangeEvent() const200 176 { 201 177 return false; … … 209 185 #endif 210 186 211 bool Event::isStorageEvent() const212 {213 return false;214 }215 216 #if ENABLE(INDEXED_DATABASE)217 bool Event::isIDBVersionChangeEvent() const218 {219 return false;220 }221 #endif222 223 187 bool Event::isErrorEvent() const 224 188 { 225 189 return false; 226 190 } 227 228 #if ENABLE(TOUCH_EVENTS)229 bool Event::isTouchEvent() const230 {231 return false;232 }233 #endif234 235 #if ENABLE(DEVICE_ORIENTATION)236 bool Event::isDeviceMotionEvent() const237 {238 return false;239 }240 241 bool Event::isDeviceOrientationEvent() const242 {243 return false;244 }245 #endif246 247 #if ENABLE(WEB_AUDIO)248 bool Event::isAudioProcessingEvent() const249 {250 return false;251 }252 253 bool Event::isOfflineAudioCompletionEvent() const254 {255 return false;256 }257 #endif258 259 #if ENABLE(INPUT_SPEECH)260 bool Event::isSpeechInputEvent() const261 {262 return false;263 }264 #endif265 266 #if ENABLE(WEB_SOCKETS)267 bool Event::isCloseEvent() const268 {269 return false;270 }271 #endif272 273 #if ENABLE(MEDIA_STREAM)274 bool Event::isMediaStreamEvent() const275 {276 return false;277 }278 #endif279 280 #if ENABLE(WEBGL)281 bool Event::isWebGLContextEvent() const282 {283 return false;284 }285 #endif286 287 191 288 192 bool Event::storesResultAsString() const -
trunk/Source/WebCore/dom/Event.h
r97574 r98044 113 113 Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; } 114 114 115 virtual bool isCustomEvent() const; 115 virtual const AtomicString& interfaceName() const; 116 117 // These are needed for the CPP bindings. 116 118 virtual bool isUIEvent() const; 117 119 virtual bool isMouseEvent() const; 118 120 virtual bool isMutationEvent() const; 121 122 virtual bool isDragEvent() const; // a subset of mouse events 123 124 // FIXME: Remove these! Callers should use interfaceName() instead. 119 125 virtual bool isKeyboardEvent() const; 120 126 virtual bool isTextEvent() const; 121 127 virtual bool isCompositionEvent() const; 122 virtual bool isDragEvent() const; // a subset of mouse events123 128 virtual bool isClipboardEvent() const; 124 129 virtual bool isMessageEvent() const; … … 127 132 virtual bool isOverflowEvent() const; 128 133 virtual bool isPageTransitionEvent() const; 129 virtual bool isPopStateEvent() const;130 134 virtual bool isProgressEvent() const; 131 virtual bool isXMLHttpRequestProgressEvent() const;132 virtual bool isWebKitAnimationEvent() const;133 virtual bool isWebKitTransitionEvent() const;134 135 virtual bool isBeforeLoadEvent() const; 135 virtual bool isHashChangeEvent() const;136 136 #if ENABLE(SVG) 137 137 virtual bool isSVGZoomEvent() const; 138 138 #endif 139 virtual bool isStorageEvent() const;140 #if ENABLE(INDEXED_DATABASE)141 virtual bool isIDBVersionChangeEvent() const;142 #endif143 #if ENABLE(WEB_AUDIO)144 virtual bool isAudioProcessingEvent() const;145 virtual bool isOfflineAudioCompletionEvent() const;146 #endif147 139 virtual bool isErrorEvent() const; 148 #if ENABLE(TOUCH_EVENTS)149 virtual bool isTouchEvent() const;150 #endif151 #if ENABLE(DEVICE_ORIENTATION)152 virtual bool isDeviceMotionEvent() const;153 virtual bool isDeviceOrientationEvent() const;154 #endif155 #if ENABLE(INPUT_SPEECH)156 virtual bool isSpeechInputEvent() const;157 #endif158 #if ENABLE(WEB_SOCKETS)159 virtual bool isCloseEvent() const;160 #endif161 #if ENABLE(MEDIA_STREAM)162 virtual bool isMediaStreamEvent() const;163 #endif164 #if ENABLE(WEBGL)165 virtual bool isWebGLContextEvent() const;166 #endif167 140 168 141 bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } -
trunk/Source/WebCore/dom/EventFactory.in
r97933 r98044 37 37 SVGZoomEvent conditional=SVG 38 38 SVGZoomEvents interfaceName=SVGZoomEvent, conditional=SVG 39 IDBVersionChangeEvent conditional=INDEXED_DATABASE 39 40 TouchEvent conditional=TOUCH_EVENTS 40 41 DeviceMotionEvent conditional=DEVICE_ORIENTATION -
trunk/Source/WebCore/dom/EventNames.cpp
r50583 r98044 26 26 #define INITIALIZE_EVENT_NAME(name) \ 27 27 , name##Event(#name) 28 29 #define INITIALIZE_EVENT_INTERFACE(name) \ 30 , interfaceFor##name(#name) 31 28 32 EventNames::EventNames() 29 33 : dummy(0) 30 34 DOM_EVENT_NAMES_FOR_EACH(INITIALIZE_EVENT_NAME) 35 DOM_EVENT_INTERFACES_FOR_EACH(INITIALIZE_EVENT_INTERFACE) 31 36 { 32 37 } -
trunk/Source/WebCore/dom/EventNames.h
r94433 r98044 23 23 #define EventNames_h 24 24 25 #include "EventInterfaces.h" 25 26 #include "ThreadGlobalData.h" 26 27 #include <wtf/text/AtomicString.h> … … 202 203 DOM_EVENT_NAMES_FOR_EACH(DOM_EVENT_NAMES_DECLARE) 203 204 #undef DOM_EVENT_NAMES_DECLARE 205 206 #define DOM_EVENT_INTERFACE_DECLARE(name) AtomicString interfaceFor##name; 207 DOM_EVENT_INTERFACES_FOR_EACH(DOM_EVENT_INTERFACE_DECLARE) 208 #undef DOM_EVENT_INTERFACE_DECLARE 204 209 }; 205 210 -
trunk/Source/WebCore/dom/HashChangeEvent.h
r95901 r98044 38 38 class HashChangeEvent : public Event { 39 39 public: 40 virtual bool isHashChangeEvent() const { return true; }41 42 40 static PassRefPtr<HashChangeEvent> create() 43 41 { … … 69 67 const String& newURL() const { return m_newURL; } 70 68 69 virtual const AtomicString& interfaceName() const { return eventNames().interfaceForHashChangeEvent; } 70 71 71 private: 72 72 HashChangeEvent() -
trunk/Source/WebCore/dom/KeyboardEvent.cpp
r92266 r98044 140 140 } 141 141 142 const AtomicString& KeyboardEvent::interfaceName() const 143 { 144 return eventNames().interfaceForKeyboardEvent; 145 } 146 142 147 bool KeyboardEvent::isKeyboardEvent() const 143 148 { -
trunk/Source/WebCore/dom/KeyboardEvent.h
r93385 r98044 88 88 int keyCode() const; // key code for keydown and keyup, character for keypress 89 89 int charCode() const; // character code for keypress, 0 for keydown and keyup 90 90 91 virtual const AtomicString& interfaceName() const; 91 92 virtual bool isKeyboardEvent() const; 92 93 virtual int which() const; -
trunk/Source/WebCore/dom/MessageEvent.cpp
r97939 r98044 165 165 } 166 166 167 const AtomicString& MessageEvent::interfaceName() const 168 { 169 return eventNames().interfaceForMessageEvent; 170 } 171 167 172 bool MessageEvent::isMessageEvent() const 168 173 { -
trunk/Source/WebCore/dom/MessageEvent.h
r97939 r98044 98 98 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*); 99 99 100 virtual const AtomicString& interfaceName() const; 100 101 virtual bool isMessageEvent() const; 101 102 -
trunk/Source/WebCore/dom/MouseEvent.cpp
r92266 r98044 93 93 } 94 94 95 const AtomicString& MouseEvent::interfaceName() const 96 { 97 return eventNames().interfaceForMouseEvent; 98 } 99 95 100 bool MouseEvent::isMouseEvent() const 96 101 { -
trunk/Source/WebCore/dom/MouseEvent.h
r93385 r98044 72 72 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; } 73 73 74 virtual const AtomicString& interfaceName() const; 75 74 76 virtual bool isMouseEvent() const; 75 77 virtual bool isDragEvent() const; -
trunk/Source/WebCore/dom/MutationEvent.cpp
r69437 r98044 23 23 #include "config.h" 24 24 #include "MutationEvent.h" 25 26 #include "EventNames.h" 25 27 26 28 namespace WebCore { … … 63 65 } 64 66 67 const AtomicString& MutationEvent::interfaceName() const 68 { 69 return eventNames().interfaceForMutationEvent; 70 } 71 65 72 bool MutationEvent::isMutationEvent() const 66 73 { -
trunk/Source/WebCore/dom/MutationEvent.h
r69437 r98044 61 61 unsigned short attrChange() const { return m_attrChange; } 62 62 63 virtual const AtomicString& interfaceName() const; 63 64 virtual bool isMutationEvent() const; 64 65 -
trunk/Source/WebCore/dom/OverflowEvent.cpp
r97356 r98044 69 69 } 70 70 71 const AtomicString& OverflowEvent::interfaceName() const 72 { 73 return eventNames().interfaceForOverflowEvent; 74 } 75 71 76 bool OverflowEvent::isOverflowEvent() const 72 77 { -
trunk/Source/WebCore/dom/OverflowEvent.h
r97356 r98044 66 66 bool verticalOverflow() const { return m_verticalOverflow; } 67 67 68 virtual const AtomicString& interfaceName() const; 68 69 virtual bool isOverflowEvent() const; 69 70 -
trunk/Source/WebCore/dom/PageTransitionEvent.cpp
r95079 r98044 70 70 } 71 71 72 const AtomicString& PageTransitionEvent::interfaceName() const 73 { 74 return eventNames().interfaceForPageTransitionEvent; 75 } 76 72 77 } // namespace WebCore -
trunk/Source/WebCore/dom/PageTransitionEvent.h
r95079 r98044 59 59 bool persisted); 60 60 61 virtual const AtomicString& interfaceName() const; 61 62 virtual bool isPageTransitionEvent() const { return true; } 62 63 -
trunk/Source/WebCore/dom/PopStateEvent.cpp
r96301 r98044 96 96 } 97 97 98 const AtomicString& PopStateEvent::interfaceName() const 99 { 100 return eventNames().interfaceForPopStateEvent; 101 } 102 98 103 } // namespace WebCore -
trunk/Source/WebCore/dom/PopStateEvent.h
r96301 r98044 48 48 static PassRefPtr<PopStateEvent> create(const AtomicString&, const PopStateEventInit&); 49 49 void initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue&); 50 bool isPopStateEvent() const { return true; }51 50 52 51 SerializedScriptValue* serializedState() const { return m_serializedState.get(); } 53 52 ScriptValue state() const { return m_state; } 53 54 virtual const AtomicString& interfaceName() const; 54 55 55 56 private: -
trunk/Source/WebCore/dom/ProgressEvent.cpp
r94771 r98044 26 26 #include "config.h" 27 27 #include "ProgressEvent.h" 28 29 #include "EventNames.h" 28 30 29 31 namespace WebCore { … … 72 74 } 73 75 76 const AtomicString& ProgressEvent::interfaceName() const 77 { 78 return eventNames().interfaceForProgressEvent; 74 79 } 80 81 } -
trunk/Source/WebCore/dom/ProgressEvent.h
r94771 r98044 61 61 unsigned long long total() const { return m_total; } 62 62 63 virtual const AtomicString& interfaceName() const; 64 63 65 protected: 64 66 ProgressEvent(); -
trunk/Source/WebCore/dom/TextEvent.cpp
r86135 r98044 100 100 } 101 101 102 const AtomicString& TextEvent::interfaceName() const 103 { 104 return eventNames().interfaceForTextEvent; 105 } 106 102 107 bool TextEvent::isTextEvent() const 103 108 { -
trunk/Source/WebCore/dom/TextEvent.h
r86135 r98044 50 50 String data() const { return m_data; } 51 51 52 virtual const AtomicString& interfaceName() const; 52 53 virtual bool isTextEvent() const; 53 54 -
trunk/Source/WebCore/dom/TouchEvent.cpp
r95901 r98044 29 29 30 30 #include "TouchEvent.h" 31 32 #include "EventNames.h" 31 33 #include "TouchList.h" 32 34 … … 74 76 } 75 77 78 const AtomicString& TouchEvent::interfaceName() const 79 { 80 return eventNames().interfaceForTouchEvent; 81 } 82 76 83 } // namespace WebCore 77 84 -
trunk/Source/WebCore/dom/TouchEvent.h
r95901 r98044 64 64 TouchList* changedTouches() const { return m_changedTouches.get(); } 65 65 66 virtual const AtomicString& interfaceName() const; 67 66 68 private: 67 69 TouchEvent(); … … 71 73 int pageY, 72 74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); 73 74 virtual bool isTouchEvent() const { return true; }75 75 76 76 RefPtr<TouchList> m_touches; -
trunk/Source/WebCore/dom/UIEvent.cpp
r97380 r98044 60 60 { 61 61 return true; 62 } 63 64 const AtomicString& UIEvent::interfaceName() const 65 { 66 return eventNames().interfaceForUIEvent; 62 67 } 63 68 -
trunk/Source/WebCore/dom/UIEvent.h
r97380 r98044 49 49 AbstractView* view() const { return m_view.get(); } 50 50 int detail() const { return m_detail; } 51 51 52 virtual const AtomicString& interfaceName() const; 52 53 virtual bool isUIEvent() const; 53 54 -
trunk/Source/WebCore/dom/WebKitAnimationEvent.cpp
r95901 r98044 85 85 } 86 86 87 const AtomicString& WebKitAnimationEvent::interfaceName() const 88 { 89 return eventNames().interfaceForWebKitAnimationEvent; 90 } 91 87 92 } // namespace WebCore -
trunk/Source/WebCore/dom/WebKitAnimationEvent.h
r95901 r98044 64 64 double elapsedTime() const; 65 65 66 virtual bool isWebKitAnimationEvent() const { return true; }66 virtual const AtomicString& interfaceName() const; 67 67 68 68 private: -
trunk/Source/WebCore/dom/WebKitTransitionEvent.cpp
r97225 r98044 86 86 } 87 87 88 const AtomicString& WebKitTransitionEvent::interfaceName() const 89 { 90 return eventNames().interfaceForWebKitTransitionEvent; 91 } 92 88 93 } // namespace WebCore -
trunk/Source/WebCore/dom/WebKitTransitionEvent.h
r97225 r98044 64 64 double elapsedTime() const; 65 65 66 virtual bool isWebKitTransitionEvent() const { return true; }66 virtual const AtomicString& interfaceName() const; 67 67 68 68 private: -
trunk/Source/WebCore/dom/WheelEvent.cpp
r96613 r98044 85 85 } 86 86 87 const AtomicString& WheelEvent::interfaceName() const 88 { 89 return eventNames().interfaceForWheelEvent; 90 } 91 87 92 bool WheelEvent::isWheelEvent() const 88 93 { -
trunk/Source/WebCore/dom/WheelEvent.h
r96613 r98044 70 70 bool isHorizontal() const { return m_wheelDelta.x(); } 71 71 72 virtual const AtomicString& interfaceName() const; 73 72 74 private: 73 75 WheelEvent(); -
trunk/Source/WebCore/dom/make_event_factory.pl
r97933 r98044 41 41 42 42 sub readEvents($); 43 sub printFactoryFile($); 44 sub printMacroFile($); 45 sub printHeadersFile($); 43 46 44 47 my $eventsFile = ""; … … 59 62 my %events = %{readEvents($eventsFile)}; 60 63 61 printCppFile("$outputDir/EventFactory.cpp"); 64 printFactoryFile("$outputDir/EventFactory.cpp"); 65 printMacroFile("$outputDir/EventInterfaces.h"); 66 printHeadersFile("$outputDir/EventHeaders.h"); 62 67 63 68 sub defaultEventPropertyHash … … 120 125 } 121 126 122 sub print CppFile123 { 124 my $ cppPath = shift;127 sub printFactoryFile($) 128 { 129 my $path = shift; 125 130 my $F; 126 131 127 open F, ">$ cppPath";132 open F, ">$path"; 128 133 129 134 printLicenseHeader($F); 130 135 131 136 print F "#include \"config.h\"\n"; 132 print F "#include \"EventFactory.h\"\n\n"; 133 134 my %includedInterfaces = (); 135 136 for my $eventName (sort keys %parsedEvents) { 137 my $conditional = $parsedEvents{$eventName}{"conditional"}; 138 my $interfaceName = interfaceForEvent($eventName); 139 140 next if defined($includedInterfaces{$interfaceName}); 141 $includedInterfaces{$interfaceName} = 1; 142 143 print F "#if ENABLE($conditional)\n" if $conditional; 144 print F "#include \"$interfaceName.h\"\n"; 145 print F "#endif\n" if $conditional; 146 } 147 148 print F "\nnamespace WebCore {\n\n"; 149 137 print F "#include \"EventFactory.h\"\n"; 138 print F "\n"; 139 print F "#include \"EventHeaders.h\"\n"; 140 print F "\n"; 141 print F "namespace WebCore {\n"; 142 print F "\n"; 150 143 print F "PassRefPtr<Event> EventFactory::create(const String& eventType)\n"; 151 144 print F "{\n"; … … 163 156 print F " return 0;\n"; 164 157 print F "}\n"; 165 166 print F "\n} // namespace WebCore\n"; 158 print F "\n"; 159 print F "} // namespace WebCore\n"; 160 close F; 161 } 162 163 sub printMacroFile($) 164 { 165 my $path = shift; 166 my $F; 167 168 open F, ">$path"; 169 170 printLicenseHeader($F); 171 172 print F "#ifndef EventInterfaces_h\n"; 173 print F "#define EventInterfaces_h\n"; 174 print F "\n"; 175 176 my %unconditionalInterfaces = (); 177 my %interfacesByConditional = (); 178 179 for my $eventName (sort keys %parsedEvents) { 180 my $conditional = $parsedEvents{$eventName}{"conditional"}; 181 my $interfaceName = interfaceForEvent($eventName); 182 183 if ($conditional) { 184 if (!defined($interfacesByConditional{$conditional})) { 185 $interfacesByConditional{$conditional} = (); 186 } 187 $interfacesByConditional{$conditional}{$interfaceName} = 1; 188 } else { 189 $unconditionalInterfaces{$interfaceName} = 1 190 } 191 } 192 193 for my $conditional (sort keys %interfacesByConditional) { 194 print F "#if ENABLE($conditional)\n"; 195 print F "#define DOM_EVENT_INTERFACES_FOR_EACH_$conditional(macro) \\\n"; 196 197 for my $interface (sort keys %{ $interfacesByConditional{$conditional} }) { 198 next if defined($unconditionalInterfaces{$interface}); 199 print F " macro($interface) \\\n"; 200 } 201 202 print F "// End of DOM_EVENT_INTERFACES_FOR_EACH_$conditional\n"; 203 print F "#else\n"; 204 print F "#define DOM_EVENT_INTERFACES_FOR_EACH_$conditional(macro)\n"; 205 print F "#endif\n"; 206 print F "\n"; 207 } 208 209 print F "#define DOM_EVENT_INTERFACES_FOR_EACH(macro) \\\n"; 210 print F " \\\n"; 211 for my $interface (sort keys %unconditionalInterfaces) { 212 print F " macro($interface) \\\n"; 213 } 214 print F " \\\n"; 215 for my $conditional (sort keys %interfacesByConditional) { 216 print F " DOM_EVENT_INTERFACES_FOR_EACH_$conditional(macro) \\\n"; 217 } 218 219 print F "\n"; 220 print F "#endif // EventInterfaces_h\n"; 221 222 close F; 223 } 224 225 sub printHeadersFile($) 226 { 227 my $path = shift; 228 my $F; 229 230 open F, ">$path"; 231 232 printLicenseHeader($F); 233 234 print F "#ifndef EventHeaders_h\n"; 235 print F "#define EventHeaders_h\n"; 236 print F "\n"; 237 238 my %includedInterfaces = (); 239 240 for my $eventName (sort keys %parsedEvents) { 241 my $conditional = $parsedEvents{$eventName}{"conditional"}; 242 my $interfaceName = interfaceForEvent($eventName); 243 244 next if defined($includedInterfaces{$interfaceName}); 245 $includedInterfaces{$interfaceName} = 1; 246 247 print F "#if ENABLE($conditional)\n" if $conditional; 248 print F "#include \"$interfaceName.h\"\n"; 249 print F "#if USE(JSC)\n"; 250 print F "#include \"JS$interfaceName.h\"\n"; 251 print F "#elif USE(V8)\n"; 252 print F "#include \"V8$interfaceName.h\"\n"; 253 print F "#endif\n"; 254 print F "#endif\n" if $conditional; 255 } 256 257 print F "\n"; 258 print F "#endif // EventHeaders_h\n"; 259 167 260 close F; 168 261 } -
trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp
r95901 r98044 27 27 #include "WebGLContextEvent.h" 28 28 29 #include "EventNames.h" 30 29 31 namespace WebCore { 30 32 … … 52 54 } 53 55 54 bool WebGLContextEvent::isWebGLContextEvent() const56 const AtomicString& WebGLContextEvent::interfaceName() const 55 57 { 56 return true;58 return eventNames().interfaceForWebGLContextEvent; 57 59 } 58 60 -
trunk/Source/WebCore/html/canvas/WebGLContextEvent.h
r95901 r98044 45 45 void initEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage); 46 46 47 virtual bool isWebGLContextEvent() const;47 const String& statusMessage() const { return m_statusMessage; } 48 48 49 const String& statusMessage() const { return m_statusMessage; }49 virtual const AtomicString& interfaceName() const; 50 50 51 51 private: -
trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp
r97574 r98044 103 103 { 104 104 ASSERT(m_frontend); 105 if (event->type() != eventNames().storageEvent || !event->isStorageEvent())105 if (event->type() != eventNames().storageEvent || event->interfaceName() != eventNames().interfaceForStorageEvent) 106 106 return; 107 107 -
trunk/Source/WebCore/p2p/MediaStreamEvent.cpp
r95901 r98044 73 73 } 74 74 75 const AtomicString& MediaStreamEvent::interfaceName() const 76 { 77 return eventNames().interfaceForMediaStreamEvent; 78 } 79 75 80 } // namespace WebCore 76 81 -
trunk/Source/WebCore/p2p/MediaStreamEvent.h
r95901 r98044 44 44 void initMediaStreamEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<MediaStream>); 45 45 46 // From EventTarget. 47 virtual bool isMediaStreamEvent() const { return true; } 46 PassRefPtr<MediaStream> stream() const; 48 47 49 PassRefPtr<MediaStream> stream() const;48 virtual const AtomicString& interfaceName() const; 50 49 51 50 private: -
trunk/Source/WebCore/page/SpeechInputEvent.cpp
r95901 r98044 30 30 31 31 #include "config.h" 32 33 #if ENABLE(INPUT_SPEECH) 34 32 35 #include "SpeechInputEvent.h" 33 36 34 #i f ENABLE(INPUT_SPEECH)37 #include "EventNames.h" 35 38 36 39 namespace WebCore { … … 60 63 } 61 64 65 const AtomicString& SpeechInputEvent::interfaceName() const 66 { 67 return eventNames().interfaceForSpeechInputEvent; 68 } 69 62 70 } // namespace WebCore 63 71 -
trunk/Source/WebCore/page/SpeechInputEvent.h
r95901 r98044 44 44 ~SpeechInputEvent(); 45 45 46 virtual bool isSpeechInputEvent() const { return true; }46 SpeechInputResultList* results() const { return m_results.get(); } 47 47 48 SpeechInputResultList* results() const { return m_results.get(); }48 virtual const AtomicString& interfaceName() const; 49 49 50 50 private: -
trunk/Source/WebCore/storage/IDBVersionChangeEvent.cpp
r95901 r98044 54 54 } 55 55 56 const AtomicString& IDBVersionChangeEvent::interfaceName() const 57 { 58 return eventNames().interfaceForIDBVersionChangeEvent; 59 } 60 56 61 } // namespace WebCore 57 62 -
trunk/Source/WebCore/storage/IDBVersionChangeEvent.h
r95901 r98044 40 40 class IDBVersionChangeEvent : public Event { 41 41 public: 42 static PassRefPtr<IDBVersionChangeEvent> create(const String& version, const AtomicString& eventType); 43 // FIXME: Need to allow creation of these events from JS. 42 static PassRefPtr<IDBVersionChangeEvent> create(const String& version = String(), const AtomicString& eventType = AtomicString()); 44 43 virtual ~IDBVersionChangeEvent(); 45 44 46 virtual bool isIDBVersionChangeEvent() const { return true; }45 virtual String version(); 47 46 48 virtual String version();47 virtual const AtomicString& interfaceName() const; 49 48 50 49 private: -
trunk/Source/WebCore/storage/StorageEvent.cpp
r97574 r98044 27 27 #include "StorageEvent.h" 28 28 29 #include "EventNames.h" 29 30 #include "Storage.h" 30 31 … … 73 74 } 74 75 76 const AtomicString& StorageEvent::interfaceName() const 77 { 78 return eventNames().interfaceForStorageEvent; 79 } 80 75 81 } // namespace WebCore -
trunk/Source/WebCore/storage/StorageEvent.h
r97574 r98044 51 51 // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, Storage storageAreaArg); 52 52 53 virtual bool isStorageEvent() const { return true; }53 virtual const AtomicString& interfaceName() const; 54 54 55 55 private: -
trunk/Source/WebCore/svg/SVGZoomEvent.cpp
r66397 r98044 21 21 22 22 #include "config.h" 23 23 24 #if ENABLE(SVG) 25 24 26 #include "SVGZoomEvent.h" 27 #include "EventNames.h" 25 28 26 29 namespace WebCore { … … 72 75 } 73 76 77 const AtomicString& SVGZoomEvent::interfaceName() const 78 { 79 return eventNames().interfaceForSVGZoomEvent; 80 } 81 74 82 } // namespace WebCore 75 83 76 84 #endif // ENABLE(SVG) 77 78 // vim:ts=4:noet -
trunk/Source/WebCore/svg/SVGZoomEvent.h
r74782 r98044 46 46 FloatPoint newTranslate() const; 47 47 48 virtual const AtomicString& interfaceName() const; 49 48 50 private: 49 51 SVGZoomEvent(); -
trunk/Source/WebCore/webaudio/AudioProcessingEvent.cpp
r95901 r98044 59 59 } 60 60 61 bool AudioProcessingEvent::isAudioProcessingEvent() const61 const AtomicString& AudioProcessingEvent::interfaceName() const 62 62 { 63 return true;63 return eventNames().interfaceForAudioProcessingEvent; 64 64 } 65 65 -
trunk/Source/WebCore/webaudio/AudioProcessingEvent.h
r95901 r98044 42 42 virtual ~AudioProcessingEvent(); 43 43 44 virtual bool isAudioProcessingEvent() const;45 46 44 AudioBuffer* inputBuffer() { return m_inputBuffer.get(); } 47 45 AudioBuffer* outputBuffer() { return m_outputBuffer.get(); } 46 47 virtual const AtomicString& interfaceName() const; 48 48 49 49 private: -
trunk/Source/WebCore/webaudio/OfflineAudioCompletionEvent.cpp
r95901 r98044 59 59 } 60 60 61 bool OfflineAudioCompletionEvent::isOfflineAudioCompletionEvent() const61 const AtomicString& OfflineAudioCompletionEvent::interfaceName() const 62 62 { 63 return true;63 return eventNames().interfaceForOfflineAudioCompletionEvent; 64 64 } 65 65 -
trunk/Source/WebCore/webaudio/OfflineAudioCompletionEvent.h
r95901 r98044 42 42 virtual ~OfflineAudioCompletionEvent(); 43 43 44 virtual bool isOfflineAudioCompletionEvent() const;44 AudioBuffer* renderedBuffer() { return m_renderedBuffer.get(); } 45 45 46 AudioBuffer* renderedBuffer() { return m_renderedBuffer.get(); }46 virtual const AtomicString& interfaceName() const; 47 47 48 48 private: -
trunk/Source/WebCore/websockets/CloseEvent.h
r95931 r98044 51 51 class CloseEvent : public Event { 52 52 public: 53 virtual bool isCloseEvent() const { return true; }54 55 53 static PassRefPtr<CloseEvent> create() 56 54 { … … 79 77 String reason() const { return m_reason; } 80 78 79 virtual const AtomicString& interfaceName() const { return eventNames().interfaceForCloseEvent; } 80 81 81 private: 82 82 CloseEvent() -
trunk/Source/WebCore/xml/XMLHttpRequestProgressEvent.h
r95901 r98044 28 28 #define XMLHttpRequestProgressEvent_h 29 29 30 #include "EventNames.h" 30 31 #include "ProgressEvent.h" 31 32 … … 47 48 unsigned long long totalSize() const { return total(); } 48 49 50 virtual const AtomicString& interfaceName() const { return eventNames().interfaceForXMLHttpRequestProgressEvent; } 51 49 52 private: 50 virtual bool isXMLHttpRequestProgressEvent() const { return true; }51 52 53 XMLHttpRequestProgressEvent() { } 53 54 XMLHttpRequestProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total) -
trunk/Source/WebKit/chromium/src/WebDOMEvent.cpp
r95901 r98044 33 33 34 34 #include "Event.h" 35 #include "EventNames.h" 35 36 #include "Node.h" 36 37 #include <wtf/PassRefPtr.h> … … 184 185 { 185 186 ASSERT(m_private); 186 return m_private->i sPopStateEvent();187 return m_private->interfaceName() == WebCore::eventNames().interfaceForPopStateEvent; 187 188 } 188 189 … … 196 197 { 197 198 ASSERT(m_private); 198 return m_private->i sXMLHttpRequestProgressEvent();199 return m_private->interfaceName() == WebCore::eventNames().interfaceForXMLHttpRequestProgressEvent; 199 200 } 200 201 … … 202 203 { 203 204 ASSERT(m_private); 204 return m_private->i sWebKitAnimationEvent();205 return m_private->interfaceName() == WebCore::eventNames().interfaceForWebKitAnimationEvent; 205 206 } 206 207 … … 208 209 { 209 210 ASSERT(m_private); 210 return m_private->i sWebKitTransitionEvent();211 return m_private->interfaceName() == WebCore::eventNames().interfaceForWebKitTransitionEvent; 211 212 } 212 213
Note: See TracChangeset
for help on using the changeset viewer.