Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (97932 => 97933)
--- trunk/Source/WebCore/CMakeLists.txt 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/CMakeLists.txt 2011-10-20 04:50:14 UTC (rev 97933)
@@ -2349,6 +2349,10 @@
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/HTMLNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/HTMLElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JSHTMLElementWrapperFactory.cpp)
+GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventFactory.in)
+LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventFactory.cpp)
+
+
GENERATE_FONT_NAMES(${WEBCORE_DIR}/css/WebKitFontFamilyNames.in)
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.cpp)
Modified: trunk/Source/WebCore/ChangeLog (97932 => 97933)
--- trunk/Source/WebCore/ChangeLog 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/ChangeLog 2011-10-20 04:50:14 UTC (rev 97933)
@@ -1,3 +1,33 @@
+2011-10-19 Adam Barth <[email protected]>
+
+ Document.cpp shouldn't need to know about every event for every feature
+ https://bugs.webkit.org/show_bug.cgi?id=70469
+
+ Reviewed by Eric Seidel.
+
+ make_event_factory.pl generates the implementation of EventFactory
+ based on a simple ".in" file.
+
+ * CodeGenerators.pri:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gyp/scripts/action_makenames.py:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/Document.cpp:
+ (WebCore::Document::createEvent):
+ * dom/EventFactory.h: Added.
+ * dom/EventFactory.in: Added.
+ * dom/make_event_factory.pl: Added.
+ (defaultEventPropertyHash):
+ (eventHandler):
+ (parametersHandler):
+ (readNames):
+ (readEvents):
+ (interfaceForEvent):
+ (printCppFile):
+ (printLicenseHeader):
+
2011-10-19 Kentaro Hara <[email protected]>
Added a ConstructorMode check to all existing custom V8 constructors.
Modified: trunk/Source/WebCore/CodeGenerators.pri (97932 => 97933)
--- trunk/Source/WebCore/CodeGenerators.pri 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/CodeGenerators.pri 2011-10-20 04:50:14 UTC (rev 97933)
@@ -32,6 +32,8 @@
HTML_ENTITIES = $$PWD/html/parser/HTMLEntityNames.in
+EVENT_FACTORY = $$PWD/dom/EventFactory.in
+
COLORDATA_GPERF = $$PWD/platform/ColorData.gperf
WALDOCSSPROPS = $$PWD/css/CSSPropertyNames.in
@@ -779,6 +781,14 @@
entities.depends = $$PWD/dom/make_names.pl $$FONT_NAMES
addExtraCompiler(fontnames)
+# GENERATOR 5-E:
+eventfactory.output = $${WC_GENERATED_SOURCES_DIR}/EventFactory.cpp
+xmlnsnames.input = EVENT_FACTORY
+eventfactory.wkScript = $$PWD/dom/make_event_factory.pl
+eventfactory.commands = perl -I$$PWD/bindings/scripts $$fontnames.wkScript --events $$EVENT_FACTORY --outputDir $$WC_GENERATED_SOURCES_DIR
+entities.depends = $$PWD/dom/make_event_factory.pl $$EVENT_FACTORY
+addExtraCompiler(eventfactory)
+
# GENERATOR 8-A:
entities.output = $${WC_GENERATED_SOURCES_DIR}/HTMLEntityTable.cpp
entities.input = HTML_ENTITIES
Modified: trunk/Source/WebCore/DerivedSources.make (97932 => 97933)
--- trunk/Source/WebCore/DerivedSources.make 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/DerivedSources.make 2011-10-20 04:50:14 UTC (rev 97933)
@@ -599,6 +599,7 @@
CSSPropertyNames.h \
CSSValueKeywords.h \
ColorData.cpp \
+ EventFactory.cpp \
HTMLElementFactory.cpp \
HTMLEntityTable.cpp \
HTMLNames.cpp \
@@ -859,6 +860,13 @@
# --------
+# Register event constructors
+
+EventFactory.cpp : dom/make_event_factory.pl dom/EventFactory.in
+ perl -I $(WebCore)/bindings/scripts $< --events $(WebCore)/dom/EventFactory.in
+
+# --------
+
# MathML tag and attribute names, and element factory
MathMLElementFactory.cpp MathMLNames.cpp : dom/make_names.pl mathml/mathtags.in mathml/mathattrs.in
Modified: trunk/Source/WebCore/GNUmakefile.am (97932 => 97933)
--- trunk/Source/WebCore/GNUmakefile.am 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/GNUmakefile.am 2011-10-20 04:50:14 UTC (rev 97933)
@@ -681,6 +681,9 @@
DerivedSources/WebCore/XMLNames.cpp DerivedSources/WebCore/XMLNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlattrs.in
$(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES_WEBCORE)"
+DerivedSources/WebCore/EventFactory.cpp: $(WebCore)/dom/make_event_factory.pl $(WebCore)/dom/EventFactory.in
+ $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --events $(WebCore)/xml/EventFactory.in --outputDir "$(GENSOURCES_WEBCORE)"
+
# All Web Inspector generated files are created with this one call to CodeGeneratorInspector.pm
DerivedSources/WebCore/InspectorProtocolVersion.h : $(WebCore)/inspector/Inspector.json $(WebCore)/inspector/generate-inspector-protocol-version
$(PYTHON) $(WebCore)/inspector/generate-inspector-protocol-version -o $(GENSOURCES_WEBCORE)/InspectorProtocolVersion.h $(WebCore)/inspector/Inspector.json
Modified: trunk/Source/WebCore/GNUmakefile.list.am (97932 => 97933)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-10-20 04:50:14 UTC (rev 97933)
@@ -9,6 +9,7 @@
DerivedSources/WebCore/CSSValueKeywords.h \
DerivedSources/WebCore/CSSValueKeywords.cpp \
DerivedSources/WebCore/ColorData.cpp \
+ DerivedSources/WebCore/EventFactory.cpp \
DerivedSources/WebCore/HTMLElementFactory.cpp \
DerivedSources/WebCore/HTMLElementFactory.h \
DerivedSources/WebCore/HTMLEntityTable.cpp \
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (97932 => 97933)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-10-20 04:50:14 UTC (rev 97933)
@@ -700,6 +700,23 @@
],
},
{
+ 'action_name': 'EventFactory',
+ 'inputs': [
+ '../dom/make_event_factory.pl',
+ '../dom/EventFactory.in',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/EventFactory.cpp',
+ ],
+ 'action': [
+ 'python',
+ 'scripts/action_makenames.py',
+ '<@(_outputs)',
+ '--',
+ '<@(_inputs)',
+ ],
+ },
+ {
'action_name': 'MathMLNames',
'inputs': [
'../dom/make_names.pl',
@@ -1014,6 +1031,7 @@
# Additional .cpp files from webcore_bindings_sources actions.
'<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/EventFactory.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp',
Modified: trunk/Source/WebCore/WebCore.gyp/scripts/action_makenames.py (97932 => 97933)
--- trunk/Source/WebCore/WebCore.gyp/scripts/action_makenames.py 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/WebCore.gyp/scripts/action_makenames.py 2011-10-20 04:50:14 UTC (rev 97933)
@@ -109,6 +109,7 @@
makeNamesInput = None
tagInput = None
attrInput = None
+ eventsInput = None
for input in inputs:
# Make input pathnames absolute so they can be accessed after changing
# directory. On Windows, convert \ to / for inputs to the perl script to
@@ -116,7 +117,8 @@
inputAbs = os.path.abspath(input)
inputAbsPosix = inputAbs.replace(os.path.sep, posixpath.sep)
inputBasename = os.path.basename(input)
- if inputBasename == 'make_names.pl':
+ if inputBasename == 'make_names.pl' \
+ or inputBasename == 'make_event_factory.pl':
assert makeNamesInput == None
makeNamesInput = inputAbs
elif inputBasename.endswith('TagNames.in') \
@@ -127,13 +129,15 @@
or inputBasename.endswith('attrs.in'):
assert attrInput == None
attrInput = inputAbsPosix
+ elif inputBasename.endswith('EventFactory.in'):
+ eventsInput = inputAbsPosix
elif inputBasename.endswith('Names.in'):
options.append(inputAbsPosix)
else:
assert False
assert makeNamesInput != None
- assert tagInput != None or attrInput != None or ('--fonts' in options)
+ assert tagInput != None or attrInput != None or eventsInput != None or ('--fonts' in options)
# scriptsPath is a Perl include directory, located relative to
# makeNamesInput.
@@ -150,6 +154,8 @@
command.extend(['--tags', tagInput])
if attrInput != None:
command.extend(['--attrs', attrInput])
+ if eventsInput != None:
+ command.extend(['--events', eventsInput])
command.extend(options)
# Do it. check_call is new in 2.5, so simulate its behavior with call and
Modified: trunk/Source/WebCore/WebCore.gypi (97932 => 97933)
--- trunk/Source/WebCore/WebCore.gypi 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/WebCore.gypi 2011-10-20 04:50:14 UTC (rev 97933)
@@ -7045,6 +7045,7 @@
'<(PRODUCT_DIR)/DerivedSources/WebCore/DOMXPathResultInternal.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/DebuggerScriptSource.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/DocTypeStrings.cpp',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/EventFactory.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLElementFactory.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLElementFactory.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/HTMLEntityTable.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (97932 => 97933)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-10-20 04:50:14 UTC (rev 97933)
@@ -542,6 +542,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\EventFactory.cpp"
+ >
+ </File>
+ <File
RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\HTMLElementFactory.h"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (97932 => 97933)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-10-20 04:50:14 UTC (rev 97933)
@@ -3234,6 +3234,8 @@
975CA28B130365F800E99AD9 /* Crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 975CA288130365F800E99AD9 /* Crypto.h */; };
975CA2A11303679D00E99AD9 /* JSCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 975CA29F1303679D00E99AD9 /* JSCrypto.cpp */; };
975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 975CA2A01303679D00E99AD9 /* JSCrypto.h */; };
+ 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; };
+ 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; };
976D6C77122B8A3D001FD1F7 /* AsyncFileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C58122B8A3D001FD1F7 /* AsyncFileWriter.h */; };
976D6C78122B8A3D001FD1F7 /* Blob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C59122B8A3D001FD1F7 /* Blob.cpp */; };
976D6C79122B8A3D001FD1F7 /* Blob.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C5A122B8A3D001FD1F7 /* Blob.h */; };
@@ -10421,6 +10423,8 @@
975CA289130365F800E99AD9 /* Crypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Crypto.idl; sourceTree = "<group>"; };
975CA29F1303679D00E99AD9 /* JSCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCrypto.cpp; sourceTree = "<group>"; };
975CA2A01303679D00E99AD9 /* JSCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCrypto.h; sourceTree = "<group>"; };
+ 97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; };
+ 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; };
976D6C58122B8A3D001FD1F7 /* AsyncFileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AsyncFileWriter.h; path = fileapi/AsyncFileWriter.h; sourceTree = "<group>"; };
976D6C59122B8A3D001FD1F7 /* Blob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Blob.cpp; path = fileapi/Blob.cpp; sourceTree = "<group>"; };
976D6C5A122B8A3D001FD1F7 /* Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Blob.h; path = fileapi/Blob.h; sourceTree = "<group>"; };
@@ -15271,6 +15275,7 @@
E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */,
6565814709D13043000E61D7 /* CSSValueKeywords.gperf */,
6565814809D13043000E61D7 /* CSSValueKeywords.h */,
+ 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */,
A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */,
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */,
A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */,
@@ -21119,6 +21124,7 @@
418A06CE133C04D500CD379C /* EventDispatcher.h */,
BC60D9090D2A17CE00B9918F /* EventException.h */,
BC60D90A0D2A17CE00B9918F /* EventException.idl */,
+ 97665011144FAA4200F6BB51 /* EventFactory.h */,
935FBC4409BA00B900E230B1 /* EventListener.h */,
85AFA7410AAF298400E84305 /* EventListener.idl */,
AD4495F1141FC08900541EDF /* EventListenerMap.cpp */,
@@ -24687,6 +24693,7 @@
71CCB49D144824AC00C676D6 /* ImageBySizeCache.h in Headers */,
0753860314489E9800B78452 /* CachedCues.h in Headers */,
8AA61D00144D595B00F37350 /* CSSRegionStyleRule.h in Headers */,
+ 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */,
A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */,
A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */,
);
@@ -27549,6 +27556,7 @@
71CCB49C144824AC00C676D6 /* ImageBySizeCache.cpp in Sources */,
0753860214489E9800B78452 /* CachedCues.cpp in Sources */,
8AA61CFF144D595B00F37350 /* CSSRegionStyleRule.cpp in Sources */,
+ 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */,
A0EE0DF5144F825500F80B0D /* WebGLDebugRendererInfo.cpp in Sources */,
A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */,
);
Modified: trunk/Source/WebCore/dom/Document.cpp (97932 => 97933)
--- trunk/Source/WebCore/dom/Document.cpp 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-10-20 04:50:14 UTC (rev 97933)
@@ -31,7 +31,6 @@
#include "AnimationController.h"
#include "Attr.h"
#include "Attribute.h"
-#include "BeforeLoadEvent.h"
#include "CDATASection.h"
#include "CSSPrimitiveValueCache.h"
#include "CSSStyleSelector.h"
@@ -42,16 +41,12 @@
#include "Chrome.h"
#include "ChromeClient.h"
#include "Comment.h"
-#include "CompositionEvent.h"
#include "Console.h"
#include "ContentSecurityPolicy.h"
#include "CookieJar.h"
-#include "CustomEvent.h"
#include "DOMImplementation.h"
#include "DOMWindow.h"
#include "DateComponents.h"
-#include "DeviceMotionEvent.h"
-#include "DeviceOrientationEvent.h"
#include "DocumentFragment.h"
#include "DocumentLoader.h"
#include "DocumentMarkerController.h"
@@ -60,8 +55,8 @@
#include "Editor.h"
#include "Element.h"
#include "EntityReference.h"
-#include "ErrorEvent.h"
#include "Event.h"
+#include "EventFactory.h"
#include "EventHandler.h"
#include "EventListener.h"
#include "EventNames.h"
@@ -75,6 +70,7 @@
#include "FrameSelection.h"
#include "FrameTree.h"
#include "FrameView.h"
+#include "HashChangeEvent.h"
#include "HTMLAllCollection.h"
#include "HTMLAnchorElement.h"
#include "HTMLBodyElement.h"
@@ -94,33 +90,26 @@
#include "HTMLStyleElement.h"
#include "HTMLTitleElement.h"
#include "HTTPParsers.h"
-#include "HashChangeEvent.h"
#include "HitTestRequest.h"
#include "HitTestResult.h"
#include "ImageLoader.h"
#include "InspectorInstrumentation.h"
-#include "KeyboardEvent.h"
#include "Logging.h"
#include "MediaQueryList.h"
#include "MediaQueryMatcher.h"
-#include "MessageEvent.h"
-#include "MouseEvent.h"
#include "MouseEventWithHitTestResults.h"
-#include "MutationEvent.h"
#include "NameNodeList.h"
#include "NestingLevelIncrementer.h"
#include "NewXMLDocumentParser.h"
#include "NodeFilter.h"
#include "NodeIterator.h"
#include "NodeWithIndex.h"
-#include "OverflowEvent.h"
#include "Page.h"
#include "PageGroup.h"
#include "PageTransitionEvent.h"
#include "PlatformKeyboardEvent.h"
#include "PopStateEvent.h"
#include "ProcessingInstruction.h"
-#include "ProgressEvent.h"
#include "RegisteredEventListener.h"
#include "RenderArena.h"
#include "RenderLayer.h"
@@ -139,21 +128,14 @@
#include "Settings.h"
#include "ShadowRoot.h"
#include "StaticHashSetNodeList.h"
-#include "StorageEvent.h"
#include "StyleSheetList.h"
-#include "TextEvent.h"
#include "TextResourceDecoder.h"
#include "Timer.h"
#include "TransformSource.h"
#include "TreeWalker.h"
-#include "UIEvent.h"
#include "UserContentURLPattern.h"
-#include "WebKitAnimationEvent.h"
-#include "WebKitTransitionEvent.h"
-#include "WheelEvent.h"
#include "XMLDocumentParser.h"
#include "XMLHttpRequest.h"
-#include "XMLHttpRequestProgressEvent.h"
#include "XMLNSNames.h"
#include "XMLNames.h"
#include "XPathEvaluator.h"
@@ -181,14 +163,9 @@
#include "SVGElementFactory.h"
#include "SVGNames.h"
#include "SVGStyleElement.h"
-#include "SVGZoomEvent.h"
#endif
#if ENABLE(TOUCH_EVENTS)
-#if USE(V8)
-#include "RuntimeEnabledFeatures.h"
-#endif
-#include "TouchEvent.h"
#include "TouchList.h"
#endif
@@ -207,27 +184,6 @@
#include "ScriptedAnimationController.h"
#endif
-#if ENABLE(WEB_AUDIO)
-#include "AudioProcessingEvent.h"
-#include "OfflineAudioCompletionEvent.h"
-#endif
-
-#if ENABLE(MEDIA_STREAM)
-#include "MediaStreamEvent.h"
-#endif
-
-#if ENABLE(INPUT_SPEECH)
-#include "SpeechInputEvent.h"
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-#include "CloseEvent.h"
-#endif
-
-#if ENABLE(WEBGL)
-#include "WebGLContextEvent.h"
-#endif
-
#if ENABLE(MICRODATA)
#include "MicroDataItemList.h"
#include "NodeRareData.h"
@@ -3487,95 +3443,7 @@
PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
{
- RefPtr<Event> event;
- if (eventType == "Event" || eventType == "Events" || eventType == "HTMLEvents")
- event = Event::create();
- else if (eventType == "BeforeLoadEvent")
- event = BeforeLoadEvent::create();
- else if (eventType == "CompositionEvent")
- event = CompositionEvent::create();
- else if (eventType == "CustomEvent")
- event = CustomEvent::create();
- else if (eventType == "ErrorEvent")
- event = ErrorEvent::create();
- else if (eventType == "HashChangeEvent")
- event = HashChangeEvent::create();
- else if (eventType == "KeyboardEvent" || eventType == "KeyboardEvents")
- event = KeyboardEvent::create();
- else if (eventType == "MessageEvent")
- event = MessageEvent::create();
- else if (eventType == "MouseEvent" || eventType == "MouseEvents")
- event = MouseEvent::create();
- else if (eventType == "MutationEvent" || eventType == "MutationEvents")
- event = MutationEvent::create();
- else if (eventType == "OverflowEvent")
- event = OverflowEvent::create();
- else if (eventType == "PageTransitionEvent")
- event = PageTransitionEvent::create();
- else if (eventType == "PopStateEvent")
- event = PopStateEvent::create();
- else if (eventType == "ProgressEvent")
- event = ProgressEvent::create();
- else if (eventType == "TextEvent")
- event = TextEvent::create();
- else if (eventType == "UIEvent" || eventType == "UIEvents")
- event = UIEvent::create();
- else if (eventType == "WebKitAnimationEvent")
- event = WebKitAnimationEvent::create();
- else if (eventType == "WebKitTransitionEvent")
- event = WebKitTransitionEvent::create();
- else if (eventType == "WheelEvent")
- event = WheelEvent::create();
- else if (eventType == "XMLHttpRequestProgressEvent")
- event = XMLHttpRequestProgressEvent::create();
-#if ENABLE(WEB_AUDIO)
- else if (eventType == "AudioProcessingEvent")
- event = AudioProcessingEvent::create();
- else if (eventType == "OfflineAudioCompletionEvent")
- event = OfflineAudioCompletionEvent::create();
-#endif
-#if ENABLE(MEDIA_STREAM)
- else if (eventType == "MediaStreamEvent")
- event = MediaStreamEvent::create();
-#endif
-#if ENABLE(INPUT_SPEECH)
- else if (eventType == "SpeechInputEvent")
- event = SpeechInputEvent::create();
-#endif
-#if ENABLE(WEB_SOCKETS)
- else if (eventType == "CloseEvent")
- event = CloseEvent::create();
-#endif
-#if ENABLE(WEBGL)
- else if (eventType == "WebGLContextEvent")
- event = WebGLContextEvent::create();
-#endif
- else if (eventType == "StorageEvent")
- event = StorageEvent::create();
-#if ENABLE(SVG)
- else if (eventType == "SVGEvents")
- event = Event::create();
- else if (eventType == "SVGZoomEvent" || eventType == "SVGZoomEvents")
- event = SVGZoomEvent::create();
-#endif
-#if ENABLE(TOUCH_EVENTS)
-#if USE(V8)
- else if (eventType == "TouchEvent" && RuntimeEnabledFeatures::touchEnabled())
-#else
- else if (eventType == "TouchEvent")
-#endif
- event = TouchEvent::create();
-#endif
-#if ENABLE(DEVICE_ORIENTATION)
- else if (eventType == "DeviceMotionEvent")
- event = DeviceMotionEvent::create();
- else if (eventType == "DeviceOrientationEvent")
- event = DeviceOrientationEvent::create();
-#endif
-#if ENABLE(ORIENTATION_EVENTS)
- else if (eventType == "OrientationEvent")
- event = Event::create();
-#endif
+ RefPtr<Event> event = EventFactory::create(eventType);
if (event)
return event.release();
Added: trunk/Source/WebCore/dom/EventFactory.h (0 => 97933)
--- trunk/Source/WebCore/dom/EventFactory.h (rev 0)
+++ trunk/Source/WebCore/dom/EventFactory.h 2011-10-20 04:50:14 UTC (rev 97933)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EventFactory_h
+#define EventFactory_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class Event;
+
+class EventFactory {
+public:
+ static PassRefPtr<Event> create(const String& eventType);
+};
+
+}
+
+#endif
Added: trunk/Source/WebCore/dom/EventFactory.in (0 => 97933)
--- trunk/Source/WebCore/dom/EventFactory.in (rev 0)
+++ trunk/Source/WebCore/dom/EventFactory.in 2011-10-20 04:50:14 UTC (rev 97933)
@@ -0,0 +1,42 @@
+namespace="Event"
+
+Event
+Events interfaceName=Event
+HTMLEvents interfaceName=Event
+BeforeLoadEvent
+CompositionEvent
+CustomEvent
+ErrorEvent
+HashChangeEvent
+KeyboardEvent
+KeyboardEvents interfaceName=KeyboardEvent
+MessageEvent
+MouseEvent
+MouseEvents interfaceName=MouseEvent
+MutationEvent
+MutationEvents interfaceName=MutationEvent
+OverflowEvent
+PageTransitionEvent
+PopStateEvent
+ProgressEvent
+TextEvent
+UIEvent
+UIEvents interfaceName=UIEvent
+WebKitAnimationEvent
+WebKitTransitionEvent
+WheelEvent
+XMLHttpRequestProgressEvent
+AudioProcessingEvent conditional=WEB_AUDIO
+OfflineAudioCompletionEvent conditional=WEB_AUDIO
+MediaStreamEvent conditional=MEDIA_STREAM
+SpeechInputEvent conditional=INPUT_SPEECH
+CloseEvent conditional=WEB_SOCKETS
+WebGLContextEvent conditional=WEBGL
+StorageEvent
+SVGEvents interfaceName=Event, conditional=SVG
+SVGZoomEvent conditional=SVG
+SVGZoomEvents interfaceName=SVGZoomEvent, conditional=SVG
+TouchEvent conditional=TOUCH_EVENTS
+DeviceMotionEvent conditional=DEVICE_ORIENTATION
+DeviceOrientationEvent conditional=DEVICE_ORIENTATION
+OrientationEvent interfaceName=Event, conditional=ORIENTATION_EVENTS
Added: trunk/Source/WebCore/dom/make_event_factory.pl (0 => 97933)
--- trunk/Source/WebCore/dom/make_event_factory.pl (rev 0)
+++ trunk/Source/WebCore/dom/make_event_factory.pl 2011-10-20 04:50:14 UTC (rev 97933)
@@ -0,0 +1,205 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+# Copyright (C) 2009, Julien Chaffraix <[email protected]>
+# Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+# Copyright (C) 2011 Ericsson AB. All rights reserved.
+# Copyright (C) 2011 Google, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+
+use Config;
+use Getopt::Long;
+use File::Path;
+use File::Spec;
+use IO::File;
+use InFilesParser;
+
+sub readEvents($);
+
+my $eventsFile = "";
+my $outputDir = ".";
+my %parsedEvents = ();
+
+require Config;
+
+GetOptions(
+ 'events=s' => \$eventsFile,
+ 'outputDir=s' => \$outputDir,
+);
+
+mkpath($outputDir);
+
+die "You must specify --events <file>" unless length($eventsFile);
+
+my %events = %{readEvents($eventsFile)};
+
+printCppFile("$outputDir/EventFactory.cpp");
+
+sub defaultEventPropertyHash
+{
+ return (
+ 'interfaceName' => 0,
+ 'conditional' => 0
+ );
+}
+
+sub eventHandler($$$)
+{
+ my ($event, $property, $value) = @_;
+
+ $parsedEvents{$event} = { defaultEventPropertyHash($event) } if !defined($parsedEvents{$event});
+
+ if ($property) {
+ die "Unknown property $property for event $event\n" if !defined($parsedEvents{$event}{$property});
+ $parsedEvents{$event}{$property} = $value;
+ }
+}
+
+sub parametersHandler
+{
+ my ($parameter, $value) = @_;
+
+ die "Unknown parameter $parameter for events\n" unless $parameter eq "namespace";
+}
+
+sub readNames($$$)
+{
+ my ($namesFile, $hashToFillRef, $handler) = @_;
+
+ my $names = new IO::File;
+ open($names, $namesFile) or die "Failed to open file: $namesFile";
+
+ my $InParser = InFilesParser->new();
+ $InParser->parse($names, \¶metersHandler, $handler);
+
+ close($names);
+ die "Failed to read names from file: $namesFile" if (keys %{$hashToFillRef} == 0);
+ return $hashToFillRef;
+}
+
+sub readEvents($)
+{
+ my ($namesFile) = @_;
+ %parsedEvents = ();
+ return readNames($namesFile, \%parsedEvents, \&eventHandler);
+}
+
+sub interfaceForEvent($)
+{
+ my ($eventName) = @_;
+
+ my $interfaceName = $parsedEvents{$eventName}{"interfaceName"};
+ $interfaceName = $eventName unless $interfaceName;
+
+ return $interfaceName;
+}
+
+sub printCppFile
+{
+ my $cppPath = shift;
+ my $F;
+
+ open F, ">$cppPath";
+
+ printLicenseHeader($F);
+
+ print F "#include \"config.h\"\n";
+ print F "#include \"EventFactory.h\"\n\n";
+
+ my %includedInterfaces = ();
+
+ for my $eventName (sort keys %parsedEvents) {
+ my $conditional = $parsedEvents{$eventName}{"conditional"};
+ my $interfaceName = interfaceForEvent($eventName);
+
+ next if defined($includedInterfaces{$interfaceName});
+ $includedInterfaces{$interfaceName} = 1;
+
+ print F "#if ENABLE($conditional)\n" if $conditional;
+ print F "#include \"$interfaceName.h\"\n";
+ print F "#endif\n" if $conditional;
+ }
+
+ print F "\nnamespace WebCore {\n\n";
+
+ print F "PassRefPtr<Event> EventFactory::create(const String& eventType)\n";
+ print F "{\n";
+
+ for my $eventName (sort keys %parsedEvents) {
+ my $conditional = $parsedEvents{$eventName}{"conditional"};
+ my $interfaceName = interfaceForEvent($eventName);
+
+ print F "#if ENABLE($conditional)\n" if $conditional;
+ print F " if (eventType == \"$eventName\")\n";
+ print F " return ${interfaceName}::create();\n";
+ print F "#endif\n" if $conditional;
+ }
+
+ print F " return 0;\n";
+ print F "}\n";
+
+ print F "\n} // namespace WebCore\n";
+ close F;
+}
+
+sub printLicenseHeader($)
+{
+ my ($F) = @_;
+
+ print F "/*
+ * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
+ *
+ * This file was generated by the dom/make_events.pl script.
+ *
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+";
+}
+
Modified: trunk/Source/cmake/WebKitMacros.cmake (97932 => 97933)
--- trunk/Source/cmake/WebKitMacros.cmake 2011-10-20 04:43:44 UTC (rev 97932)
+++ trunk/Source/cmake/WebKitMacros.cmake 2011-10-20 04:50:14 UTC (rev 97933)
@@ -37,6 +37,19 @@
ENDMACRO ()
+MACRO (GENERATE_EVENT_FACTORY _infile)
+ SET(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
+ SET(_arguments --events ${_infile})
+ SET(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/EventFactory.cpp)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_outputfiles}
+ DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_infile}
+ COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${NAMES_GENERATOR} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments}
+ VERBATIM)
+ENDMACRO ()
+
+
MACRO (GENERATE_DOM_NAMES _namespace _attrs)
SET(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
SET(_arguments --attrs ${_attrs})