SliderThumbElement.h [plain text]
#ifndef SliderThumbElement_h
#define SliderThumbElement_h
#include "FloatPoint.h"
#include "HTMLDivElement.h"
#include "HTMLNames.h"
#include "RenderStyleConstants.h"
#include <wtf/Forward.h>
namespace WebCore {
class HTMLElement;
class HTMLInputElement;
class Event;
class FloatPoint;
class TouchEvent;
class SliderThumbElement : public HTMLDivElement {
public:
static PassRefPtr<SliderThumbElement> create(Document*);
bool inDragMode() const { return m_inDragMode; }
void setPositionFromValue();
void dragFrom(const IntPoint&);
virtual void detach();
virtual const AtomicString& shadowPseudoId() const;
virtual void attach();
void handleTouchEvent(TouchEvent*);
private:
SliderThumbElement(Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() const;
void startDragging();
void stopDragging();
void setPositionFromPoint(const IntPoint&);
HTMLInputElement* hostInput();
unsigned exclusiveTouchIdentifier() const;
void setExclusiveTouchIdentifier(unsigned);
void clearExclusiveTouchIdentifier();
void handleTouchStart(TouchEvent*);
void handleTouchMove(TouchEvent*);
void handleTouchEndAndCancel(TouchEvent*);
bool m_inDragMode;
static const unsigned NoIdentifier = 0;
unsigned m_exclusiveTouchIdentifier;
};
inline SliderThumbElement::SliderThumbElement(Document* document)
: HTMLDivElement(HTMLNames::divTag, document)
, m_inDragMode(false)
, m_exclusiveTouchIdentifier(NoIdentifier)
{
}
inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(Document* document)
{
return adoptRef(new SliderThumbElement(document));
}
inline PassRefPtr<Element> SliderThumbElement::cloneElementWithoutAttributesAndChildren() const
{
return create(document());
}
inline SliderThumbElement* toSliderThumbElement(Node* node)
{
ASSERT(!node || node->isHTMLElement());
return static_cast<SliderThumbElement*>(node);
}
}
#endif