RenderTextControlSingleLine.h [plain text]
#pragma once
#include "HTMLInputElement.h"
#include "RenderTextControl.h"
namespace WebCore {
class RenderTextControlSingleLine : public RenderTextControl {
public:
RenderTextControlSingleLine(HTMLInputElement&, RenderStyle&&);
virtual ~RenderTextControlSingleLine();
protected:
void centerRenderer(RenderBox& renderer) const;
HTMLElement* containerElement() const;
HTMLElement* innerBlockElement() const;
HTMLInputElement& inputElement() const;
private:
void textFormControlElement() const = delete;
bool hasControlClip() const override;
LayoutRect controlClipRect(const LayoutPoint&) const override;
bool isTextField() const final { return true; }
void layout() override;
bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
void autoscroll(const IntPoint&) override;
int scrollLeft() const override;
int scrollTop() const override;
int scrollWidth() const override;
int scrollHeight() const override;
void setScrollLeft(int) override;
void setScrollTop(int) override;
bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final;
bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final;
int textBlockWidth() const;
float getAverageCharWidth() override;
LayoutUnit preferredContentLogicalWidth(float charWidth) const override;
LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
HTMLElement* innerSpinButtonElement() const;
};
inline HTMLElement* RenderTextControlSingleLine::containerElement() const
{
return inputElement().containerElement();
}
inline HTMLElement* RenderTextControlSingleLine::innerBlockElement() const
{
return inputElement().innerBlockElement();
}
class RenderTextControlInnerBlock final : public RenderBlockFlow {
public:
RenderTextControlInnerBlock(Element& element, RenderStyle&& style)
: RenderBlockFlow(element, WTFMove(style))
{
}
private:
bool hasLineIfEmpty() const override { return true; }
bool isTextControlInnerBlock() const override { return true; }
bool canBeProgramaticallyScrolled() const override { return true; }
};
}
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControlSingleLine, isTextField())
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTextControlInnerBlock, isTextControlInnerBlock())