#ifndef SVGPathParser_h
#define SVGPathParser_h
#if ENABLE(SVG)
#include "SVGPathConsumer.h"
#include "SVGPathSeg.h"
#include "SVGPathSource.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class SVGPathParser {
WTF_MAKE_NONCOPYABLE(SVGPathParser); WTF_MAKE_FAST_ALLOCATED;
public:
SVGPathParser();
bool parsePathDataFromSource(PathParsingMode, bool checkForInitialMoveTo = true);
void setCurrentConsumer(SVGPathConsumer* consumer) { m_consumer = consumer; }
void setCurrentSource(SVGPathSource* source) { m_source = source; }
void cleanup();
private:
bool decomposeArcToCubic(float, float, float, FloatPoint&, FloatPoint&, bool largeArcFlag, bool sweepFlag);
void parseClosePathSegment();
bool parseMoveToSegment();
bool parseLineToSegment();
bool parseLineToHorizontalSegment();
bool parseLineToVerticalSegment();
bool parseCurveToCubicSegment();
bool parseCurveToCubicSmoothSegment();
bool parseCurveToQuadraticSegment();
bool parseCurveToQuadraticSmoothSegment();
bool parseArcToSegment();
SVGPathSource* m_source;
SVGPathConsumer* m_consumer;
PathCoordinateMode m_mode;
PathParsingMode m_pathParsingMode;
SVGPathSegType m_lastCommand;
bool m_closePath;
FloatPoint m_controlPoint;
FloatPoint m_currentPoint;
FloatPoint m_subPathPoint;
};
}
#endif // ENABLE(SVG)
#endif // SVGPathParser_h