#ifndef CompositionEvent_h
#define CompositionEvent_h
#include "core/editing/CompositionUnderline.h"
#include "core/events/UIEvent.h"
namespace WebCore {
struct CompositionEventInit : UIEventInit {
CompositionEventInit();
String data;
};
class CompositionEvent FINAL : public UIEvent {
public:
static PassRefPtrWillBeRawPtr<CompositionEvent> create()
{
return adoptRefWillBeNoop(new CompositionEvent);
}
static PassRefPtrWillBeRawPtr<CompositionEvent> create(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data, const Vector<CompositionUnderline>& underlines)
{
return adoptRefWillBeNoop(new CompositionEvent(type, view, data, underlines));
}
static PassRefPtrWillBeRawPtr<CompositionEvent> create(const AtomicString& type, const CompositionEventInit& initializer)
{
return adoptRefWillBeNoop(new CompositionEvent(type, initializer));
}
virtual ~CompositionEvent();
void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, const String& data);
String data() const { return m_data; }
int activeSegmentStart() const { return m_activeSegmentStart; }
int activeSegmentEnd() const { return m_activeSegmentEnd; }
const Vector<unsigned>& getSegments() const { return m_segments; }
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual void trace(Visitor*) OVERRIDE;
private:
CompositionEvent();
CompositionEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView>, const String&, const Vector<CompositionUnderline>& underlines);
CompositionEvent(const AtomicString& type, const CompositionEventInit&);
void initializeSegments(const Vector<CompositionUnderline>* = 0);
String m_data;
int m_activeSegmentStart;
int m_activeSegmentEnd;
Vector<unsigned> m_segments;
};
}
#endif