SliderThumbElement.h [plain text]
#ifndef SliderThumbElement_h
#define SliderThumbElement_h
#include "FloatPoint.h"
#include "HTMLDivElement.h"
#include "HTMLNames.h"
#include "RenderBlock.h"
#include "RenderStyleConstants.h"
#include <wtf/Forward.h>
namespace WebCore {
class HTMLElement;
class HTMLInputElement;
class Event;
class FloatPoint;
#if PLATFORM(IOS)
#if ENABLE(TOUCH_EVENTS)
class TouchEvent;
#endif
#endif
class SliderThumbElement FINAL : public HTMLDivElement {
public:
static PassRefPtr<SliderThumbElement> create(Document*);
void setPositionFromValue();
void dragFrom(const LayoutPoint&);
#if !PLATFORM(IOS)
virtual void defaultEventHandler(Event*);
#endif
#if !PLATFORM(IOS)
virtual bool willRespondToMouseMoveEvents() OVERRIDE;
virtual bool willRespondToMouseClickEvents() OVERRIDE;
#endif // !PLATFORM(IOS)
virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
virtual const AtomicString& shadowPseudoId() const;
HTMLInputElement* hostInput() const;
void setPositionFromPoint(const LayoutPoint&);
#if PLATFORM(IOS)
#if ENABLE(TOUCH_EVENTS)
virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
void handleTouchEvent(TouchEvent*);
void disabledAttributeChanged();
#endif
#endif
private:
SliderThumbElement(Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
virtual bool isDisabledFormControl() const OVERRIDE;
virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
virtual bool matchesReadWritePseudoClass() const OVERRIDE;
virtual Element* focusDelegate() OVERRIDE;
void startDragging();
void stopDragging();
#if PLATFORM(IOS)
#if ENABLE(TOUCH_EVENTS)
unsigned exclusiveTouchIdentifier() const;
void setExclusiveTouchIdentifier(unsigned);
void clearExclusiveTouchIdentifier();
void handleTouchStart(TouchEvent*);
void handleTouchMove(TouchEvent*);
void handleTouchEndAndCancel(TouchEvent*);
bool shouldAcceptTouchEvents();
void registerForTouchEvents();
void unregisterForTouchEvents();
#endif
#endif
bool m_inDragMode;
#if PLATFORM(IOS)
#if ENABLE(TOUCH_EVENTS)
static const unsigned NoIdentifier = 0;
unsigned m_exclusiveTouchIdentifier;
bool m_isRegisteredAsTouchEventListener;
#endif
#endif
};
inline SliderThumbElement::SliderThumbElement(Document* document)
: HTMLDivElement(HTMLNames::divTag, document)
, m_inDragMode(false)
#if PLATFORM(IOS)
#if ENABLE(TOUCH_EVENTS)
, m_exclusiveTouchIdentifier(NoIdentifier)
, m_isRegisteredAsTouchEventListener(false)
#endif
#endif
{
}
inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(Document* document)
{
return adoptRef(new SliderThumbElement(document));
}
inline PassRefPtr<Element> SliderThumbElement::cloneElementWithoutAttributesAndChildren()
{
return create(document());
}
inline SliderThumbElement* toSliderThumbElement(Node* node)
{
ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isHTMLElement());
return static_cast<SliderThumbElement*>(node);
}
SliderThumbElement* sliderThumbElementOf(Node*);
HTMLElement* sliderTrackElementOf(Node*);
class RenderSliderThumb FINAL : public RenderBlock {
public:
RenderSliderThumb(SliderThumbElement*);
void updateAppearance(RenderStyle* parentStyle);
private:
virtual bool isSliderThumb() const;
};
class SliderContainerElement FINAL : public HTMLDivElement {
public:
static PassRefPtr<SliderContainerElement> create(Document*);
private:
SliderContainerElement(Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual const AtomicString& shadowPseudoId() const;
};
}
#endif