#ifndef LineWidth_h
#define LineWidth_h
#include "platform/LayoutUnit.h"
namespace WebCore {
class FloatingObject;
class RenderBlock;
class RenderObject;
class RenderRubyRun;
class RenderBlockFlow;
struct LineSegment;
enum IndentTextOrNot { DoNotIndentText, IndentText };
class LineWidth {
public:
LineWidth(RenderBlockFlow&, bool isFirstLine, IndentTextOrNot shouldIndentText);
bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + LayoutUnit::epsilon()); }
bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_availableWidth + LayoutUnit::epsilon()); }
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; }
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);
bool shouldIndentText() const { return m_shouldIndentText == IndentText; }
private:
void computeAvailableWidthFromLeftAndRight();
void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, const float& newLineLeft, const float& newLineRight);
void wrapNextToShapeOutside(bool isFirstLine);
RenderBlockFlow& m_block;
float m_uncommittedWidth;
float m_committedWidth;
float m_overhangWidth;
float m_left;
float m_right;
float m_availableWidth;
bool m_isFirstLine;
IndentTextOrNot m_shouldIndentText;
};
}
#endif