Commit c5e3f1b1 authored by ap@webkit.org's avatar ap@webkit.org
Browse files

Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=22030
        Make EventNames usable from multiple threads

        * platform/text/AtomicString.cpp:
        (WebCore::stringTable):
        (WebCore::AtomicString::add):
        (WebCore::AtomicString::remove):
        (WebCore::AtomicString::find):
        (WebCore::AtomicString::init):
        * platform/text/AtomicString.h:
        Atomic string table is now per-thread. Individual strings cannot be shared between threads,
        so global AtomicString constants cannot be used from threads other than the main one.

        * dom/EventNames.cpp:
        (WebCore::EventNames::EventNames):
        (WebCore::eventNames):
        (WebCore::EventNames::init):
        * dom/EventNames.h:
        Made EventNames a ThreadSpecific struct. Individual event names are now accessed as
        eventNames().fooEvent, not EventNames::fooEvent. This makes EventNames usable from all
        threads.

        * <Many files>: Access event names via eventNames() function.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a148926d
2008-11-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=22030
Make EventNames usable from multiple threads
* platform/text/AtomicString.cpp:
(WebCore::stringTable):
(WebCore::AtomicString::add):
(WebCore::AtomicString::remove):
(WebCore::AtomicString::find):
(WebCore::AtomicString::init):
* platform/text/AtomicString.h:
Atomic string table is now per-thread. Individual strings cannot be shared between threads,
so global AtomicString constants cannot be used from threads other than the main one.
* dom/EventNames.cpp:
(WebCore::EventNames::EventNames):
(WebCore::eventNames):
(WebCore::EventNames::init):
* dom/EventNames.h:
Made EventNames a ThreadSpecific struct. Individual event names are now accessed as
eventNames().fooEvent, not EventNames::fooEvent. This makes EventNames usable from all
threads.
* WebCore.base.exp:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSEventListener.cpp:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::processingUserGesture):
* dom/BeforeTextInsertedEvent.cpp:
(WebCore::BeforeTextInsertedEvent::BeforeTextInsertedEvent):
* dom/BeforeUnloadEvent.cpp:
(WebCore::BeforeUnloadEvent::BeforeUnloadEvent):
* dom/CharacterData.cpp:
(WebCore::CharacterData::dispatchModifiedEvent):
* dom/ContainerNode.cpp:
(WebCore::dispatchChildInsertionEvents):
(WebCore::dispatchChildRemovalEvents):
* dom/DedicatedWorker.cpp:
(WebCore::DedicatedWorker::dispatchErrorEvent):
* dom/Document.cpp:
(WebCore::Document::implicitClose):
(WebCore::Document::setFocusedNode):
(WebCore::Document::addListenerTypeIfNeeded):
(WebCore::Document::removeWindowInlineEventListenerForType):
(WebCore::Document::addWindowEventListener):
(WebCore::Document::removeWindowEventListener):
(WebCore::Document::finishedParsing):
* dom/EventTargetNode.cpp:
(WebCore::EventTargetNode::dispatchGenericEvent):
(WebCore::EventTargetNode::dispatchSubtreeModifiedEvent):
(WebCore::EventTargetNode::dispatchWindowEvent):
(WebCore::EventTargetNode::dispatchUIEvent):
(WebCore::EventTargetNode::dispatchSimulatedClick):
(WebCore::EventTargetNode::dispatchMouseEvent):
(WebCore::EventTargetNode::dispatchFocusEvent):
(WebCore::EventTargetNode::dispatchBlurEvent):
(WebCore::EventTargetNode::defaultEventHandler):
(WebCore::EventTargetNode::on*): (multiple methods)
(WebCore::EventTargetNode::setOn*): (multiple methods)
* dom/KeyboardEvent.cpp:
(WebCore::eventTypeForKeyboardEventType):
(WebCore::KeyboardEvent::keyCode):
(WebCore::KeyboardEvent::charCode):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
* dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchMessages):
(WebCore::MessagePort::dispatchCloseEvent):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::isDragEvent):
(WebCore::MouseEvent::toElement):
(WebCore::MouseEvent::fromElement):
* dom/OverflowEvent.cpp:
(WebCore::OverflowEvent::OverflowEvent):
* dom/TextEvent.cpp:
(WebCore::TextEvent::TextEvent):
* dom/WebKitAnimationEvent.cpp:
(WebCore::WebKitAnimationEvent::WebKitAnimationEvent):
(WebCore::WebKitAnimationEvent::~WebKitAnimationEvent):
(WebCore::WebKitAnimationEvent::initWebKitAnimationEvent):
(WebCore::WebKitAnimationEvent::animationName):
(WebCore::WebKitAnimationEvent::elapsedTime):
* dom/WebKitTransitionEvent.cpp:
(WebCore::WebKitTransitionEvent::WebKitTransitionEvent):
(WebCore::WebKitTransitionEvent::~WebKitTransitionEvent):
(WebCore::WebKitTransitionEvent::initWebKitTransitionEvent):
(WebCore::WebKitTransitionEvent::propertyName):
(WebCore::WebKitTransitionEvent::elapsedTime):
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWheelEvent):
* dom/XMLTokenizerLibxml2.cpp:
* dom/XMLTokenizerQt.cpp:
* editing/DeleteButton.cpp:
(WebCore::DeleteButton::defaultEventHandler):
* editing/EditCommand.cpp:
* editing/Editor.cpp:
(WebCore::Editor::canDHTMLCut):
(WebCore::Editor::canDHTMLCopy):
(WebCore::Editor::canDHTMLPaste):
(WebCore::Editor::tryDHTMLCopy):
(WebCore::Editor::tryDHTMLCut):
(WebCore::Editor::tryDHTMLPaste):
(WebCore::dispatchEditableContentChangedEvents):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::ReplacementFragment):
* editing/SelectionController.cpp:
(WebCore::SelectionController::setFocused):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::defaultEventHandler):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::parseMappedAttribute):
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::parseMappedAttribute):
(WebCore::HTMLButtonElement::defaultEventHandler):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseMappedAttribute):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::onChange):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::handleLocalEvents):
(WebCore::HTMLFormElement::prepareSubmit):
(WebCore::HTMLFormElement::reset):
(WebCore::HTMLFormElement::parseMappedAttribute):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::parseMappedAttribute):
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::parseMappedAttribute):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseMappedAttribute):
* html/HTMLImageLoader.cpp:
(WebCore::HTMLImageLoader::dispatchLoadEvent):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseMappedAttribute):
(WebCore::HTMLInputElement::setValueFromRenderer):
(WebCore::HTMLInputElement::preDispatchEventHandler):
(WebCore::HTMLInputElement::postDispatchEventHandler):
(WebCore::HTMLInputElement::defaultEventHandler):
(WebCore::HTMLInputElement::onSearch):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::defaultEventHandler):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::load):
(WebCore::HTMLMediaElement::mediaPlayerNetworkStateChanged):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::progressEventTimerFired):
(WebCore::HTMLMediaElement::seek):
(WebCore::HTMLMediaElement::setDefaultPlaybackRate):
(WebCore::HTMLMediaElement::setPlaybackRate):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::documentWillBecomeInactive):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parseMappedAttribute):
* html/HTMLOptionElement.cpp:
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::parseMappedAttribute):
(WebCore::HTMLScriptElement::dispatchLoadEvent):
(WebCore::HTMLScriptElement::dispatchErrorEvent):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::parseMappedAttribute):
(WebCore::HTMLSelectElement::defaultEventHandler):
(WebCore::HTMLSelectElement::menuListDefaultEventHandler):
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::parseMappedAttribute):
(WebCore::HTMLTextAreaElement::defaultEventHandler):
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::notifyFinished):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
(WebCore::FrameLoader::canCachePage):
* loader/ImageDocument.cpp:
(WebCore::ImageEventListener::handleEvent):
* loader/ImageLoader.cpp:
* loader/MediaDocument.cpp:
(WebCore::MediaDocument::defaultEventHandler):
* loader/appcache/DOMApplicationCache.cpp:
(WebCore::DOMApplicationCache::callCheckingListener):
(WebCore::DOMApplicationCache::callErrorListener):
(WebCore::DOMApplicationCache::callNoUpdateListener):
(WebCore::DOMApplicationCache::callDownloadingListener):
(WebCore::DOMApplicationCache::callProgressListener):
(WebCore::DOMApplicationCache::callUpdateReadyListener):
(WebCore::DOMApplicationCache::callCachedListener):
* page/AccessibilityObject.cpp:
* page/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::mouseButtonListener):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::on*): (multiple methods)
(WebCore::DOMWindow::setOn*): (multiple methods)
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::updateDragAndDrop):
(WebCore::EventHandler::cancelDragAndDrop):
(WebCore::EventHandler::performDragAndDrop):
(WebCore::EventHandler::updateMouseEventTargetNode):
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::canMouseDownStartSelect):
(WebCore::EventHandler::canMouseDragExtendSelect):
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::dragSourceMovedTo):
(WebCore::EventHandler::dragSourceEndedAt):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::handleTextInputEvent):
* page/FocusController.cpp:
* page/Frame.cpp:
(WebCore::Frame::sendResizeEvent):
(WebCore::Frame::sendScrollEvent):
* page/Page.cpp:
(WebCore::networkStateChanged):
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::updateStateMachine):
(WebCore::AnimationBase::animationTimerCallbackFired):
(WebCore::AnimationBase::primeEventTimers):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::onAnimationEnd):
(WebCore::ImplicitAnimation::sendTransitionEvent):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::onAnimationStart):
(WebCore::KeyframeAnimation::onAnimationIteration):
(WebCore::KeyframeAnimation::onAnimationEnd):
(WebCore::KeyframeAnimation::sendAnimationEvent):
* page/gtk/EventHandlerGtk.cpp:
* page/mac/EventHandlerMac.mm:
(WebCore::isKeyboardOptionTab):
* page/mac/FrameMac.mm:
* page/qt/EventHandlerQt.cpp:
(WebCore::isKeyboardOptionTab):
* plugins/PluginView.cpp:
* plugins/gtk/PluginViewGtk.cpp:
* plugins/qt/PluginViewQt.cpp:
* plugins/win/PluginViewWin.cpp:
(WebCore::PluginView::handleKeyboardEvent):
(WebCore::PluginView::handleMouseEvent):
* rendering/MediaControlElements.cpp:
(WebCore::MediaControlMuteButtonElement::defaultEventHandler):
(WebCore::MediaControlPlayButtonElement::defaultEventHandler):
(WebCore::MediaControlSeekButtonElement::defaultEventHandler):
(WebCore::MediaControlTimelineElement::defaultEventHandler):
(WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::userResize):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollToOffset):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::valueChanged):
* rendering/RenderMedia.cpp:
(WebCore::RenderMedia::forwardEvent):
* rendering/RenderObject.cpp:
* rendering/RenderSlider.cpp:
(WebCore::HTMLSliderThumbElement::defaultEventHandler):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::forwardEvent):
(WebCore::RenderTextControl::selectionChanged):
* rendering/RenderWidget.cpp:
* rendering/TextControlInnerElements.cpp:
(WebCore::TextControlInnerTextElement::defaultEventHandler):
(WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
(WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
* storage/LocalStorageArea.cpp:
(WebCore::LocalStorageArea::dispatchStorageEvent):
* storage/SessionStorageArea.cpp:
(WebCore::SessionStorageArea::dispatchStorageEvent):
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::dispatchZoomEvent):
(WebCore::SVGDocument::dispatchScrollEvent):
* svg/SVGElement.cpp:
(WebCore::SVGElement::parseMappedAttribute):
(WebCore::hasLoadListener):
(WebCore::SVGElement::sendSVGLoadEventIfPossible):
* svg/SVGElementInstance.cpp:
(WebCore::SVGElementInstance::on*): (multiple methods)
(WebCore::SVGElementInstance::setOn*): (multiple methods)
* svg/SVGImageLoader.cpp:
(WebCore::SVGImageLoader::dispatchLoadEvent):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::parseMappedAttribute):
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::dispatchErrorEvent):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::dispatchReadyStateChangeEvent):
(WebCore::XMLHttpRequest::dispatchAbortEvent):
(WebCore::XMLHttpRequest::dispatchErrorEvent):
(WebCore::XMLHttpRequest::dispatchLoadEvent):
(WebCore::XMLHttpRequest::dispatchLoadStartEvent):
(WebCore::XMLHttpRequest::dispatchProgressEvent):
* xml/XMLHttpRequestUpload.cpp:
(WebCore::XMLHttpRequestUpload::dispatchAbortEvent):
(WebCore::XMLHttpRequestUpload::dispatchErrorEvent):
(WebCore::XMLHttpRequestUpload::dispatchLoadEvent):
(WebCore::XMLHttpRequestUpload::dispatchLoadStartEvent):
(WebCore::XMLHttpRequestUpload::dispatchProgressEvent):
* xml/XPathResult.cpp:
(WebCore::XPathResult::XPathResult):
(WebCore::XPathResult::~XPathResult):
(WebCore::XPathResult::invalidateIteratorState):
Access event names via eventNames() function.
2008-11-04 Cameron Zwarich <zwarich@apple.com>
 
Reviewed by Mark Rowe.
......
......@@ -127,14 +127,13 @@ __Z26ReportBlockedObjCExceptionP11NSException
__ZN7WebCore10CachedPage14documentLoaderEv
__ZN7WebCore10CachedPage22cachedPagePlatformDataEv
__ZN7WebCore10CachedPage25setCachedPagePlatformDataEPNS_22CachedPagePlatformDataE
__ZN7WebCore10EventNames10clickEventE
__ZN7WebCore10EventNames12keydownEventE
__ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbN3WTF10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_15EventTargetNodeEEENS5_INS_9ClipboardEEEb
__ZN7WebCore10ScrollView17setScrollbarModesENS_13ScrollbarModeES1_
__ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
__ZN7WebCore10StringImpl7replaceEtt
__ZN7WebCore10StringImplD1Ev
__ZN7WebCore10StringImplcvP8NSStringEv
__ZN7WebCore10eventNamesEv
__ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
__ZN7WebCore11EditCommand7reapplyEv
__ZN7WebCore11EditCommand7unapplyEv
......
......@@ -28,7 +28,6 @@
#include "DOMWindow.h"
#include "Element.h"
#include "EventListener.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FloatRect.h"
#include "Frame.h"
......@@ -98,8 +97,6 @@ static void setJSDOMWindowBaseXSLTProcessor(ExecState*, JSObject*, JSValue*);
namespace WebCore {
using namespace EventNames;
static int lastUsedTimeoutId;
static int timerNestingLevel = 0;
......
......@@ -25,7 +25,6 @@
#include "DOMWindow.h"
#include "Document.h"
#include "Event.h"
#include "EventNames.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "JSDOMWindow.h"
......@@ -41,8 +40,6 @@ using namespace JSC;
namespace WebCore {
using namespace EventNames;
ASSERT_CLASS_FITS_IN_CELL(JSAbstractEventListener)
void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
......
......@@ -50,7 +50,6 @@
#endif
using namespace JSC;
using namespace WebCore::EventNames;
namespace WebCore {
......@@ -184,15 +183,15 @@ bool ScriptController::processingUserGesture() const
if (Event* event = m_windowShell->window()->currentEvent()) {
const AtomicString& type = event->type();
if ( // mouse events
type == clickEvent || type == mousedownEvent ||
type == mouseupEvent || type == dblclickEvent ||
type == eventNames().clickEvent || type == eventNames().mousedownEvent ||
type == eventNames().mouseupEvent || type == eventNames().dblclickEvent ||
// keyboard events
type == keydownEvent || type == keypressEvent ||
type == keyupEvent ||
type == eventNames().keydownEvent || type == eventNames().keypressEvent ||
type == eventNames().keyupEvent ||
// other accepted events
type == selectEvent || type == changeEvent ||
type == focusEvent || type == blurEvent ||
type == submitEvent)
type == eventNames().selectEvent || type == eventNames().changeEvent ||
type == eventNames().focusEvent || type == eventNames().blurEvent ||
type == eventNames().submitEvent)
return true;
} else { // no event
if (m_sourceURL && m_sourceURL->isNull() && !m_processingTimerCallback) {
......
......@@ -30,10 +30,8 @@
namespace WebCore {
using namespace EventNames;
BeforeTextInsertedEvent::BeforeTextInsertedEvent(const String& text)
: Event(webkitBeforeTextInsertedEvent, false, true), m_text(text)
: Event(eventNames().webkitBeforeTextInsertedEvent, false, true), m_text(text)
{
}
......
......@@ -29,10 +29,8 @@
namespace WebCore {
using namespace EventNames;
BeforeUnloadEvent::BeforeUnloadEvent()
: Event(beforeunloadEvent, false, true)
: Event(eventNames().beforeunloadEvent, false, true)
{
}
......
......@@ -31,8 +31,6 @@
namespace WebCore {
using namespace EventNames;
CharacterData::CharacterData(Document *doc)
: EventTargetNode(doc)
, m_data(StringImpl::empty())
......@@ -201,7 +199,7 @@ void CharacterData::dispatchModifiedEvent(StringImpl* prevValue)
parentNode()->childrenChanged();
if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) {
ExceptionCode ec;
dispatchEvent(MutationEvent::create(DOMCharacterDataModifiedEvent, true, false, 0, prevValue, m_data, String(), 0), ec);
dispatchEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, false, 0, prevValue, m_data, String(), 0), ec);
}
dispatchSubtreeModifiedEvent();
}
......
......@@ -40,8 +40,6 @@
namespace WebCore {
using namespace EventNames;
static void dispatchChildInsertionEvents(Node*, ExceptionCode&);
static void dispatchChildRemovalEvents(Node*, ExceptionCode&);
......@@ -883,7 +881,7 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec)
doc->hasListenerType(Document::DOMNODEINSERTED_LISTENER) &&
c->isEventTargetNode()) {
ec = 0;
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeInsertedEvent, true, false,
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedEvent, true, false,
c->parentNode(), String(), String(), String(), 0), ec);
if (ec)
return;
......@@ -896,7 +894,7 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec)
continue;
ec = 0;
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeInsertedIntoDocumentEvent, false, false,
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedIntoDocumentEvent, false, false,
0, String(), String(), String(), 0), ec);
if (ec)
return;
......@@ -916,7 +914,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec)
doc->hasListenerType(Document::DOMNODEREMOVED_LISTENER) &&
c->isEventTargetNode()) {
ec = 0;
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeRemovedEvent, true, false,
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedEvent, true, false,
c->parentNode(), String(), String(), String(), 0), ec);
if (ec)
return;
......@@ -928,7 +926,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec)
if (!c->isEventTargetNode())
continue;
ec = 0;
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeRemovedFromDocumentEvent, false, false,
EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedFromDocumentEvent, false, false,
0, String(), String(), String(), 0), ec);
if (ec)
return;
......
......@@ -141,7 +141,7 @@ void DedicatedWorker::notifyFinished(CachedResource* resource)
void DedicatedWorker::dispatchErrorEvent()
{
if (m_onErrorListener) {
RefPtr<Event> evt = Event::create(EventNames::errorEvent, false, true);
RefPtr<Event> evt = Event::create(eventNames().errorEvent, false, true);
// DedicatedWorker is not an EventTarget, so target and currentTarget remain null.
m_onErrorListener->handleEvent(evt.release().get(), true);
}
......
......@@ -147,7 +147,6 @@ using namespace Unicode;
namespace WebCore {
using namespace EventNames;
using namespace HTMLNames;
// #define INSTRUMENT_LAYOUT_SCHEDULING 1
......@@ -1547,7 +1546,7 @@ void Document::implicitClose()
f->animation()->resumeAnimations(this);
dispatchImageLoadEventsNow();
this->dispatchWindowEvent(loadEvent, false, false);
this->dispatchWindowEvent(eventNames().loadEvent, false, false);
if (f)
f->loader()->handledOnloadEvents();
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
......@@ -2416,7 +2415,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
// Dispatch a change event for text fields or textareas that have been edited
RenderObject* r = static_cast<RenderObject*>(oldFocusedNode.get()->renderer());
if (r && (r->isTextArea() || r->isTextField()) && r->isEdited()) {
EventTargetNodeCast(oldFocusedNode.get())->dispatchEventForType(changeEvent, true, false);
EventTargetNodeCast(oldFocusedNode.get())->dispatchEventForType(eventNames().changeEvent, true, false);
if ((r = static_cast<RenderObject*>(oldFocusedNode.get()->renderer())))
r->setEdited(false);
}
......@@ -2429,7 +2428,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
focusChangeBlocked = true;
newFocusedNode = 0;
}
EventTargetNodeCast(oldFocusedNode.get())->dispatchUIEvent(DOMFocusOutEvent);
EventTargetNodeCast(oldFocusedNode.get())->dispatchUIEvent(eventNames().DOMFocusOutEvent);
if (m_focusedNode) {
// handler shifted focus
focusChangeBlocked = true;
......@@ -2459,7 +2458,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
focusChangeBlocked = true;
goto SetFocusedNodeDone;
}
EventTargetNodeCast(m_focusedNode.get())->dispatchUIEvent(DOMFocusInEvent);
EventTargetNodeCast(m_focusedNode.get())->dispatchUIEvent(eventNames().DOMFocusInEvent);
if (m_focusedNode != newFocusedNode) {
// handler shifted focus
focusChangeBlocked = true;
......@@ -2644,29 +2643,29 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode&
void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
{
if (eventType == DOMSubtreeModifiedEvent)
if (eventType == eventNames().DOMSubtreeModifiedEvent)
addListenerType(DOMSUBTREEMODIFIED_LISTENER);
else if (eventType == DOMNodeInsertedEvent)
else if (eventType == eventNames().DOMNodeInsertedEvent)
addListenerType(DOMNODEINSERTED_LISTENER);
else if (eventType == DOMNodeRemovedEvent)
else if (eventType == eventNames().DOMNodeRemovedEvent)
addListenerType(DOMNODEREMOVED_LISTENER);
else if (eventType == DOMNodeRemovedFromDocumentEvent)
else if (eventType == eventNames().DOMNodeRemovedFromDocumentEvent)
addListenerType(DOMNODEREMOVEDFROMDOCUMENT_LISTENER);
else if (eventType == DOMNodeInsertedIntoDocumentEvent)
else if (eventType == eventNames().DOMNodeInsertedIntoDocumentEvent)
addListenerType(DOMNODEINSERTEDINTODOCUMENT_LISTENER);
else if (eventType == DOMAttrModifiedEvent)
else if (eventType == eventNames().DOMAttrModifiedEvent)
addListenerType(DOMATTRMODIFIED_LISTENER);
else if (eventType == DOMCharacterDataModifiedEvent)
else if (eventType == eventNames().DOMCharacterDataModifiedEvent)
addListenerType(DOMCHARACTERDATAMODIFIED_LISTENER);
else if (eventType == overflowchangedEvent)
else if (eventType == eventNames().overflowchangedEvent)
addListenerType(OVERFLOWCHANGED_LISTENER);
else if (eventType == webkitAnimationStartEvent)
else if (eventType == eventNames().webkitAnimationStartEvent)
addListenerType(ANIMATIONSTART_LISTENER);
else if (eventType == webkitAnimationEndEvent)
else if (eventType == eventNames().webkitAnimationEndEvent)
addListenerType(ANIMATIONEND_LISTENER);
else if (eventType == webkitAnimationIterationEvent)
else if (eventType == eventNames().webkitAnimationIterationEvent)
addListenerType(ANIMATIONITERATION_LISTENER);
else if (eventType == webkitTransitionEndEvent)
else if (eventType == eventNames().webkitTransitionEndEvent)
addListenerType(TRANSITIONEND_LISTENER);
}
......@@ -2712,9 +2711,9 @@ void Document::removeWindowInlineEventListenerForType(const AtomicString& eventT
RegisteredEventListenerList::iterator it = m_windowEventListeners.begin();
for (; it != m_windowEventListeners.end(); ++it) {
if ((*it)->eventType() == eventType && (*it)->listener()->isInline()) {
if (eventType == unloadEvent)
if (eventType == eventNames().unloadEvent)
removePendingFrameUnloadEventCount();
else if (eventType == beforeunloadEvent)
else if (eventType == eventNames().beforeunloadEvent)
removePendingFrameBeforeUnloadEventCount();
m_windowEventListeners.remove(it);
return;
......@@ -2724,9 +2723,9 @@ void Document::removeWindowInlineEventListenerForType(const AtomicString& eventT
void Document::addWindowEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
{
if (eventType == unloadEvent)
if (eventType == eventNames().unloadEvent)
addPendingFrameUnloadEventCount();
else if (eventType == beforeunloadEvent)
else if (eventType == eventNames().beforeunloadEvent)
addPendingFrameBeforeUnloadEventCount();
// Remove existing identical listener set with identical arguments.
// The DOM 2 spec says that "duplicate instances are discarded" in this case.
......@@ -2740,9 +2739,9 @@ void Document::removeWindowEventListener(const AtomicString& eventType, EventLis
for (; it != m_windowEventListeners.end(); ++it) {
RegisteredEventListener& r = **it;
if (r.eventType() == eventType && r.listener() == listener && r.useCapture() == useCapture) {
if (eventType == unloadEvent)
if (eventType == eventNames().unloadEvent)
removePendingFrameUnloadEventCount();
else if (eventType == beforeunloadEvent)
else if (eventType == eventNames().beforeunloadEvent)
removePendingFrameBeforeUnloadEventCount();
m_windowEventListeners.remove(it);
return;
......@@ -3811,7 +3810,7 @@ void Document::finishedParsing()
setParsing(false);
ExceptionCode ec = 0;
dispatchEvent(Event::create(DOMContentLoadedEvent, true, false), ec);
dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false), ec);
if