Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: third_party/WebKit/Source/core/svg/SVGPathParser.h

Issue 1646543004: Refactor away SVGPathSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use namespace Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.cpp ('k') | third_party/WebKit/Source/core/svg/SVGPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698