#ifndef RenderButton_h
#define RenderButton_h
#include "RenderFlexibleBox.h"
#include "Timer.h"
#include <memory>
namespace WebCore {
class HTMLFormControlElement;
class RenderTextFragment;
class RenderButton final : public RenderFlexibleBox {
public:
RenderButton(HTMLFormControlElement&, Ref<RenderStyle>&&);
virtual ~RenderButton();
HTMLFormControlElement& formControlElement() const;
virtual bool canBeSelectionLeaf() const override;
virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0) override;
virtual void removeChild(RenderObject&) override;
virtual void removeLeftoverAnonymousBlock(RenderBlock*) override { }
virtual bool createsAnonymousWrapper() const override { return true; }
void setupInnerStyle(RenderStyle*);
virtual void updateFromElement() override;
virtual bool canHaveGeneratedChildren() const override;
virtual bool hasControlClip() const override { return true; }
virtual LayoutRect controlClipRect(const LayoutPoint&) const override;
void setText(const String&);
String text() const;
#if PLATFORM(IOS)
virtual void layout() override;
#endif
private:
void element() const = delete;
virtual const char* renderName() const override { return "RenderButton"; }
virtual bool isRenderButton() const override { return true; }
virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
virtual bool hasLineIfEmpty() const override;
virtual bool requiresForcedStyleRecalcPropagation() const override { return true; }
void timerFired();
RenderTextFragment* m_buttonText;
RenderBlock* m_inner;
std::unique_ptr<Timer> m_timer;
bool m_default;
};
}
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderButton, isRenderButton())
#endif // RenderButton_h