EventTarget.h shouldn't need to know about every feature and ifdef
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 20:44:03 +0000 (20:44 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 20:44:03 +0000 (20:44 +0000)
commita3a0836f03fece8c76a63f3ca02564f6b120f616
tree74c6d0c922e93353683b220496a2682162b58da3
parent955fd5500cb16a505f1695f5a55a109c4e7540bd
EventTarget.h shouldn't need to know about every feature and ifdef
https://bugs.webkit.org/show_bug.cgi?id=70659

Reviewed by Darin Adler.

Source/WebCore:

This patch follows the approach of Event.h and introduces an
interfaceName virtual function that returns the name of the DOM
interface for the concrete type of the object.  This function lets us
remove a large number of fake dynamic casts.

* CMakeLists.txt:
* CodeGenerators.pri:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.gyp/scripts/action_makenames.py:
    - Teach action_makenames how to handle the new "in" file.
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEventTarget.cpp:
(WebCore::toJS):
    - Use the new autogenerated macro to remove a large amount of
      feature-specific code.
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::initScript):
* bindings/objc/DOM.mm:
(kit):
    - The SVGElementInstance branch was never taken previously because
      SVGElementInstance::toNode returns a non-NULL value. This code
      was introduced in http://trac.webkit.org/changeset/42618 and
      doesn't appear to have ever worked as the author intended.
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::convertEventTargetToV8Object):
    - Use the new autogenerated macro to remove a large amount of
      feature-specific code.
* dom/EventNames.cpp:
(WebCore::EventNames::EventNames):
* dom/EventNames.h:
* dom/EventTarget.cpp:
* dom/EventTarget.h:
* dom/EventTargetFactory.in: Added.
    - Add a new "in" file that lists all the EventTargets.
* dom/LocalMediaStream.cpp:
(WebCore::LocalMediaStream::interfaceName):
* dom/LocalMediaStream.h:
* dom/MediaStream.cpp:
(WebCore::MediaStream::interfaceName):
* dom/MediaStream.h:
* dom/MessagePort.cpp:
(WebCore::MessagePort::interfaceName):
* dom/MessagePort.h:
* dom/Node.cpp:
(WebCore::Node::toNode):
(WebCore::Node::interfaceName):
* dom/Node.h:
* dom/make_event_factory.pl:
    - Generalize make_event_factory.pl to be able to generate
      interfaces for different namespaces.
* fileapi/FileReader.cpp:
(WebCore::FileReader::interfaceName):
* fileapi/FileReader.h:
* fileapi/FileWriter.cpp:
(WebCore::FileWriter::interfaceName):
* fileapi/FileWriter.h:
* loader/appcache/DOMApplicationCache.cpp:
(WebCore::DOMApplicationCache::interfaceName):
* loader/appcache/DOMApplicationCache.h:
* notifications/Notification.cpp:
(WebCore::Notification::interfaceName):
* notifications/Notification.h:
(WebCore::Notification::scriptExecutionContext):
* p2p/PeerConnection.cpp:
(WebCore::PeerConnection::interfaceName):
* p2p/PeerConnection.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::interfaceName):
(WebCore::DOMWindow::toDOMWindow):
* page/DOMWindow.h:
* page/EventSource.cpp:
(WebCore::EventSource::interfaceName):
* page/EventSource.h:
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::interfaceName):
* storage/IDBDatabase.h:
* storage/IDBRequest.cpp:
(WebCore::IDBRequest::interfaceName):
* storage/IDBRequest.h:
* storage/IDBTransaction.cpp:
(WebCore::IDBTransaction::interfaceName):
* storage/IDBTransaction.h:
* storage/IDBVersionChangeRequest.cpp:
(WebCore::IDBVersionChangeRequest::interfaceName):
* storage/IDBVersionChangeRequest.h:
* svg/SVGElementInstance.cpp:
(WebCore::SVGElementInstance::interfaceName):
* svg/SVGElementInstance.h:
(WebCore::SVGElementInstance::toNode):
* webaudio/AudioContext.cpp:
(WebCore::AudioContext::interfaceName):
(WebCore::AudioContext::scriptExecutionContext):
* webaudio/AudioContext.h:
* webaudio/JavaScriptAudioNode.cpp:
(WebCore::JavaScriptAudioNode::interfaceName):
* webaudio/JavaScriptAudioNode.h:
* websockets/WebSocket.cpp:
(WebCore::WebSocket::interfaceName):
* websockets/WebSocket.h:
* workers/DedicatedWorkerContext.cpp:
(WebCore::DedicatedWorkerContext::interfaceName):
* workers/DedicatedWorkerContext.h:
* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerConnectTask::performTask):
* workers/SharedWorker.cpp:
(WebCore::SharedWorker::interfaceName):
* workers/SharedWorker.h:
* workers/SharedWorkerContext.cpp:
(WebCore::SharedWorkerContext::interfaceName):
* workers/SharedWorkerContext.h:
* workers/Worker.cpp:
(WebCore::Worker::interfaceName):
* workers/Worker.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::interfaceName):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequestUpload.cpp:
(WebCore::XMLHttpRequestUpload::interfaceName):
* xml/XMLHttpRequestUpload.h:

