Index: third_party/WebKit/Source/core/svg/SVGPathParser.h |
diff --git a/third_party/WebKit/Source/core/svg/SVGPathParser.h b/third_party/WebKit/Source/core/svg/SVGPathParser.h |
index 927458639ab95c2818bcab6a2e88531e95b0c4b0..7e5ceadbb29d88e5a9998b69e0a16a03eb374f4b 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGPathParser.h |
+++ b/third_party/WebKit/Source/core/svg/SVGPathParser.h |
@@ -31,36 +31,23 @@ |
namespace blink { |
class SVGPathConsumer; |
-class SVGPathSource; |
-class CORE_EXPORT SVGPathParser final { |
- WTF_MAKE_NONCOPYABLE(SVGPathParser); |
- STACK_ALLOCATED(); |
-public: |
- SVGPathParser(SVGPathSource* source, SVGPathConsumer* consumer) |
- : m_source(source) |
- , m_consumer(consumer) |
- { |
- ASSERT(m_source); |
- ASSERT(m_consumer); |
- } |
+namespace SVGPathParser { |
- bool parsePathDataFromSource(bool checkForInitialMoveTo = true) |
- { |
- ASSERT(m_source); |
- ASSERT(m_consumer); |
- if (checkForInitialMoveTo && !initialCommandIsMoveTo()) |
+template<typename SourceType, typename ConsumerType> |
+inline bool parsePath(SourceType& source, ConsumerType& consumer) |
+{ |
+ while (source.hasMoreData()) { |
+ PathSegmentData segment = source.parseSegment(); |
+ if (segment.command == PathSegUnknown) |
return false; |
- return parsePath(); |
- } |
-private: |
- bool initialCommandIsMoveTo(); |
- bool parsePath(); |
+ consumer.emitSegment(segment); |
+ } |
+ return true; |
+} |
- SVGPathSource* m_source; |
- SVGPathConsumer* m_consumer; |
-}; |
+} // namespace SVGPathParser |
class SVGPathNormalizer { |
STACK_ALLOCATED(); |