This source file includes following definitions.
- newlineString
- m_lineHeight
- lineHeight
- styleDidChange
- caretMinOffset
- caretMaxOffset
- positionForPoint
#include "config.h"
#include "core/rendering/RenderBR.h"
#include "core/dom/Document.h"
#include "core/rendering/RenderView.h"
namespace WebCore {
static PassRefPtr<StringImpl> newlineString()
{
DEFINE_STATIC_LOCAL(const String, string, ("\n"));
return string.impl();
}
RenderBR::RenderBR(Node* node)
: RenderText(node, newlineString())
, m_lineHeight(-1)
{
}
RenderBR::~RenderBR()
{
}
int RenderBR::lineHeight(bool firstLine) const
{
if (firstLine && document().styleEngine()->usesFirstLineRules()) {
RenderStyle* s = style(firstLine);
if (s != style())
return s->computedLineHeight();
}
if (m_lineHeight == -1)
m_lineHeight = style()->computedLineHeight();
return m_lineHeight;
}
void RenderBR::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderText::styleDidChange(diff, oldStyle);
m_lineHeight = -1;
}
int RenderBR::caretMinOffset() const
{
return 0;
}
int RenderBR::caretMaxOffset() const
{
return 1;
}
PositionWithAffinity RenderBR::positionForPoint(const LayoutPoint&)
{
return createPositionWithAffinity(0, DOWNSTREAM);
}
}