#ifndef SVGTextChunk_h
#define SVGTextChunk_h
#include "core/rendering/style/SVGRenderStyleDefs.h"
#include "core/svg/SVGTextContentElement.h"
namespace WebCore {
class SVGInlineTextBox;
class SVGTextChunk {
public:
enum ChunkStyle {
DefaultStyle = 1 << 0,
MiddleAnchor = 1 << 1,
EndAnchor = 1 << 2,
RightToLeftText = 1 << 3,
VerticalText = 1 << 4,
LengthAdjustSpacing = 1 << 5,
LengthAdjustSpacingAndGlyphs = 1 << 6
};
SVGTextChunk(unsigned chunkStyle, float desiredTextLength);
void calculateLength(float& length, unsigned& characters) const;
float calculateTextAnchorShift(float length) const;
bool isVerticalText() const { return m_chunkStyle & VerticalText; }
float desiredTextLength() const { return m_desiredTextLength; }
Vector<SVGInlineTextBox*>& boxes() { return m_boxes; }
const Vector<SVGInlineTextBox*>& boxes() const { return m_boxes; }
bool hasDesiredTextLength() const { return m_desiredTextLength > 0 && ((m_chunkStyle & LengthAdjustSpacing) || (m_chunkStyle & LengthAdjustSpacingAndGlyphs)); }
bool hasTextAnchor() const { return m_chunkStyle & RightToLeftText ? !(m_chunkStyle & EndAnchor) : (m_chunkStyle & MiddleAnchor) || (m_chunkStyle & EndAnchor); }
bool hasLengthAdjustSpacing() const { return m_chunkStyle & LengthAdjustSpacing; }
bool hasLengthAdjustSpacingAndGlyphs() const { return m_chunkStyle & LengthAdjustSpacingAndGlyphs; }
private:
Vector<SVGInlineTextBox*> m_boxes;
unsigned m_chunkStyle;
float m_desiredTextLength;
};
}
#endif