RenderTextControlSingleLine.h [plain text]
#ifndef RenderTextControlSingleLine_h
#define RenderTextControlSingleLine_h
#include "HTMLInputElement.h"
#include "RenderTextControl.h"
namespace WebCore {
class HTMLInputElement;
class RenderTextControlSingleLine : public RenderTextControl {
public:
RenderTextControlSingleLine(HTMLInputElement&, PassRef<RenderStyle>);
virtual ~RenderTextControlSingleLine();
virtual PassRef<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const override;
PassRef<RenderStyle> createInnerBlockStyle(const RenderStyle* startStyle) const;
void capsLockStateMayHaveChanged();
protected:
virtual void centerContainerIfNeeded(RenderBox*) const { }
virtual LayoutUnit computeLogicalHeightLimit() const;
void centerRenderer(RenderBox& renderer) const;
HTMLElement* containerElement() const;
HTMLElement* innerBlockElement() const;
HTMLInputElement& inputElement() const;
private:
void textFormControlElement() const = delete;
virtual bool hasControlClip() const override;
virtual LayoutRect controlClipRect(const LayoutPoint&) const override;
virtual bool isTextField() const override final { return true; }
virtual void paint(PaintInfo&, const LayoutPoint&) override;
virtual void layout() override;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
virtual void autoscroll(const IntPoint&) override;
virtual int scrollLeft() const override;
virtual int scrollTop() const override;
virtual int scrollWidth() const override;
virtual int scrollHeight() const override;
virtual void setScrollLeft(int) override;
virtual void setScrollTop(int) override;
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override final;
virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override final;
int textBlockWidth() const;
virtual float getAverageCharWidth() override;
virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const override;
virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
bool textShouldBeTruncated() const;
HTMLElement* innerSpinButtonElement() const;
bool m_shouldDrawCapsLockIndicator;
LayoutUnit m_desiredInnerTextLogicalHeight;
};
inline HTMLElement* RenderTextControlSingleLine::containerElement() const
{
return inputElement().containerElement();
}
inline HTMLElement* RenderTextControlSingleLine::innerBlockElement() const
{
return inputElement().innerBlockElement();
}
RENDER_OBJECT_TYPE_CASTS(RenderTextControlSingleLine, isTextField())
class RenderTextControlInnerBlock final : public RenderBlockFlow {
public:
RenderTextControlInnerBlock(Element& element, PassRef<RenderStyle> style)
: RenderBlockFlow(element, WTF::move(style))
{
}
private:
virtual bool hasLineIfEmpty() const override { return true; }
virtual bool isTextControlInnerBlock() const override { return true; }
};
RENDER_OBJECT_TYPE_CASTS(RenderTextControlInnerBlock, isTextControlInnerBlock())
}
#endif