Commit e57df819 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

2009-09-24 Vitaly Repeshko <vitalyr@chromium.org>

        Reviewed by Dimitri Glazkov.

        [V8] Fixed bindings build after http://trac.webkit.org/changeset/48701
        https://bugs.webkit.org/show_bug.cgi?id=29713

        Got rid of isWindowEvent in function signatures:
        * bindings/v8/V8AbstractEventListener.cpp:
        (WebCore::V8AbstractEventListener::invokeEventHandler):
        (WebCore::V8AbstractEventListener::handleEvent):
        (WebCore::V8AbstractEventListener::getReceiverObject):
        * bindings/v8/V8AbstractEventListener.h:
        * bindings/v8/V8LazyEventListener.cpp:
        (WebCore::V8LazyEventListener::callListenerFunction):
        * bindings/v8/V8LazyEventListener.h:
        * bindings/v8/V8WorkerContextEventListener.cpp:
        (WebCore::V8WorkerContextEventListener::handleEvent):
        (WebCore::V8WorkerContextEventListener::callListenerFunction):
        (WebCore::V8WorkerContextEventListener::getReceiverObject):
        * bindings/v8/V8WorkerContextEventListener.h:
        * bindings/v8/custom/V8CustomEventListener.cpp:
        (WebCore::V8EventListener::callListenerFunction):
        * bindings/v8/custom/V8CustomEventListener.h:

        Switched to EventTarget methods of adding/removing listeners:
        * bindings/v8/custom/V8DOMApplicationCacheCustom.cpp:
        (WebCore::toEventID):
        (WebCore::ACCESSOR_SETTER):

        * dom/EventTarget.h: Some functions were incorrectly marked
        as JSC-specific.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0b111064
