#ifndef SVGTextQuery_h
#define SVGTextQuery_h
#include "FloatRect.h"
#include "SVGPoint.h"
#include "SVGTextFragment.h"
#include <wtf/Vector.h>
namespace WebCore {
class InlineFlowBox;
class RenderObject;
class SVGInlineTextBox;
class SVGTextQuery {
public:
SVGTextQuery(RenderObject*);
unsigned numberOfCharacters() const;
float textLength() const;
float subStringLength(unsigned startPosition, unsigned length) const;
SVGPoint startPositionOfCharacter(unsigned position) const;
SVGPoint endPositionOfCharacter(unsigned position) const;
float rotationOfCharacter(unsigned position) const;
FloatRect extentOfCharacter(unsigned position) const;
int characterNumberAtPosition(const SVGPoint&) const;
struct Data;
private:
typedef bool (SVGTextQuery::*ProcessTextFragmentCallback)(Data*, const SVGTextFragment&) const;
bool executeQuery(Data*, ProcessTextFragmentCallback) const;
void collectTextBoxesInFlowBox(InlineFlowBox*);
bool mapStartEndPositionsIntoFragmentCoordinates(Data*, const SVGTextFragment&, int& startPosition, int& endPosition) const;
void modifyStartEndPositionsRespectingLigatures(Data*, int& startPosition, int& endPosition) const;
private:
bool numberOfCharactersCallback(Data*, const SVGTextFragment&) const;
bool textLengthCallback(Data*, const SVGTextFragment&) const;
bool subStringLengthCallback(Data*, const SVGTextFragment&) const;
bool startPositionOfCharacterCallback(Data*, const SVGTextFragment&) const;
bool endPositionOfCharacterCallback(Data*, const SVGTextFragment&) const;
bool rotationOfCharacterCallback(Data*, const SVGTextFragment&) const;
bool extentOfCharacterCallback(Data*, const SVGTextFragment&) const;
bool characterNumberAtPositionCallback(Data*, const SVGTextFragment&) const;
private:
Vector<SVGInlineTextBox*> m_textBoxes;
};
}
#endif