This source file includes following definitions.
- createEventListenerWrapper
- getEventListenerWrapper
- webDOMEventListenerDeleted
- eventListenerDeleted
#include "config.h"
#include "WebDOMEventListenerPrivate.h"
#include "EventListenerWrapper.h"
#include "WebDOMEventListener.h"
using namespace WebCore;
namespace blink {
WebDOMEventListenerPrivate::WebDOMEventListenerPrivate(WebDOMEventListener* webDOMEventListener)
: m_webDOMEventListener(webDOMEventListener)
{
}
WebDOMEventListenerPrivate::~WebDOMEventListenerPrivate()
{
}
EventListenerWrapper* WebDOMEventListenerPrivate::createEventListenerWrapper(const WebString& eventType, bool useCapture, EventTarget* target)
{
EventListenerWrapper* listenerWrapper = new EventListenerWrapper(m_webDOMEventListener);
WebDOMEventListenerPrivate::ListenerInfo listenerInfo(eventType, useCapture, listenerWrapper, target);
m_listenerWrappers.append(listenerInfo);
return listenerWrapper;
}
EventListenerWrapper* WebDOMEventListenerPrivate::getEventListenerWrapper(const WebString& eventType, bool useCapture, EventTarget* target)
{
Vector<WebDOMEventListenerPrivate::ListenerInfo>::const_iterator iter;
for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter) {
if (iter->target == target)
return iter->eventListenerWrapper;
}
ASSERT_NOT_REACHED();
return 0;
}
void WebDOMEventListenerPrivate::webDOMEventListenerDeleted()
{
Vector<WebDOMEventListenerPrivate::ListenerInfo>::const_iterator iter;
for (iter = m_listenerWrappers.begin(); iter != m_listenerWrappers.end(); ++iter)
iter->eventListenerWrapper->webDOMEventListenerDeleted();
}
void WebDOMEventListenerPrivate::eventListenerDeleted(EventListenerWrapper* eventListener)
{
for (size_t i = 0; i < m_listenerWrappers.size(); ++i) {
if (m_listenerWrappers[i].eventListenerWrapper == eventListener) {
m_listenerWrappers.remove(i);
return;
}
}
ASSERT_NOT_REACHED();
}
}