2009-09-24 Vitaly Repeshko <vitalyr@chromium.org>
Reviewed by Dimitri Glazkov.
[V8] Fixed bindings build after http://trac.webkit.org/changeset/48701
https://bugs.webkit.org/show_bug.cgi?id=29713
Got rid of isWindowEvent in function signatures:
* bindings/v8/V8AbstractEventListener.cpp:
(WebCore::V8AbstractEventListener::invokeEventHandler):
(WebCore::V8AbstractEventListener::handleEvent):
(WebCore::V8AbstractEventListener::getReceiverObject):
* bindings/v8/V8AbstractEventListener.h:
* bindings/v8/V8LazyEventListener.cpp:
(WebCore::V8LazyEventListener::callListenerFunction):
* bindings/v8/V8LazyEventListener.h:
* bindings/v8/V8WorkerContextEventListener.cpp:
(WebCore::V8WorkerContextEventListener::handleEvent):
(WebCore::V8WorkerContextEventListener::callListenerFunction):
(WebCore::V8WorkerContextEventListener::getReceiverObject):
* bindings/v8/V8WorkerContextEventListener.h:
* bindings/v8/custom/V8CustomEventListener.cpp:
(WebCore::V8EventListener::callListenerFunction):
* bindings/v8/custom/V8CustomEventListener.h:
Switched to EventTarget methods of adding/removing listeners:
* bindings/v8/custom/V8DOMApplicationCacheCustom.cpp:
(WebCore::toEventID):
(WebCore::ACCESSOR_SETTER):
* dom/EventTarget.h: Some functions were incorrectly marked
as JSC-specific.
2009-09-24 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
......@@ -63,7 +63,7 @@ V8AbstractEventListener::V8AbstractEventListener(Frame* frame, bool isAttribute)
}
}
void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Context, Event* event, v8::Handle<v8::Value> jsEvent, bool isWindowEvent)
void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Context, Event* event, v8::Handle<v8::Value> jsEvent)
{
// We push the event being processed into the global object, so that it can be exposed by DOMWindow's bindings.
v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
......@@ -88,7 +88,7 @@ void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Conte
// Call the event handler.
tryCatch.SetVerbose(false); // We do not want to report the exception to the inspector console.
returnValue = callListenerFunction(jsEvent, event, isWindowEvent);
returnValue = callListenerFunction(jsEvent, event);
if (!tryCatch.CanContinue())
return;
......@@ -124,7 +124,7 @@ void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Conte
event->preventDefault();
}
void V8AbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
void V8AbstractEventListener::handleEvent(Event* event)
{
// EventListener could be disconnected from the frame.
if (disconnected())
......@@ -154,7 +154,7 @@ void V8AbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
// Get the V8 wrapper for the event object.
v8::Handle<v8::Value> jsEvent = V8DOMWrapper::convertEventToV8Object(event);
invokeEventHandler(v8Context, event, jsEvent, isWindowEvent);
invokeEventHandler(v8Context, event, jsEvent);
Document::updateStyleForAllDocuments();
}
......@@ -170,14 +170,11 @@ void V8AbstractEventListener::disposeListenerObject()
}
}
v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event, bool isWindowEvent)
v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event)
{
if (!m_listener.IsEmpty() && !m_listener->IsFunction())
return v8::Local<v8::Object>::New(m_listener);
if (isWindowEvent)
return v8::Context::GetCurrent()->Global();
EventTarget* target = event->currentTarget();
v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target);
if (value.IsEmpty())
......
......@@ -58,8 +58,8 @@ namespace WebCore {
// Returns the owner frame of the listener.
Frame* frame() { return m_frame; }
virtual void handleEvent(Event*, bool isWindowEvent);
void invokeEventHandler(v8::Handle<v8::Context>, Event*, v8::Handle<v8::Value> jsEvent, bool isWindowEvent);
virtual void handleEvent(Event*);
void invokeEventHandler(v8::Handle<v8::Context>, Event*, v8::Handle<v8::Value> jsEvent);
// Returns the listener object, either a function or an object.
virtual v8::Local<v8::Object> getListenerObject()
......@@ -83,10 +83,10 @@ namespace WebCore {
private:
V8AbstractEventListener(Frame*, bool isInline);
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsevent, Event*, bool isWindowEvent) = 0;
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsevent, Event*) = 0;
// Get the receiver object to use for event listener call.
v8::Local<v8::Object> getReceiverObject(Event*, bool isWindowEvent);
v8::Local<v8::Object> getReceiverObject(Event*);
// Frame to which the event listener is attached to. An event listener must be destroyed before its owner frame is
// deleted. See fast/dom/replaceChild.html
......
......@@ -124,10 +124,10 @@ v8::Local<v8::Function> V8LazyEventListener::getListenerFunction()
return m_listener.IsEmpty() ? v8::Local<v8::Function>() : v8::Local<v8::Function>::New(v8::Persistent<v8::Function>::Cast(m_listener));
}
v8::Local<v8::Value> V8LazyEventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event, bool isWindowEvent)
v8::Local<v8::Value> V8LazyEventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event)
{
v8::Local<v8::Function> handlerFunction = getWrappedListenerFunction();
v8::Local<v8::Object> receiver = getReceiverObject(event, isWindowEvent);
v8::Local<v8::Object> receiver = getReceiverObject(event);
if (handlerFunction.IsEmpty() || receiver.IsEmpty())
return v8::Local<v8::Value>();
......
......@@ -71,7 +71,7 @@ namespace WebCore {
v8::Local<v8::Function> getWrappedListenerFunction();
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*, bool isWindowEvent);
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*);
v8::Local<v8::Function> getListenerFunction();
};
......
......@@ -53,7 +53,7 @@ V8WorkerContextEventListener::~V8WorkerContextEventListener()
disposeListenerObject();
}
void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)
void V8WorkerContextEventListener::handleEvent(Event* event)
{
// Is the EventListener disconnected?
if (disconnected())
......@@ -75,7 +75,7 @@ void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)
// Get the V8 wrapper for the event object.
v8::Handle<v8::Value> jsEvent = WorkerContextExecutionProxy::convertEventToV8Object(event);
invokeEventHandler(context, event, jsEvent, isWindowEvent);
invokeEventHandler(context, event, jsEvent);
}
bool V8WorkerContextEventListener::reportError(const String& message, const String& url, int lineNumber)
......@@ -124,10 +124,10 @@ bool V8WorkerContextEventListener::reportError(const String& message, const Stri
return errorHandled;
}
v8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event, bool isWindowEvent)
v8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event)
{
v8::Local<v8::Function> handlerFunction = getListenerFunction();
v8::Local<v8::Object> receiver = getReceiverObject(event, isWindowEvent);
v8::Local<v8::Object> receiver = getReceiverObject(event);
if (handlerFunction.IsEmpty() || receiver.IsEmpty())
return v8::Local<v8::Value>();
......@@ -139,14 +139,11 @@ v8::Local<v8::Value> V8WorkerContextEventListener::callListenerFunction(v8::Hand
return result;
}
v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(Event* event, bool isWindowEvent)
v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(Event* event)
{
if (!m_listener.IsEmpty() && !m_listener->IsFunction())
return v8::Local<v8::Object>::New(m_listener);
if (isWindowEvent)
return v8::Context::GetCurrent()->Global();
EventTarget* target = event->currentTarget();
v8::Handle<v8::Value> value = WorkerContextExecutionProxy::convertEventTargetToV8Object(target);
if (value.IsEmpty())
......
......@@ -51,7 +51,7 @@ namespace WebCore {
V8WorkerContextEventListener(WorkerContextExecutionProxy*, v8::Local<v8::Object> listener, bool isInline);
virtual ~V8WorkerContextEventListener();
virtual void handleEvent(Event*, bool isWindowEvent);
virtual void handleEvent(Event*);
virtual bool reportError(const String& message, const String& url, int lineNumber);
virtual bool disconnected() const { return !m_proxy; }
......@@ -59,8 +59,8 @@ namespace WebCore {
void disconnect() { m_proxy = 0; }
private:
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*, bool isWindowEvent);
v8::Local<v8::Object> getReceiverObject(Event*, bool isWindowEvent);
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*);
v8::Local<v8::Object> getReceiverObject(Event*);
WorkerContextExecutionProxy* m_proxy;
};
......
......@@ -73,10 +73,10 @@ v8::Local<v8::Function> V8EventListener::getListenerFunction()
return v8::Local<v8::Function>();
}
v8::Local<v8::Value> V8EventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event, bool isWindowEvent)
v8::Local<v8::Value> V8EventListener::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event)
{
v8::Local<v8::Function> handlerFunction = getListenerFunction();
v8::Local<v8::Object> receiver = getReceiverObject(event, isWindowEvent);
v8::Local<v8::Object> receiver = getReceiverObject(event);
if (handlerFunction.IsEmpty() || receiver.IsEmpty())
return v8::Local<v8::Value>();
......
......@@ -58,7 +58,7 @@ namespace WebCore {
v8::Local<v8::Function> getListenerFunction();
private:
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*, bool isWindowEvent);
virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*);
virtual bool virtualisAttribute() const { return m_isAttribute; }
};
......
......@@ -61,11 +61,11 @@ static v8::Local<v8::Object> eventListenerToV8Object(EventListener* listener)
return (static_cast<V8ObjectEventListener*>(listener))->getListenerObject();
}
static inline ApplicationCacheHost::EventID toEventID(v8::Local<v8::String> value)
static inline String toEventID(v8::Local<v8::String> value)
{
String key = toWebCoreString(value);
ASSERT(key.startsWith("on"));
return DOMApplicationCache::toEventID(key.substring(2));
return key.substring(2);
}
// Handles appcache.onfooevent attribute getting
......@@ -83,7 +83,7 @@ ACCESSOR_SETTER(DOMApplicationCacheEventHandler)
{
INC_STATS("DOMApplicationCache.onevent_setter");
DOMApplicationCache* appcache = V8DOMWrapper::convertToNativeObject<DOMApplicationCache>(V8ClassIndex::DOMAPPLICATIONCACHE, info.Holder());
ApplicationCacheHost::EventID eventType = toEventID(name);
String eventType = toEventID(name);
if (EventListener* oldListener = appcache->getAttributeEventListener(eventType)) {
v8::Local<v8::Object> object = eventListenerToV8Object(oldListener);
......
......@@ -202,6 +202,7 @@ namespace WebCore {
d->eventListenerMap.clear();
}
#endif
inline bool EventTarget::isFiringEventListeners()
{
......@@ -227,8 +228,6 @@ namespace WebCore {
return d->eventListenerMap.contains(eventType);
}
#endif
} // namespace WebCore
#endif // EventTarget_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment