#include "config.h"
#include "JSEvent.h"
#include "Clipboard.h"
#include "Event.h"
#include "JSKeyboardEvent.h"
#include "JSMessageEvent.h"
#include "JSMouseEvent.h"
#include "JSMutationEvent.h"
#include "JSOverflowEvent.h"
#include "JSProgressEvent.h"
#include "JSTextEvent.h"
#include "JSUIEvent.h"
#include "JSWebKitAnimationEvent.h"
#include "JSWebKitTransitionEvent.h"
#include "JSWheelEvent.h"
#include "KeyboardEvent.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
#include "MutationEvent.h"
#include "OverflowEvent.h"
#include "ProgressEvent.h"
#include "TextEvent.h"
#include "UIEvent.h"
#include "WebKitAnimationEvent.h"
#include "WebKitTransitionEvent.h"
#include "WheelEvent.h"
#include "kjs_events.h"
#include "JSTouchEvent.h"
#include "TouchEvent.h"
#include "JSGestureEvent.h"
#include "GestureEvent.h"
using namespace KJS;
namespace WebCore {
JSValue* JSEvent::clipboardData(ExecState* exec) const
{
return impl()->isClipboardEvent() ? toJS(exec, impl()->clipboardData()) : jsUndefined();
}
JSValue* toJS(ExecState* exec, Event* event)
{
JSLock lock;
if (!event)
return jsNull();
DOMObject* ret = ScriptInterpreter::getDOMObject(event);
if (ret)
return ret;
if (event->isKeyboardEvent())
ret = new JSKeyboardEvent(JSKeyboardEventPrototype::self(exec), static_cast<KeyboardEvent*>(event));
else if (event->isTextEvent())
ret = new JSTextEvent(JSTextEventPrototype::self(exec), static_cast<TextEvent*>(event));
else if (event->isMouseEvent())
ret = new JSMouseEvent(JSMouseEventPrototype::self(exec), static_cast<MouseEvent*>(event));
else if (event->isWheelEvent())
ret = new JSWheelEvent(JSWheelEventPrototype::self(exec), static_cast<WheelEvent*>(event));
#if ENABLE(TOUCH_EVENTS)
else if (event->isTouchEvent())
ret = new JSTouchEvent(JSTouchEventPrototype::self(exec), static_cast<TouchEvent*>(event));
else if (event->isGestureEvent())
ret = new JSGestureEvent(JSGestureEventPrototype::self(exec), static_cast<GestureEvent*>(event));
#endif
else if (event->isUIEvent())
ret = new JSUIEvent(JSUIEventPrototype::self(exec), static_cast<UIEvent*>(event));
else if (event->isMutationEvent())
ret = new JSMutationEvent(JSMutationEventPrototype::self(exec), static_cast<MutationEvent*>(event));
else if (event->isOverflowEvent())
ret = new JSOverflowEvent(JSOverflowEventPrototype::self(exec), static_cast<OverflowEvent*>(event));
#if ENABLE(CROSS_DOCUMENT_MESSAGING)
else if (event->isMessageEvent())
ret = new JSMessageEvent(JSMessageEventPrototype::self(exec), static_cast<MessageEvent*>(event));
#endif
else if (event->isProgressEvent())
ret = new JSProgressEvent(JSProgressEventPrototype::self(exec), static_cast<ProgressEvent*>(event));
else if (event->isWebKitAnimationEvent())
ret = new JSWebKitAnimationEvent(JSWebKitAnimationEventPrototype::self(exec), static_cast<WebKitAnimationEvent*>(event));
else if (event->isWebKitTransitionEvent())
ret = new JSWebKitTransitionEvent(JSWebKitTransitionEventPrototype::self(exec), static_cast<WebKitTransitionEvent*>(event));
else
ret = new JSEvent(JSEventPrototype::self(exec), event);
ScriptInterpreter::putDOMObject(event, ret);
return ret;
}
}