#ifndef ColorInputType_h
#define ColorInputType_h
#if ENABLE(INPUT_TYPE_COLOR)
#include "BaseClickableWithKeyInputType.h"
#include "ColorChooserClient.h"
namespace WebCore {
class ColorInputType : public BaseClickableWithKeyInputType, public ColorChooserClient {
public:
static PassOwnPtr<InputType> create(HTMLInputElement*);
virtual ~ColorInputType();
virtual void didChooseColor(const Color&) OVERRIDE;
virtual void didEndChooser() OVERRIDE;
virtual IntRect elementRectRelativeToRootView() const OVERRIDE;
virtual Color currentColor() OVERRIDE;
virtual bool shouldShowSuggestions() const OVERRIDE;
virtual Vector<Color> suggestions() const OVERRIDE;
private:
ColorInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { }
virtual void attach() OVERRIDE;
virtual bool isColorControl() const OVERRIDE;
virtual const AtomicString& formControlType() const OVERRIDE;
virtual bool supportsRequired() const OVERRIDE;
virtual String fallbackValue() const OVERRIDE;
virtual String sanitizeValue(const String&) const OVERRIDE;
virtual void createShadowSubtree() OVERRIDE;
virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;
virtual void handleDOMActivateEvent(Event*) OVERRIDE;
virtual void detach() OVERRIDE;
virtual bool shouldRespectListAttribute() OVERRIDE;
virtual bool typeMismatchFor(const String&) const OVERRIDE;
Color valueAsColor() const;
void endColorChooser();
void updateColorSwatch();
HTMLElement* shadowColorSwatch() const;
OwnPtr<ColorChooser> m_chooser;
};
}
#endif // ENABLE(INPUT_TYPE_COLOR)
#endif // ColorInputType_h