Source/WebKit/chromium:

This cast isn't needed because dispatchEvent is a virtual function.

* src/WebSharedWorkerImpl.cpp:
(WebKit::WebSharedWorkerImpl::connectTask):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
75 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/CodeGenerators.pri
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gyp/scripts/action_makenames.py
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSEventTarget.cpp
Source/WebCore/bindings/js/WorkerScriptController.cpp
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/bindings/v8/V8DOMWrapper.cpp
Source/WebCore/dom/EventNames.cpp
Source/WebCore/dom/EventNames.h
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/EventTargetFactory.in [new file with mode: 0644]
Source/WebCore/dom/MessagePort.cpp
Source/WebCore/dom/MessagePort.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/make_event_factory.pl
Source/WebCore/fileapi/FileReader.cpp
Source/WebCore/fileapi/FileReader.h
Source/WebCore/fileapi/FileWriter.cpp
Source/WebCore/fileapi/FileWriter.h
Source/WebCore/loader/appcache/DOMApplicationCache.cpp
Source/WebCore/loader/appcache/DOMApplicationCache.h
Source/WebCore/mediastream/LocalMediaStream.cpp
Source/WebCore/mediastream/LocalMediaStream.h
Source/WebCore/mediastream/MediaStream.cpp
Source/WebCore/mediastream/MediaStream.h
Source/WebCore/mediastream/PeerConnection.cpp
Source/WebCore/mediastream/PeerConnection.h
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/Notification.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/EventSource.h
Source/WebCore/storage/IDBDatabase.cpp
Source/WebCore/storage/IDBDatabase.h
Source/WebCore/storage/IDBRequest.cpp
Source/WebCore/storage/IDBRequest.h
Source/WebCore/storage/IDBTransaction.cpp
Source/WebCore/storage/IDBTransaction.h
Source/WebCore/storage/IDBVersionChangeRequest.cpp
Source/WebCore/storage/IDBVersionChangeRequest.h
Source/WebCore/svg/SVGElementInstance.cpp
Source/WebCore/svg/SVGElementInstance.h
Source/WebCore/webaudio/AudioContext.cpp
Source/WebCore/webaudio/AudioContext.h
Source/WebCore/webaudio/JavaScriptAudioNode.cpp
Source/WebCore/webaudio/JavaScriptAudioNode.h
Source/WebCore/websockets/WebSocket.cpp
Source/WebCore/websockets/WebSocket.h
Source/WebCore/workers/DedicatedWorkerContext.cpp
Source/WebCore/workers/DedicatedWorkerContext.h
Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
Source/WebCore/workers/SharedWorker.cpp
Source/WebCore/workers/SharedWorker.h
Source/WebCore/workers/SharedWorkerContext.cpp
Source/WebCore/workers/SharedWorkerContext.h
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/Worker.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebCore/xml/XMLHttpRequestUpload.cpp
Source/WebCore/xml/XMLHttpRequestUpload.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
Source/cmake/WebKitMacros.cmake