#ifndef LineWidth_h
#define LineWidth_h
#include "LayoutUnit.h"
namespace WebCore {
class FloatingObject;
class RenderBlockFlow;
class RenderObject;
class RenderRubyRun;
class RenderStyle;
struct LineSegment;
enum IndentTextOrNot { DoNotIndentText, IndentText };
class LineWidth {
public:
LineWidth(RenderBlockFlow&, bool isFirstLine, IndentTextOrNot shouldIndentText);
bool fitsOnLine(bool ignoringTrailingSpace = false) const;
bool fitsOnLineIncludingExtraWidth(float extra) const;
bool fitsOnLineExcludingTrailingWhitespace(float extra) const;
float currentWidth() const { return m_committedWidth + m_uncommittedWidth; }
float uncommittedWidth() const { return m_uncommittedWidth; }
float committedWidth() const { return m_committedWidth; }
float availableWidth() const { return m_availableWidth; }
float logicalLeftOffset() const { return m_left; }
void updateAvailableWidth(LayoutUnit minimumHeight = 0);
void shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject*);
void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; }
void commit();
void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
void fitBelowFloats(bool isFirstLine = false);
void setTrailingWhitespaceWidth(float collapsedWhitespace, float borderPaddingMargin = 0);
bool shouldIndentText() const { return m_shouldIndentText == IndentText; }
private:
void computeAvailableWidthFromLeftAndRight();
bool fitsOnLineExcludingTrailingCollapsedWhitespace() const;
void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, float newLineLeft, float newLineRight);
#if ENABLE(CSS_SHAPES)
void wrapNextToShapeOutside(bool isFirstLine);
#endif
RenderBlockFlow& m_block;
float m_uncommittedWidth;
float m_committedWidth;
float m_overhangWidth; float m_trailingWhitespaceWidth;
float m_trailingCollapsedWhitespaceWidth;
float m_left;
float m_right;
float m_availableWidth;
bool m_isFirstLine;
IndentTextOrNot m_shouldIndentText;
};
IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, const RenderStyle&);
}
#endif // LineWidth_h