[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

krit at webkit.org krit at webkit.org
Wed Dec 22 11:48:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 66b8de45bcf8947948469a7389d397ce0bb90e09
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 7 06:27:28 2010 +0000

    2010-08-06  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Generalize SVGPathParser to allow more than just strings as input source
            https://bugs.webkit.org/show_bug.cgi?id=43618
    
            Generalize SVGPathParser, by allowing different parsing sources than just strings.
            For now only a SVGPathStringSource is available, parsing from bytestreams follows soon.
            Each client that wants to parse strings, like Path or SVGPathSegList objects, only
            needs to use the new central SVGPathParserFactory, which glues consumer and sources together.
            Moved the SVGPathSegType enum from SVGPathSeg class in WebCore namespace, for
            easier access throughout the SVG code.
    
            Doesn't affect any tests.
    
            * Android.mk:
            * CMakeLists.txt
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj
            * svg/SVGAllInOne.cpp:
            * svg/SVGAnimateElement.cpp:
            (WebCore::SVGAnimateElement::calculateFromAndToValues):
            * svg/SVGAnimateMotionElement.cpp:
            (WebCore::SVGAnimateMotionElement::parseMappedAttribute):
            * svg/SVGGlyphElement.cpp:
            (WebCore::parsePathData):
            * svg/SVGPathBuilder.cpp:
            (WebCore::SVGPathBuilder::SVGPathBuilder):
            (WebCore::SVGPathBuilder::moveTo):
            (WebCore::SVGPathBuilder::lineTo):
            (WebCore::SVGPathBuilder::curveToCubic):
            (WebCore::SVGPathBuilder::closePath):
            * svg/SVGPathBuilder.h:
            (WebCore::SVGPathBuilder::setCurrentPath):
            (WebCore::SVGPathBuilder::arcTo):
            * svg/SVGPathConsumer.h:
            * svg/SVGPathElement.cpp:
            (WebCore::SVGPathElement::parseMappedAttribute):
            * svg/SVGPathParser.cpp:
            (WebCore::SVGPathParser::SVGPathParser):
            (WebCore::SVGPathParser::parseClosePathSegment):
            (WebCore::SVGPathParser::parseMoveToSegment):
            (WebCore::SVGPathParser::parseLineToSegment):
            (WebCore::SVGPathParser::parseLineToHorizontalSegment):
            (WebCore::SVGPathParser::parseLineToVerticalSegment):
            (WebCore::SVGPathParser::parseCurveToCubicSegment):
            (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment):
            (WebCore::SVGPathParser::parseCurveToQuadraticSegment):
            (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment):
            (WebCore::SVGPathParser::parseArcToSegment):
            (WebCore::SVGPathParser::parsePathDataFromSource):
            (WebCore::SVGPathParser::decomposeArcToCubic):
            * svg/SVGPathParser.h:
            (WebCore::SVGPathParser::setCurrentConsumer):
            * svg/SVGPathParserFactory.cpp: Added.
            (WebCore::globalSVGPathBuilder):
            (WebCore::globalSVGPathSegListBuilder):
            (WebCore::globalSVGPathParser):
            (WebCore::SVGPathParserFactory::self):
            (WebCore::SVGPathParserFactory::SVGPathParserFactory):
            (WebCore::SVGPathParserFactory::~SVGPathParserFactory):
            (WebCore::SVGPathParserFactory::buildPathFromString):
            (WebCore::SVGPathParserFactory::buildSVGPathSegListFromString):
            * svg/SVGPathParserFactory.h: Added.
            * svg/SVGPathSeg.h:
            (WebCore::):
            (WebCore::SVGPathSeg::~SVGPathSeg):
            (WebCore::SVGPathSeg::):
            (WebCore::SVGPathSeg::pathSegType):
            (WebCore::SVGPathSeg::pathSegTypeAsLetter):
            (WebCore::SVGPathSeg::toString):
            (WebCore::SVGPathSeg::associatedAttributeName):
            (WebCore::SVGPathSeg::SVGPathSeg):
            (WebCore::SVGPathSegSingleCoord::SVGPathSegSingleCoord):
            (WebCore::SVGPathSegSingleCoord::setX):
            (WebCore::SVGPathSegSingleCoord::x):
            (WebCore::SVGPathSegSingleCoord::setY):
            (WebCore::SVGPathSegSingleCoord::y):
            (WebCore::SVGPathSegSingleCoord::toString):
            * svg/SVGPathSegList.cpp:
            (WebCore::SVGPathSegList::getPathSegAtLength):
            (WebCore::SVGPathSegList::toPathData):
            (WebCore::SVGPathSegList::createAnimated):
            * svg/SVGPathSegListBuilder.cpp:
            (WebCore::SVGPathSegListBuilder::SVGPathSegListBuilder):
            (WebCore::SVGPathSegListBuilder::moveTo):
            (WebCore::SVGPathSegListBuilder::lineTo):
            (WebCore::SVGPathSegListBuilder::curveToCubic):
            (WebCore::SVGPathSegListBuilder::curveToCubicSmooth):
            (WebCore::SVGPathSegListBuilder::curveToQuadratic):
            (WebCore::SVGPathSegListBuilder::curveToQuadraticSmooth):
            (WebCore::SVGPathSegListBuilder::arcTo):
            * svg/SVGPathSegListBuilder.h:
            (WebCore::SVGPathSegListBuilder::setCurrentSVGPathSegList):
            * svg/SVGPathSource.h: Added.
            (WebCore::SVGPathSource::~SVGPathSource):
            (WebCore::SVGPathSource::SVGPathSource):
            * svg/SVGPathStringSource.cpp: Added.
            (WebCore::SVGPathStringSource::SVGPathStringSource):
            (WebCore::SVGPathStringSource::~SVGPathStringSource):
            (WebCore::SVGPathStringSource::endOfStream):
            (WebCore::SVGPathStringSource::parseFloat):
            (WebCore::SVGPathStringSource::parseFlag):
            (WebCore::SVGPathStringSource::skipSpaces):
            (WebCore::SVGPathStringSource::parseSVGSegmentType):
            (WebCore::SVGPathStringSource::hasRemainingCoordinatesInCurrentCommand):
            * svg/SVGPathStringSource.h: Added.
            (WebCore::SVGPathStringSource::create):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index e3eabbe..a175626 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -873,6 +873,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	svg/SVGPathBuilder.cpp \
 	svg/SVGPathElement.cpp \
 	svg/SVGPathParser.cpp \
+	svg/SVGPathParserFactory.cpp \
 	svg/SVGPathSeg.cpp \
 	svg/SVGPathSegArc.cpp \
 	svg/SVGPathSegClosePath.cpp \
@@ -886,6 +887,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	svg/SVGPathSegList.cpp \
 	svg/SVGPathSegListBuilder.cpp \
 	svg/SVGPathSegMoveto.cpp \
+	svg/SVGPathStringSource.cpp \
 	svg/SVGPatternElement.cpp \
 	svg/SVGPointList.cpp \
 	svg/SVGPolyElement.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 1b14899..a25714d 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1681,6 +1681,7 @@ IF (ENABLE_SVG)
         svg/SVGPathBuilder.cpp
         svg/SVGPathElement.cpp
         svg/SVGPathParser.cpp
+        svg/SVGPathParserFactory.cpp
         svg/SVGPathSeg.cpp
         svg/SVGPathSegArc.cpp
         svg/SVGPathSegClosePath.cpp
@@ -1694,6 +1695,7 @@ IF (ENABLE_SVG)
         svg/SVGPathSegList.cpp
         svg/SVGPathSegListBuilder.cpp
         svg/SVGPathSegMoveto.cpp
+        svg/SVGPathSourceString.cpp
         svg/SVGPatternElement.cpp
         svg/SVGPointList.cpp
         svg/SVGPolyElement.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c7b877c..54677bd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,116 @@
+2010-08-06  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Generalize SVGPathParser to allow more than just strings as input source
+        https://bugs.webkit.org/show_bug.cgi?id=43618
+
+        Generalize SVGPathParser, by allowing different parsing sources than just strings.
+        For now only a SVGPathStringSource is available, parsing from bytestreams follows soon.
+        Each client that wants to parse strings, like Path or SVGPathSegList objects, only
+        needs to use the new central SVGPathParserFactory, which glues consumer and sources together.
+        Moved the SVGPathSegType enum from SVGPathSeg class in WebCore namespace, for
+        easier access throughout the SVG code.
+
+        Doesn't affect any tests.
+
+        * Android.mk:
+        * CMakeLists.txt
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj
+        * svg/SVGAllInOne.cpp:
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::SVGAnimateElement::calculateFromAndToValues):
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::SVGAnimateMotionElement::parseMappedAttribute):
+        * svg/SVGGlyphElement.cpp:
+        (WebCore::parsePathData):
+        * svg/SVGPathBuilder.cpp:
+        (WebCore::SVGPathBuilder::SVGPathBuilder):
+        (WebCore::SVGPathBuilder::moveTo):
+        (WebCore::SVGPathBuilder::lineTo):
+        (WebCore::SVGPathBuilder::curveToCubic):
+        (WebCore::SVGPathBuilder::closePath):
+        * svg/SVGPathBuilder.h:
+        (WebCore::SVGPathBuilder::setCurrentPath):
+        (WebCore::SVGPathBuilder::arcTo):
+        * svg/SVGPathConsumer.h:
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::parseMappedAttribute):
+        * svg/SVGPathParser.cpp:
+        (WebCore::SVGPathParser::SVGPathParser):
+        (WebCore::SVGPathParser::parseClosePathSegment):
+        (WebCore::SVGPathParser::parseMoveToSegment):
+        (WebCore::SVGPathParser::parseLineToSegment):
+        (WebCore::SVGPathParser::parseLineToHorizontalSegment):
+        (WebCore::SVGPathParser::parseLineToVerticalSegment):
+        (WebCore::SVGPathParser::parseCurveToCubicSegment):
+        (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment):
+        (WebCore::SVGPathParser::parseCurveToQuadraticSegment):
+        (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment):
+        (WebCore::SVGPathParser::parseArcToSegment):
+        (WebCore::SVGPathParser::parsePathDataFromSource):
+        (WebCore::SVGPathParser::decomposeArcToCubic):
+        * svg/SVGPathParser.h:
+        (WebCore::SVGPathParser::setCurrentConsumer):
+        * svg/SVGPathParserFactory.cpp: Added.
+        (WebCore::globalSVGPathBuilder):
+        (WebCore::globalSVGPathSegListBuilder):
+        (WebCore::globalSVGPathParser):
+        (WebCore::SVGPathParserFactory::self):
+        (WebCore::SVGPathParserFactory::SVGPathParserFactory):
+        (WebCore::SVGPathParserFactory::~SVGPathParserFactory):
+        (WebCore::SVGPathParserFactory::buildPathFromString):
+        (WebCore::SVGPathParserFactory::buildSVGPathSegListFromString):
+        * svg/SVGPathParserFactory.h: Added.
+        * svg/SVGPathSeg.h:
+        (WebCore::):
+        (WebCore::SVGPathSeg::~SVGPathSeg):
+        (WebCore::SVGPathSeg::):
+        (WebCore::SVGPathSeg::pathSegType):
+        (WebCore::SVGPathSeg::pathSegTypeAsLetter):
+        (WebCore::SVGPathSeg::toString):
+        (WebCore::SVGPathSeg::associatedAttributeName):
+        (WebCore::SVGPathSeg::SVGPathSeg):
+        (WebCore::SVGPathSegSingleCoord::SVGPathSegSingleCoord):
+        (WebCore::SVGPathSegSingleCoord::setX):
+        (WebCore::SVGPathSegSingleCoord::x):
+        (WebCore::SVGPathSegSingleCoord::setY):
+        (WebCore::SVGPathSegSingleCoord::y):
+        (WebCore::SVGPathSegSingleCoord::toString):
+        * svg/SVGPathSegList.cpp:
+        (WebCore::SVGPathSegList::getPathSegAtLength):
+        (WebCore::SVGPathSegList::toPathData):
+        (WebCore::SVGPathSegList::createAnimated):
+        * svg/SVGPathSegListBuilder.cpp:
+        (WebCore::SVGPathSegListBuilder::SVGPathSegListBuilder):
+        (WebCore::SVGPathSegListBuilder::moveTo):
+        (WebCore::SVGPathSegListBuilder::lineTo):
+        (WebCore::SVGPathSegListBuilder::curveToCubic):
+        (WebCore::SVGPathSegListBuilder::curveToCubicSmooth):
+        (WebCore::SVGPathSegListBuilder::curveToQuadratic):
+        (WebCore::SVGPathSegListBuilder::curveToQuadraticSmooth):
+        (WebCore::SVGPathSegListBuilder::arcTo):
+        * svg/SVGPathSegListBuilder.h:
+        (WebCore::SVGPathSegListBuilder::setCurrentSVGPathSegList):
+        * svg/SVGPathSource.h: Added.
+        (WebCore::SVGPathSource::~SVGPathSource):
+        (WebCore::SVGPathSource::SVGPathSource):
+        * svg/SVGPathStringSource.cpp: Added.
+        (WebCore::SVGPathStringSource::SVGPathStringSource):
+        (WebCore::SVGPathStringSource::~SVGPathStringSource):
+        (WebCore::SVGPathStringSource::endOfStream):
+        (WebCore::SVGPathStringSource::parseFloat):
+        (WebCore::SVGPathStringSource::parseFlag):
+        (WebCore::SVGPathStringSource::skipSpaces):
+        (WebCore::SVGPathStringSource::parseSVGSegmentType):
+        (WebCore::SVGPathStringSource::hasRemainingCoordinatesInCurrentCommand):
+        * svg/SVGPathStringSource.h: Added.
+        (WebCore::SVGPathStringSource::create):
+
 2010-08-06  Robert Hogan  <robert at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 03329ee..0e5ea3d 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -4079,6 +4079,8 @@ webcore_sources += \
 	WebCore/svg/SVGPathElement.h \
 	WebCore/svg/SVGPathParser.cpp \
 	WebCore/svg/SVGPathParser.h \
+	WebCore/svg/SVGPathParserFactory.cpp \
+	WebCore/svg/SVGPathParserFactory.h \
 	WebCore/svg/SVGPathSeg.cpp \
 	WebCore/svg/SVGPathSeg.h \
 	WebCore/svg/SVGPathSegArc.cpp \
@@ -4105,6 +4107,9 @@ webcore_sources += \
 	WebCore/svg/SVGPathSegListBuilder.h \
 	WebCore/svg/SVGPathSegMoveto.cpp \
 	WebCore/svg/SVGPathSegMoveto.h \
+	WebCore/svg/SVGPathSource.h \
+	WebCore/svg/SVGPathStringSource.cpp \
+	WebCore/svg/SVGPathStringSource.h \
 	WebCore/svg/SVGPatternElement.cpp \
 	WebCore/svg/SVGPatternElement.h \
 	WebCore/svg/SVGPointList.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 33efa82..28bc124 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3833,6 +3833,8 @@
             'svg/SVGPathElement.h',
             'svg/SVGPathParser.cpp',
             'svg/SVGPathParser.h',
+            'svg/SVGPathParserFactory.cpp',
+            'svg/SVGPathParserFactory.h',
             'svg/SVGPathSeg.cpp',
             'svg/SVGPathSeg.h',
             'svg/SVGPathSegArc.cpp',
@@ -3859,6 +3861,9 @@
             'svg/SVGPathSegListBuilder.h',
             'svg/SVGPathSegMoveto.cpp',
             'svg/SVGPathSegMoveto.h',
+            'svg/SVGPathSource.h',
+            'svg/SVGPathStringSource.cpp',
+            'svg/SVGPathStringSource.h',
             'svg/SVGPatternElement.cpp',
             'svg/SVGPatternElement.h',
             'svg/SVGPointList.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 6e1a79b..6d69ec6 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2855,6 +2855,7 @@ contains(DEFINES, ENABLE_SVG=1) {
         svg/SVGPathBuilder.cpp \
         svg/SVGPathElement.cpp \
         svg/SVGPathParser.cpp \
+        svg/SVGPathParserFactory.cpp \
         svg/SVGPathSeg.cpp \
         svg/SVGPathSegArc.cpp \
         svg/SVGPathSegClosePath.cpp \
@@ -2868,6 +2869,7 @@ contains(DEFINES, ENABLE_SVG=1) {
         svg/SVGPathSegList.cpp \
         svg/SVGPathSegListBuilder.cpp \
         svg/SVGPathSegMoveto.cpp \
+        svg/SVGPathStringSource.cpp \
         svg/SVGPatternElement.cpp \
         svg/SVGPointList.cpp \
         svg/SVGPolyElement.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 995a3d5..2297fd9 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -49453,6 +49453,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\svg\SVGPathParserFactory.h"
+				>
+			</File>
+			<File
 				RelativePath="..\svg\SVGPathSeg.h"
 				>
 			</File>
@@ -49505,6 +49509,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\svg\SVGPathSource.h"
+				>
+			</File>
+			<File
+				RelativePath="..\svg\SVGPathStringSource.h"
+				>
+			</File>
+			<File
 				RelativePath="..\svg\SVGPatternElement.h"
 				>
 			</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 4b2064e..48a54dc 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1441,6 +1441,11 @@
 		8422418E107E786F00766A87 /* DOMSVGFEMorphologyElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8422418B107E786F00766A87 /* DOMSVGFEMorphologyElementInternal.h */; };
 		84224193107E78A700766A87 /* SVGFEMorphologyElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84224190107E78A700766A87 /* SVGFEMorphologyElement.cpp */; };
 		84224194107E78A700766A87 /* SVGFEMorphologyElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 84224191107E78A700766A87 /* SVGFEMorphologyElement.h */; };
+		84300BD3120C9A710021954A /* SVGPathParserFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84300BD1120C9A710021954A /* SVGPathParserFactory.cpp */; };
+		84300BD4120C9A710021954A /* SVGPathParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 84300BD2120C9A710021954A /* SVGPathParserFactory.h */; };
+		84300BD6120C9AAC0021954A /* SVGPathStringSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84300BD5120C9AAC0021954A /* SVGPathStringSource.h */; };
+		84300BD8120C9AD40021954A /* SVGPathSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84300BD7120C9AD40021954A /* SVGPathSource.h */; };
+		84300BDA120C9AED0021954A /* SVGPathStringSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84300BD9120C9AED0021954A /* SVGPathStringSource.cpp */; };
 		845E72F80FD261EE00A87D79 /* Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72F70FD261EE00A87D79 /* Filter.h */; };
 		845E72FB0FD2623900A87D79 /* SVGFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 845E72F90FD2623900A87D79 /* SVGFilter.cpp */; };
 		845E72FC0FD2623900A87D79 /* SVGFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72FA0FD2623900A87D79 /* SVGFilter.h */; };
@@ -7266,6 +7271,11 @@
 		84224190107E78A700766A87 /* SVGFEMorphologyElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEMorphologyElement.cpp; sourceTree = "<group>"; };
 		84224191107E78A700766A87 /* SVGFEMorphologyElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEMorphologyElement.h; sourceTree = "<group>"; };
 		84224192107E78A700766A87 /* SVGFEMorphologyElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGFEMorphologyElement.idl; sourceTree = "<group>"; };
+		84300BD1120C9A710021954A /* SVGPathParserFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathParserFactory.cpp; sourceTree = "<group>"; };
+		84300BD2120C9A710021954A /* SVGPathParserFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathParserFactory.h; sourceTree = "<group>"; };
+		84300BD5120C9AAC0021954A /* SVGPathStringSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathStringSource.h; sourceTree = "<group>"; };
+		84300BD7120C9AD40021954A /* SVGPathSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSource.h; sourceTree = "<group>"; };
+		84300BD9120C9AED0021954A /* SVGPathStringSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathStringSource.cpp; sourceTree = "<group>"; };
 		845E72F70FD261EE00A87D79 /* Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filter.h; path = filters/Filter.h; sourceTree = "<group>"; };
 		845E72F90FD2623900A87D79 /* SVGFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilter.cpp; sourceTree = "<group>"; };
 		845E72FA0FD2623900A87D79 /* SVGFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilter.h; sourceTree = "<group>"; };
@@ -11408,7 +11418,6 @@
 		1AE82EC90CAAE177002237AE /* storage */ = {
 			isa = PBXGroup;
 			children = (
-
 				B5B5DC67119BB3D5002A8790 /* AbstractDatabase.cpp */,
 				B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */,
 				514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */,
@@ -15298,6 +15307,8 @@
 				B22278C40D00BF200071B782 /* SVGPathElement.idl */,
 				8476C9ED11DF6A5800555B02 /* SVGPathParser.cpp */,
 				8476C9EE11DF6A5800555B02 /* SVGPathParser.h */,
+				84300BD1120C9A710021954A /* SVGPathParserFactory.cpp */,
+				84300BD2120C9A710021954A /* SVGPathParserFactory.h */,
 				A8BCFD04120A046100B5F122 /* SVGPathSeg.cpp */,
 				B22278C50D00BF200071B782 /* SVGPathSeg.h */,
 				B22278C60D00BF200071B782 /* SVGPathSeg.idl */,
@@ -15345,6 +15356,9 @@
 				B22278EE0D00BF210071B782 /* SVGPathSegMoveto.h */,
 				B22278EF0D00BF210071B782 /* SVGPathSegMovetoAbs.idl */,
 				B22278F00D00BF210071B782 /* SVGPathSegMovetoRel.idl */,
+				84300BD7120C9AD40021954A /* SVGPathSource.h */,
+				84300BD9120C9AED0021954A /* SVGPathStringSource.cpp */,
+				84300BD5120C9AAC0021954A /* SVGPathStringSource.h */,
 				B22278F10D00BF210071B782 /* SVGPatternElement.cpp */,
 				B22278F20D00BF210071B782 /* SVGPatternElement.h */,
 				B22278F30D00BF210071B782 /* SVGPatternElement.idl */,
@@ -19798,6 +19812,7 @@
 				8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */,
 				B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */,
 				8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */,
+				84300BD4120C9A710021954A /* SVGPathParserFactory.h in Headers */,
 				B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */,
 				B2227A5E0D00BF220071B782 /* SVGPathSegArc.h in Headers */,
 				B2227A620D00BF220071B782 /* SVGPathSegClosePath.h in Headers */,
@@ -19811,6 +19826,8 @@
 				B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
 				8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
 				B2227A840D00BF220071B782 /* SVGPathSegMoveto.h in Headers */,
+				84300BD8120C9AD40021954A /* SVGPathSource.h in Headers */,
+				84300BD6120C9AAC0021954A /* SVGPathStringSource.h in Headers */,
 				B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
 				B25599950D00D8BA00BB825C /* SVGPointLightSource.h in Headers */,
 				B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
@@ -22257,6 +22274,7 @@
 				8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */,
 				B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */,
 				8476C9EF11DF6A5800555B02 /* SVGPathParser.cpp in Sources */,
+				84300BD3120C9A710021954A /* SVGPathParserFactory.cpp in Sources */,
 				A8BCFD05120A046100B5F122 /* SVGPathSeg.cpp in Sources */,
 				B2227A5D0D00BF220071B782 /* SVGPathSegArc.cpp in Sources */,
 				B2227A610D00BF220071B782 /* SVGPathSegClosePath.cpp in Sources */,
@@ -22270,6 +22288,7 @@
 				B2227A800D00BF220071B782 /* SVGPathSegList.cpp in Sources */,
 				8476C9E511DF6A0B00555B02 /* SVGPathSegListBuilder.cpp in Sources */,
 				B2227A830D00BF220071B782 /* SVGPathSegMoveto.cpp in Sources */,
+				84300BDA120C9AED0021954A /* SVGPathStringSource.cpp in Sources */,
 				B2227A870D00BF220071B782 /* SVGPatternElement.cpp in Sources */,
 				B2227A8B0D00BF220071B782 /* SVGPointList.cpp in Sources */,
 				B2227A8E0D00BF220071B782 /* SVGPolyElement.cpp in Sources */,
diff --git a/WebCore/svg/SVGAllInOne.cpp b/WebCore/svg/SVGAllInOne.cpp
index acfb6ad..a046492 100644
--- a/WebCore/svg/SVGAllInOne.cpp
+++ b/WebCore/svg/SVGAllInOne.cpp
@@ -110,6 +110,7 @@
 #include "SVGPathBuilder.cpp"
 #include "SVGPathElement.cpp"
 #include "SVGPathParser.cpp"
+#include "SVGPathParserFactory.cpp"
 #include "SVGPathSeg.cpp"
 #include "SVGPathSegArc.cpp"
 #include "SVGPathSegClosePath.cpp"
@@ -123,6 +124,7 @@
 #include "SVGPathSegList.cpp"
 #include "SVGPathSegListBuilder.cpp"
 #include "SVGPathSegMoveto.cpp"
+#include "SVGPathStringSource.cpp"
 #include "SVGPatternElement.cpp"
 #include "SVGPointList.cpp"
 #include "SVGPolyElement.cpp"
diff --git a/WebCore/svg/SVGAnimateElement.cpp b/WebCore/svg/SVGAnimateElement.cpp
index f05321f..07e46b4 100644
--- a/WebCore/svg/SVGAnimateElement.cpp
+++ b/WebCore/svg/SVGAnimateElement.cpp
@@ -27,8 +27,8 @@
 #include "FloatConversion.h"
 #include "SVGColor.h"
 #include "SVGParserUtilities.h"
+#include "SVGPathParserFactory.h"
 #include "SVGPathSegList.h"
-#include "SVGPathSegListBuilder.h"
 #include "SVGPointList.h"
 #include <math.h>
 
@@ -190,11 +190,10 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
         }
     } else if (m_propertyType == PathProperty) {
         m_fromPath = SVGPathSegList::create(SVGNames::dAttr);
-        SVGPathSegListBuilder fromParser(m_fromPath.get());
-        if (fromParser.build(fromString, UnalteredParsing)) {
+        SVGPathParserFactory* factory = SVGPathParserFactory::self();
+        if (factory->buildSVGPathSegListFromString(fromString, m_fromPath.get(), UnalteredParsing)) {
             m_toPath = SVGPathSegList::create(SVGNames::dAttr);
-            SVGPathSegListBuilder toParser(m_toPath.get());
-            if (toParser.build(toString, UnalteredParsing))
+            if (factory->buildSVGPathSegListFromString(toString, m_toPath.get(), UnalteredParsing))
                 return true;
         }
         m_fromPath.clear();
diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp
index c1fdc76..4ddda73 100644
--- a/WebCore/svg/SVGAnimateMotionElement.cpp
+++ b/WebCore/svg/SVGAnimateMotionElement.cpp
@@ -30,7 +30,7 @@
 #include "SVGElementInstance.h"
 #include "SVGMPathElement.h"
 #include "SVGParserUtilities.h"
-#include "SVGPathBuilder.h"
+#include "SVGPathParserFactory.h"
 #include "SVGPathElement.h"
 #include "SVGTransformList.h"
 #include <math.h>
@@ -87,9 +87,8 @@ void SVGAnimateMotionElement::parseMappedAttribute(Attribute* attr)
 {
     if (attr->name() == SVGNames::pathAttr) {
         m_path = Path();
-        SVGPathBuilder builder(m_path);
-        // FIXME: We should analyse the returned value.
-        builder.build(attr->value());
+        SVGPathParserFactory* factory = SVGPathParserFactory::self();
+        factory->buildPathFromString(attr->value(), m_path);
     } else
         SVGAnimationElement::parseMappedAttribute(attr);
 }
diff --git a/WebCore/svg/SVGGlyphElement.cpp b/WebCore/svg/SVGGlyphElement.cpp
index 57a1caf..2c84841 100644
--- a/WebCore/svg/SVGGlyphElement.cpp
+++ b/WebCore/svg/SVGGlyphElement.cpp
@@ -29,7 +29,7 @@
 #include "SVGFontElement.h"
 #include "SVGFontFaceElement.h"
 #include "SVGNames.h"
-#include "SVGPathBuilder.h"
+#include "SVGPathParserFactory.h"
 #include "SimpleFontData.h"
 #include "XMLNames.h"
 
@@ -102,10 +102,8 @@ static inline SVGGlyphIdentifier::Orientation parseOrientation(const AtomicStrin
 static inline Path parsePathData(const AtomicString& value)
 {
     Path result;
-    SVGPathBuilder builder(result);
-    // FIXME: We should analyse the returned value.
-    builder.build(value);
-
+    SVGPathParserFactory* factory = SVGPathParserFactory::self();
+    factory->buildPathFromString(value, result);
     return result;
 }
 
diff --git a/WebCore/svg/SVGPathBuilder.cpp b/WebCore/svg/SVGPathBuilder.cpp
index be0387f..85fbd65 100644
--- a/WebCore/svg/SVGPathBuilder.cpp
+++ b/WebCore/svg/SVGPathBuilder.cpp
@@ -26,49 +26,45 @@
 #if ENABLE(SVG)
 #include "SVGPathBuilder.h"
 
-#include "SVGPathParser.h"
-
 namespace WebCore {
 
-SVGPathBuilder::SVGPathBuilder(Path& path)
-    : m_path(path)
-{
-}
-
-bool SVGPathBuilder::build(const String& d)
+SVGPathBuilder::SVGPathBuilder()
+    : m_path(0)
 {
-    SVGPathParser parser(this);
-    return parser.parsePathDataString(d, true);
 }
 
-void SVGPathBuilder::moveTo(const FloatPoint& point, bool closed, PathCoordinateMode mode)
+void SVGPathBuilder::moveTo(const FloatPoint& targetPoint, bool closed, PathCoordinateMode mode)
 {
-    m_current = mode == AbsoluteCoordinates ? point : m_current + point;
+    ASSERT(m_path);
+    m_current = mode == AbsoluteCoordinates ? targetPoint : m_current + targetPoint;
     if (closed)
-        m_path.closeSubpath();
-    m_path.moveTo(m_current);
+        m_path->closeSubpath();
+    m_path->moveTo(m_current);
 }
 
-void SVGPathBuilder::lineTo(const FloatPoint& point, PathCoordinateMode mode)
+void SVGPathBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
-    m_current = mode == AbsoluteCoordinates ? point : m_current + point;
-    m_path.addLineTo(m_current);
+    ASSERT(m_path);
+    m_current = mode == AbsoluteCoordinates ? targetPoint : m_current + targetPoint;
+    m_path->addLineTo(m_current);
 }
 
-void SVGPathBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& point, PathCoordinateMode mode)
+void SVGPathBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_path);
     if (mode == RelativeCoordinates) {
-        m_path.addBezierCurveTo(m_current + point1, m_current + point2, m_current + point);
-        m_current += point;
+        m_path->addBezierCurveTo(m_current + point1, m_current + point2, m_current + targetPoint);
+        m_current += targetPoint;
     } else {
-        m_current = point;
-        m_path.addBezierCurveTo(point1, point2, m_current);
+        m_current = targetPoint;
+        m_path->addBezierCurveTo(point1, point2, m_current);
     }    
 }
 
 void SVGPathBuilder::closePath()
 {
-    m_path.closeSubpath();
+    ASSERT(m_path);
+    m_path->closeSubpath();
 }
 
 }
diff --git a/WebCore/svg/SVGPathBuilder.h b/WebCore/svg/SVGPathBuilder.h
index b7d9c2e..6a0669a 100644
--- a/WebCore/svg/SVGPathBuilder.h
+++ b/WebCore/svg/SVGPathBuilder.h
@@ -31,10 +31,11 @@
 
 namespace WebCore {
 
-class SVGPathBuilder : private SVGPathConsumer {
+class SVGPathBuilder : public SVGPathConsumer {
 public:
-    SVGPathBuilder(Path&);
-    bool build(const String&);
+    SVGPathBuilder();
+
+    void setCurrentPath(Path* path) { m_path = path; }
 
 private:
     // Used in UnalteredParisng/NormalizedParsing modes.
@@ -50,9 +51,9 @@ private:
     virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
     virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
     virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
-    virtual void arcTo(const FloatPoint&, float, float, float, bool, bool, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
+    virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); }
 
-    Path& m_path;
+    Path* m_path;
     FloatPoint m_current;
 };
 
diff --git a/WebCore/svg/SVGPathConsumer.h b/WebCore/svg/SVGPathConsumer.h
index f70a275..fc7ba38 100644
--- a/WebCore/svg/SVGPathConsumer.h
+++ b/WebCore/svg/SVGPathConsumer.h
@@ -26,6 +26,7 @@
 
 #if ENABLE(SVG)
 #include "FloatPoint.h"
+#include <wtf/Noncopyable.h>
 
 namespace WebCore {
 
@@ -39,7 +40,7 @@ enum PathParsingMode {
     UnalteredParsing
 };
 
-class SVGPathConsumer {
+class SVGPathConsumer : public Noncopyable {
 public:
     // Used in UnalteredParisng/NormalizedParsing modes.
     virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) = 0;
@@ -54,7 +55,7 @@ public:
     virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) = 0;
     virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) = 0;
     virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) = 0;
-    virtual void arcTo(const FloatPoint&, float, float, float, bool largeArcFlag, bool sweepFlag, PathCoordinateMode) = 0;
+    virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode) = 0;
 
 protected:
     SVGPathConsumer() { }
diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp
index 4e6ddcd..ee619b6 100644
--- a/WebCore/svg/SVGPathElement.cpp
+++ b/WebCore/svg/SVGPathElement.cpp
@@ -27,6 +27,7 @@
 #include "RenderPath.h"
 #include "RenderSVGResource.h"
 #include "SVGNames.h"
+#include "SVGPathParserFactory.h"
 #include "SVGPathSegArc.h"
 #include "SVGPathSegClosePath.h"
 #include "SVGPathSegCurvetoCubic.h"
@@ -173,8 +174,8 @@ void SVGPathElement::parseMappedAttribute(Attribute* attr)
     if (attr->name() == SVGNames::dAttr) {
         ExceptionCode ec;
         pathSegList()->clear(ec);
-        SVGPathSegListBuilder parser(pathSegList());
-        if (!parser.build(attr->value(), NormalizedParsing))
+        SVGPathParserFactory* factory = SVGPathParserFactory::self();
+        if (!factory->buildSVGPathSegListFromString(attr->value(), pathSegList(), NormalizedParsing))
             document()->accessSVGExtensions()->reportError("Problem parsing d=\"" + attr->value() + "\"");
     } else if (attr->name() == SVGNames::pathLengthAttr) {
         setPathLengthBaseValue(attr->value().toFloat());
diff --git a/WebCore/svg/SVGPathParser.cpp b/WebCore/svg/SVGPathParser.cpp
index 13e9c46..94b7c43 100644
--- a/WebCore/svg/SVGPathParser.cpp
+++ b/WebCore/svg/SVGPathParser.cpp
@@ -27,15 +27,14 @@
 #include "SVGPathParser.h"
 
 #include "AffineTransform.h"
-#include "SVGParserUtilities.h"
 #include <wtf/MathExtras.h>
 
 static const float gOneOverThree = 1 / 3.f;
 
 namespace WebCore {
 
-SVGPathParser::SVGPathParser(SVGPathConsumer* consumer)
-    : m_consumer(consumer)
+SVGPathParser::SVGPathParser()
+    : m_consumer(0)
 {
 }
 
@@ -46,9 +45,9 @@ SVGPathParser::~SVGPathParser()
 void SVGPathParser::parseClosePathSegment()
 {
     // Reset m_currentPoint for the next path.
-    if (m_normalized)
+    if (m_pathParsingMode == NormalizedParsing)
         m_currentPoint = m_subPathPoint;
-    m_pathClosed = true;
+    m_closePath = true;
     m_consumer->closePath();
 }
 
@@ -56,20 +55,20 @@ bool SVGPathParser::parseMoveToSegment()
 {
     float toX;
     float toY;
-    if (!parseNumber(m_ptr, m_end, toX) || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
         return false;
 
     FloatPoint toPoint(toX, toY);
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         if (m_mode == RelativeCoordinates)
             m_currentPoint += toPoint;
         else
             m_currentPoint = toPoint;
         m_subPathPoint = m_currentPoint;
-        m_consumer->moveTo(m_currentPoint, m_pathClosed, AbsoluteCoordinates);
+        m_consumer->moveTo(m_currentPoint, m_closePath, AbsoluteCoordinates);
     } else
-        m_consumer->moveTo(toPoint, m_pathClosed, m_mode);
-    m_pathClosed = false;
+        m_consumer->moveTo(toPoint, m_closePath, m_mode);
+    m_closePath = false;
     return true;
 }
 
@@ -77,11 +76,11 @@ bool SVGPathParser::parseLineToSegment()
 {
     float toX;
     float toY;
-    if (!parseNumber(m_ptr, m_end, toX) || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
         return false;
 
     FloatPoint toPoint(toX, toY);
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         if (m_mode == RelativeCoordinates)
             m_currentPoint += toPoint;
         else
@@ -95,10 +94,10 @@ bool SVGPathParser::parseLineToSegment()
 bool SVGPathParser::parseLineToHorizontalSegment()
 {
     float toX;
-    if (!parseNumber(m_ptr, m_end, toX))
+    if (!m_source->parseFloat(toX))
         return false;
 
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         if (m_mode == RelativeCoordinates)
             m_currentPoint.move(toX, 0);
         else
@@ -112,10 +111,10 @@ bool SVGPathParser::parseLineToHorizontalSegment()
 bool SVGPathParser::parseLineToVerticalSegment()
 {
     float toY;
-    if (!parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(toY))
         return false;
 
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         if (m_mode == RelativeCoordinates)
             m_currentPoint.move(0, toY);
         else
@@ -134,29 +133,29 @@ bool SVGPathParser::parseCurveToCubicSegment()
     float y2;
     float toX;
     float toY; 
-    if (!parseNumber(m_ptr, m_end, x1)
-        || !parseNumber(m_ptr, m_end, y1)
-        || !parseNumber(m_ptr, m_end, x2)
-        || !parseNumber(m_ptr, m_end, y2)
-        || !parseNumber(m_ptr, m_end, toX)
-        || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(x1)
+        || !m_source->parseFloat(y1)
+        || !m_source->parseFloat(x2)
+        || !m_source->parseFloat(y2)
+        || !m_source->parseFloat(toX)
+        || !m_source->parseFloat(toY))
         return false;
 
     FloatPoint point1(x1, y1);
     FloatPoint point2(x2, y2);
-    FloatPoint point3(toX, toY);
-    if (m_normalized) {
+    FloatPoint targetPoint(toX, toY);
+    if (m_pathParsingMode == NormalizedParsing) {
         if (m_mode == RelativeCoordinates) {
             point1 += m_currentPoint;
             point2 += m_currentPoint;
-            point3 += m_currentPoint;
+            targetPoint += m_currentPoint;
         }
-        m_consumer->curveToCubic(point1, point2, point3, AbsoluteCoordinates);
+        m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
 
         m_controlPoint = point2;
-        m_currentPoint = point3;
+        m_currentPoint = targetPoint;
     } else
-        m_consumer->curveToCubic(point1, point2, point3, m_mode);
+        m_consumer->curveToCubic(point1, point2, targetPoint, m_mode);
     return true;
 }
 
@@ -166,35 +165,35 @@ bool SVGPathParser::parseCurveToCubicSmoothSegment()
     float y2;
     float toX;
     float toY; 
-    if (!parseNumber(m_ptr, m_end, x2)
-        || !parseNumber(m_ptr, m_end, y2)
-        || !parseNumber(m_ptr, m_end, toX)
-        || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(x2)
+        || !m_source->parseFloat(y2)
+        || !m_source->parseFloat(toX)
+        || !m_source->parseFloat(toY))
         return false;
 
-    if (m_lastCommand != 'c'
-        && m_lastCommand != 'C'
-        && m_lastCommand != 's'
-        && m_lastCommand != 'S')
+    if (m_lastCommand != PathSegCurveToCubicAbs
+        && m_lastCommand != PathSegCurveToCubicRel
+        && m_lastCommand != PathSegCurveToCubicSmoothAbs
+        && m_lastCommand != PathSegCurveToCubicSmoothRel)
         m_controlPoint = m_currentPoint;
 
     FloatPoint point2(x2, y2);
-    FloatPoint point3(toX, toY);
-    if (m_normalized) {
+    FloatPoint targetPoint(toX, toY);
+    if (m_pathParsingMode == NormalizedParsing) {
         FloatPoint point1 = m_currentPoint;
         point1.scale(2, 2);
         point1.move(-m_controlPoint.x(), -m_controlPoint.y());
         if (m_mode == RelativeCoordinates) {
             point2 += m_currentPoint;
-            point3 += m_currentPoint;
+            targetPoint += m_currentPoint;
         }
 
-        m_consumer->curveToCubic(point1, point2, point3, AbsoluteCoordinates);
+        m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
 
         m_controlPoint = point2;
-        m_currentPoint = point3;
+        m_currentPoint = targetPoint;
     } else
-        m_consumer->curveToCubicSmooth(point2, point3, m_mode);
+        m_consumer->curveToCubicSmooth(point2, targetPoint, m_mode);
     return true;
 }
 
@@ -204,33 +203,33 @@ bool SVGPathParser::parseCurveToQuadraticSegment()
     float y1;
     float toX;
     float toY;
-    if (!parseNumber(m_ptr, m_end, x1)
-        || !parseNumber(m_ptr, m_end, y1)
-        || !parseNumber(m_ptr, m_end, toX)
-        || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(x1)
+        || !m_source->parseFloat(y1)
+        || !m_source->parseFloat(toX)
+        || !m_source->parseFloat(toY))
         return false;
 
-    FloatPoint point3(toX, toY);
-    if (m_normalized) {
+    FloatPoint targetPoint(toX, toY);
+    if (m_pathParsingMode == NormalizedParsing) {
         FloatPoint point1 = m_currentPoint;
         point1.move(2 * x1, 2 * y1);
         FloatPoint point2(toX + 2 * x1, toY + 2 * y1);
         if (m_mode == RelativeCoordinates) {
             point1.move(2 * m_currentPoint.x(), 2 * m_currentPoint.y());
             point2.move(3 * m_currentPoint.x(), 3 * m_currentPoint.y());
-            point3 += m_currentPoint;
+            targetPoint += m_currentPoint;
         }
         point1.scale(gOneOverThree, gOneOverThree);
         point2.scale(gOneOverThree, gOneOverThree);
 
-        m_consumer->curveToCubic(point1, point2, point3, AbsoluteCoordinates);
+        m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
 
         m_controlPoint = FloatPoint(x1, y1);
         if (m_mode == RelativeCoordinates)
             m_controlPoint += m_currentPoint;
-        m_currentPoint = point3;
+        m_currentPoint = targetPoint;
     } else
-        m_consumer->curveToQuadratic(FloatPoint(x1, y1), point3, m_mode);
+        m_consumer->curveToQuadratic(FloatPoint(x1, y1), targetPoint, m_mode);
     return true;
 }
 
@@ -238,32 +237,33 @@ bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
 {
     float toX;
     float toY;
-    if (!parseNumber(m_ptr, m_end, toX) || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
         return false;
-    if (m_lastCommand != 'q'
-        && m_lastCommand != 'Q'
-        && m_lastCommand != 't'
-        && m_lastCommand != 'T')
+
+    if (m_lastCommand != PathSegCurveToQuadraticAbs
+        && m_lastCommand != PathSegCurveToQuadraticRel
+        && m_lastCommand != PathSegCurveToQuadraticSmoothAbs
+        && m_lastCommand != PathSegCurveToQuadraticSmoothRel)
         m_controlPoint = m_currentPoint;
 
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         FloatPoint cubicPoint = m_currentPoint;
         cubicPoint.scale(2, 2);
         cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y());
         FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y() + 2 * cubicPoint.y());
         FloatPoint point2(toX + 2 * cubicPoint.x(), toY + 2 * cubicPoint.y());
-        FloatPoint point3(toX, toY);
+        FloatPoint targetPoint(toX, toY);
         if (m_mode == RelativeCoordinates) {
             point2 += m_currentPoint;
-            point3 += m_currentPoint;
+            targetPoint += m_currentPoint;
         }
         point1.scale(gOneOverThree, gOneOverThree);
         point2.scale(gOneOverThree, gOneOverThree);
 
-        m_consumer->curveToCubic(point1, point2, point3, AbsoluteCoordinates);
+        m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
 
         m_controlPoint = cubicPoint;
-        m_currentPoint = point3;
+        m_currentPoint = targetPoint;
     } else
         m_consumer->curveToQuadraticSmooth(FloatPoint(toX, toY), m_mode);
     return true;
@@ -278,115 +278,126 @@ bool SVGPathParser::parseArcToSegment()
     float ry;
     float toX;
     float toY;
-    if (!parseNumber(m_ptr, m_end, rx)
-        || !parseNumber(m_ptr, m_end, ry)
-        || !parseNumber(m_ptr, m_end, angle)
-        || !parseArcFlag(m_ptr, m_end, largeArc)
-        || !parseArcFlag(m_ptr, m_end, sweep)
-        || !parseNumber(m_ptr, m_end, toX)
-        || !parseNumber(m_ptr, m_end, toY))
+    if (!m_source->parseFloat(rx)
+        || !m_source->parseFloat(ry)
+        || !m_source->parseFloat(angle)
+        || !m_source->parseFlag(largeArc)
+        || !m_source->parseFlag(sweep)
+        || !m_source->parseFloat(toX)
+        || !m_source->parseFloat(toY))
         return false;
 
-    FloatPoint point2 = FloatPoint(toX, toY);
+    FloatPoint targetPoint = FloatPoint(toX, toY);
     // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a "lineto") joining the endpoints.
     // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters
     rx = fabsf(rx);
     ry = fabsf(ry);
     if (!rx || !ry) {
-        if (m_normalized) {
+        if (m_pathParsingMode == NormalizedParsing) {
             if (m_mode == RelativeCoordinates)
-                m_currentPoint += point2;
+                m_currentPoint += targetPoint;
             else
-                m_currentPoint = point2;
+                m_currentPoint = targetPoint;
             m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
         } else
-            m_consumer->lineTo(point2, m_mode);
+            m_consumer->lineTo(targetPoint, m_mode);
         return true;
     }
 
-    if (m_normalized) {
+    if (m_pathParsingMode == NormalizedParsing) {
         FloatPoint point1 = m_currentPoint;
         if (m_mode == RelativeCoordinates)
-            point2 += m_currentPoint;
-        m_currentPoint = point2;
-        return decomposeArcToCubic(angle, rx, ry, point1, point2, largeArc, sweep);
+            targetPoint += m_currentPoint;
+        m_currentPoint = targetPoint;
+        return decomposeArcToCubic(angle, rx, ry, point1, targetPoint, largeArc, sweep);
     }
-    m_consumer->arcTo(point2, rx, ry, angle, largeArc, sweep, m_mode);
+    m_consumer->arcTo(rx, ry, angle, largeArc, sweep, targetPoint, m_mode);
     return true;
 }
 
-bool SVGPathParser::parsePathDataString(const String& s, bool normalized)
+bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode)
 {
-    m_ptr = s.characters();
-    m_end = m_ptr + s.length();
-    m_normalized = normalized;
+    ASSERT(m_source);
+    ASSERT(m_consumer);
+
+    m_pathParsingMode = pathParsingMode;
 
     m_controlPoint = FloatPoint();
     m_currentPoint = FloatPoint();
     m_subPathPoint = FloatPoint();
-    m_pathClosed = true;
+    m_closePath = true;
 
     // Skip any leading spaces.
-    if (!skipOptionalSpaces(m_ptr, m_end))
+    if (!m_source->moveToNextToken())
         return false;
 
-    char command = *(m_ptr++);
-    m_lastCommand = ' ';
+    SVGPathSegType command;
+    m_source->parseSVGSegmentType(command);
+    m_lastCommand = PathSegUnknown;
+
     // Path must start with moveto.
-    if (command != 'm' && command != 'M')
+    if (command != PathSegMoveToAbs && command != PathSegMoveToRel)
         return false;
 
     while (true) {
         // Skip spaces between command and first coordinate.
-        skipOptionalSpaces(m_ptr, m_end);
-        m_mode = command >= 'a' && command <= 'z' ? RelativeCoordinates : AbsoluteCoordinates;
+        m_source->moveToNextToken();
+        m_mode = AbsoluteCoordinates;
         switch (command) {
-        case 'm':
-        case 'M':
+        case PathSegMoveToRel:
+            m_mode = RelativeCoordinates;
+        case PathSegMoveToAbs:
             if (!parseMoveToSegment())
                 return false;
             break;
-        case 'l':
-        case 'L':
+        case PathSegLineToRel:
+            m_mode = RelativeCoordinates;
+        case PathSegLineToAbs:
             if (!parseLineToSegment())
                 return false;
             break;
-        case 'h':
-        case 'H':
+        case PathSegLineToHorizontalRel:
+            m_mode = RelativeCoordinates;
+        case PathSegLineToHorizontalAbs:
             if (!parseLineToHorizontalSegment())
                 return false;
             break;
-        case 'v':
-        case 'V':
+        case PathSegLineToVerticalRel:
+            m_mode = RelativeCoordinates;
+        case PathSegLineToVerticalAbs:
             if (!parseLineToVerticalSegment())
                 return false;
             break;
-        case 'z':
-        case 'Z':
+        case PathSegClosePath:
             parseClosePathSegment();
             break;
-        case 'c':
-        case 'C':
+        case PathSegCurveToCubicRel:
+            m_mode = RelativeCoordinates;
+        case PathSegCurveToCubicAbs:
             if (!parseCurveToCubicSegment())
                 return false;
             break;
-        case 's':
-        case 'S':
+        case PathSegCurveToCubicSmoothRel:
+            m_mode = RelativeCoordinates;
+        case PathSegCurveToCubicSmoothAbs:
             if (!parseCurveToCubicSmoothSegment())
                 return false;
             break;
-        case 'q':
-        case 'Q':
+        case PathSegCurveToQuadraticRel:
+            m_mode = RelativeCoordinates;
+        case PathSegCurveToQuadraticAbs:
             if (!parseCurveToQuadraticSegment())
                 return false;
             break;
-        case 't':
-        case 'T':
+        case PathSegCurveToQuadraticSmoothRel:
+            m_mode = RelativeCoordinates;
+        case PathSegCurveToQuadraticSmoothAbs:
             if (!parseCurveToQuadraticSmoothSegment())
                 return false;
             break;
-        case 'a':
-        case 'A':
+        case PathSegArcRel:
+            m_mode = RelativeCoordinates;
+        case PathSegArcAbs:
             if (!parseArcToSegment())
                 return false;
             break;
@@ -395,23 +406,19 @@ bool SVGPathParser::parsePathDataString(const String& s, bool normalized)
         }
         m_lastCommand = command;
 
-        if (m_ptr >= m_end)
+        if (!m_source->hasMoreData())
             return true;
 
-        // Check for remaining coordinates in the current command.
-        if ((*m_ptr == '+' || *m_ptr == '-' || *m_ptr == '.' || (*m_ptr >= '0' && *m_ptr <= '9'))
-            && command != 'z' && command != 'Z') {
-            if (command == 'M')
-                command = 'L';
-            else if (command == 'm')
-                command = 'l';
-        } else
-            command = *(m_ptr++);
+        command = m_source->nextCommand(command);
 
-        if (m_lastCommand != 'C' && m_lastCommand != 'c'
-            && m_lastCommand != 'S' && m_lastCommand != 's'
-            && m_lastCommand != 'Q' && m_lastCommand != 'q'
-            && m_lastCommand != 'T' && m_lastCommand != 't')
+        if (m_lastCommand != PathSegCurveToCubicAbs
+            && m_lastCommand != PathSegCurveToCubicRel
+            && m_lastCommand != PathSegCurveToCubicSmoothAbs
+            && m_lastCommand != PathSegCurveToCubicSmoothRel
+            && m_lastCommand != PathSegCurveToQuadraticAbs
+            && m_lastCommand != PathSegCurveToQuadraticRel
+            && m_lastCommand != PathSegCurveToQuadraticSmoothAbs
+            && m_lastCommand != PathSegCurveToQuadraticSmoothRel)
             m_controlPoint = m_currentPoint;
     }
 
@@ -492,13 +499,13 @@ bool SVGPathParser::decomposeArcToCubic(float angle, float rx, float ry, FloatPo
 
         point1 = FloatPoint(cosStartTheta - t * sinStartTheta, sinStartTheta + t * cosStartTheta);
         point1.move(centerPoint.x(), centerPoint.y());
-        FloatPoint point3 = FloatPoint(cosEndTheta, sinEndTheta);
-        point3.move(centerPoint.x(), centerPoint.y());
-        point2 = point3;
+        FloatPoint targetPoint = FloatPoint(cosEndTheta, sinEndTheta);
+        targetPoint.move(centerPoint.x(), centerPoint.y());
+        point2 = targetPoint;
         point2.move(t * sinEndTheta, -t * cosEndTheta);
 
         m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform.mapPoint(point2),
-                                 pointTransform.mapPoint(point3), AbsoluteCoordinates);
+                                 pointTransform.mapPoint(targetPoint), AbsoluteCoordinates);
     }
     return true;
 }
diff --git a/WebCore/svg/SVGPathParser.h b/WebCore/svg/SVGPathParser.h
index 23089d0..9e02a14 100644
--- a/WebCore/svg/SVGPathParser.h
+++ b/WebCore/svg/SVGPathParser.h
@@ -27,15 +27,21 @@
 #if ENABLE(SVG)
 #include "PlatformString.h"
 #include "SVGPathConsumer.h"
+#include "SVGPathSeg.h"
+#include "SVGPathSource.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
-class SVGPathParser {
+class SVGPathParser : public Noncopyable {
 public:
-    SVGPathParser(SVGPathConsumer*);
+    SVGPathParser();
     ~SVGPathParser();
 
-    bool parsePathDataString(const String&, bool normalized = false);
+    bool parsePathDataFromSource(PathParsingMode pathParsingMode);
+    void setCurrentConsumer(SVGPathConsumer* consumer) { m_consumer = consumer; }
+    void setCurrentSource(SVGPathSource* source) { m_source = source; }
 
 private:
     bool decomposeArcToCubic(float, float, float, FloatPoint&, FloatPoint&, bool largeArcFlag, bool sweepFlag);
@@ -50,13 +56,12 @@ private:
     bool parseCurveToQuadraticSmoothSegment();
     bool parseArcToSegment();
 
+    SVGPathSource* m_source;
     SVGPathConsumer* m_consumer;
     PathCoordinateMode m_mode;
-    const UChar* m_ptr;
-    const UChar* m_end;
-    char m_lastCommand;
-    bool m_normalized;
-    bool m_pathClosed;
+    PathParsingMode m_pathParsingMode;
+    SVGPathSegType m_lastCommand;
+    bool m_closePath;
     FloatPoint m_controlPoint;
     FloatPoint m_currentPoint;
     FloatPoint m_subPathPoint;
diff --git a/WebCore/svg/SVGPathParserFactory.cpp b/WebCore/svg/SVGPathParserFactory.cpp
new file mode 100644
index 0000000..de381a9
--- /dev/null
+++ b/WebCore/svg/SVGPathParserFactory.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathParserFactory.h"
+
+#include "SVGPathBuilder.h"
+#include "SVGPathParser.h"
+#include "SVGPathSegListBuilder.h"
+#include "SVGPathStringSource.h"
+
+namespace WebCore {
+
+static SVGPathBuilder* globalSVGPathBuilder()
+{
+    static SVGPathBuilder* s_builder = 0;
+    if (!s_builder)
+        s_builder = new SVGPathBuilder;
+
+    return s_builder;
+}
+
+static SVGPathSegListBuilder* globalSVGPathSegListBuilder()
+{
+    static SVGPathSegListBuilder* s_builder = 0;
+    if (!s_builder)
+        s_builder = new SVGPathSegListBuilder;
+
+    return s_builder;
+}
+
+static SVGPathParser* globalSVGPathParser()
+{
+    static SVGPathParser* s_parser = 0;
+    if (!s_parser)
+        s_parser = new SVGPathParser;
+
+    return s_parser;
+}
+
+SVGPathParserFactory* SVGPathParserFactory::self()
+{
+    static SVGPathParserFactory* s_instance = 0;
+    if (!s_instance)
+        s_instance = new SVGPathParserFactory;
+
+    return s_instance;
+}
+
+SVGPathParserFactory::SVGPathParserFactory()
+{
+}
+
+SVGPathParserFactory::~SVGPathParserFactory()
+{
+}
+
+bool SVGPathParserFactory::buildPathFromString(const String& d, Path& result)
+{
+    if (d.isEmpty())
+        return false;
+
+    SVGPathBuilder* builder = globalSVGPathBuilder();
+    builder->setCurrentPath(&result);
+
+    SVGPathParser* parser = globalSVGPathParser();
+    parser->setCurrentConsumer(builder);
+
+    OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
+    parser->setCurrentSource(source.get());
+
+    bool ok = parser->parsePathDataFromSource(NormalizedParsing);
+    parser->setCurrentConsumer(0);
+    parser->setCurrentSource(0);
+    builder->setCurrentPath(0);
+    return ok;
+}
+
+bool SVGPathParserFactory::buildSVGPathSegListFromString(const String& d, SVGPathSegList* result, PathParsingMode parsingMode)
+{
+    ASSERT(result);
+    if (d.isEmpty())
+        return false;
+
+    SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder();
+    builder->setCurrentSVGPathSegList(result);
+
+    SVGPathParser* parser = globalSVGPathParser();
+    parser->setCurrentConsumer(builder);
+
+    OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
+    parser->setCurrentSource(source.get());
+
+    bool ok = parser->parsePathDataFromSource(parsingMode);
+    parser->setCurrentConsumer(0);
+    parser->setCurrentSource(0);
+    builder->setCurrentSVGPathSegList(0);
+    return ok;
+}
+
+}
+
+#endif
diff --git a/WebCore/svg/SVGPathParserFactory.h b/WebCore/svg/SVGPathParserFactory.h
new file mode 100644
index 0000000..419f20a
--- /dev/null
+++ b/WebCore/svg/SVGPathParserFactory.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathParserFactory_h
+#define SVGPathParserFactory_h
+
+#if ENABLE(SVG)
+#include "Path.h"
+#include "PlatformString.h"
+#include "SVGPathConsumer.h"
+#include "SVGPathSegList.h"
+
+namespace WebCore {
+
+class SVGPathParserFactory {
+public:
+    static SVGPathParserFactory* self();
+
+    bool buildPathFromString(const String&, Path&);
+
+    bool buildSVGPathSegListFromString(const String&, SVGPathSegList*, PathParsingMode);
+
+private:
+    SVGPathParserFactory();
+    ~SVGPathParserFactory();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathParserFactory_h
diff --git a/WebCore/svg/SVGPathSeg.h b/WebCore/svg/SVGPathSeg.h
index 3026369..5532d0f 100644
--- a/WebCore/svg/SVGPathSeg.h
+++ b/WebCore/svg/SVGPathSeg.h
@@ -25,69 +25,94 @@
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
-    class String;
-    class SVGPathElement;
-    class SVGStyledElement;
-    class QualifiedName;
-
-    class SVGPathSeg : public RefCounted<SVGPathSeg> {
-    public:
-        virtual ~SVGPathSeg();
-
-        enum SVGPathSegType {
-            PATHSEG_UNKNOWN                         = 0,
-            PATHSEG_CLOSEPATH                       = 1,
-            PATHSEG_MOVETO_ABS                      = 2,
-            PATHSEG_MOVETO_REL                      = 3,
-            PATHSEG_LINETO_ABS                      = 4,
-            PATHSEG_LINETO_REL                      = 5,
-            PATHSEG_CURVETO_CUBIC_ABS               = 6,
-            PATHSEG_CURVETO_CUBIC_REL               = 7,
-            PATHSEG_CURVETO_QUADRATIC_ABS           = 8,
-            PATHSEG_CURVETO_QUADRATIC_REL           = 9,
-            PATHSEG_ARC_ABS                         = 10,
-            PATHSEG_ARC_REL                         = 11,
-            PATHSEG_LINETO_HORIZONTAL_ABS           = 12,
-            PATHSEG_LINETO_HORIZONTAL_REL           = 13,
-            PATHSEG_LINETO_VERTICAL_ABS             = 14,
-            PATHSEG_LINETO_VERTICAL_REL             = 15,
-            PATHSEG_CURVETO_CUBIC_SMOOTH_ABS        = 16,
-            PATHSEG_CURVETO_CUBIC_SMOOTH_REL        = 17,
-            PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS    = 18,
-            PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL    = 19
-        };
-
-        virtual unsigned short pathSegType() const;
-        virtual String pathSegTypeAsLetter() const;
-        virtual String toString() const;
-
-        const QualifiedName& associatedAttributeName() const;
-        
-    protected:
-        SVGPathSeg() { }
+
+enum SVGPathSegType {
+    PathSegUnknown = 0,
+    PathSegClosePath = 1,
+    PathSegMoveToAbs = 2,
+    PathSegMoveToRel = 3,
+    PathSegLineToAbs = 4,
+    PathSegLineToRel = 5,
+    PathSegCurveToCubicAbs = 6,
+    PathSegCurveToCubicRel = 7,
+    PathSegCurveToQuadraticAbs = 8,
+    PathSegCurveToQuadraticRel = 9,
+    PathSegArcAbs = 10,
+    PathSegArcRel = 11,
+    PathSegLineToHorizontalAbs = 12,
+    PathSegLineToHorizontalRel = 13,
+    PathSegLineToVerticalAbs = 14,
+    PathSegLineToVerticalRel = 15,
+    PathSegCurveToCubicSmoothAbs = 16,
+    PathSegCurveToCubicSmoothRel = 17,
+    PathSegCurveToQuadraticSmoothAbs = 18,
+    PathSegCurveToQuadraticSmoothRel = 19
+};
+
+class String;
+class SVGPathElement;
+class SVGStyledElement;
+class QualifiedName;
+
+class SVGPathSeg : public RefCounted<SVGPathSeg> {
+public:
+    virtual ~SVGPathSeg();
+
+    // Forward declare these enums in the w3c naming scheme, for IDL generation
+    enum {
+        PATHSEG_UNKNOWN = PathSegUnknown,
+        PATHSEG_CLOSEPATH = PathSegClosePath,
+        PATHSEG_MOVETO_ABS = PathSegMoveToAbs,
+        PATHSEG_MOVETO_REL = PathSegMoveToRel,
+        PATHSEG_LINETO_ABS = PathSegLineToAbs,
+        PATHSEG_LINETO_REL = PathSegLineToRel,
+        PATHSEG_CURVETO_CUBIC_ABS = PathSegCurveToCubicAbs,
+        PATHSEG_CURVETO_CUBIC_REL = PathSegCurveToCubicRel,
+        PATHSEG_CURVETO_QUADRATIC_ABS = PathSegCurveToQuadraticAbs,
+        PATHSEG_CURVETO_QUADRATIC_REL = PathSegCurveToQuadraticRel,
+        PATHSEG_ARC_ABS = PathSegArcAbs,
+        PATHSEG_ARC_REL = PathSegArcRel,
+        PATHSEG_LINETO_HORIZONTAL_ABS = PathSegLineToHorizontalAbs,
+        PATHSEG_LINETO_HORIZONTAL_REL = PathSegLineToHorizontalRel,
+        PATHSEG_LINETO_VERTICAL_ABS = PathSegLineToVerticalAbs,
+        PATHSEG_LINETO_VERTICAL_REL = PathSegLineToVerticalRel,
+        PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = PathSegCurveToCubicSmoothAbs,
+        PATHSEG_CURVETO_CUBIC_SMOOTH_REL = PathSegCurveToCubicSmoothRel,
+        PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = PathSegCurveToQuadraticSmoothAbs,
+        PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = PathSegCurveToQuadraticSmoothRel
     };
 
-    class SVGPathSegSingleCoord : public SVGPathSeg { 
-    public:
-        SVGPathSegSingleCoord(float x, float y)
-            : SVGPathSeg()
-            , m_x(x)
-            , m_y(y)
-        {
-        }
 
-        void setX(float x) { m_x = x; }
-        float x() const { return m_x; }
+    virtual unsigned short pathSegType() const;
+    virtual String pathSegTypeAsLetter() const;
+    virtual String toString() const;
 
-        void setY(float y) { m_y = y; }
-        float y() const { return m_y; }
+    const QualifiedName& associatedAttributeName() const;
+    
+protected:
+    SVGPathSeg() { }
+};
 
-        virtual String toString() const;
+class SVGPathSegSingleCoord : public SVGPathSeg { 
+public:
+    SVGPathSegSingleCoord(float x, float y)
+        : m_x(x)
+        , m_y(y)
+    {
+    }
 
-    private:
-        float m_x;
-        float m_y;
-    };
+    void setX(float x) { m_x = x; }
+    float x() const { return m_x; }
+
+    void setY(float y) { m_y = y; }
+    float y() const { return m_y; }
+
+    virtual String toString() const;
+
+private:
+    float m_x;
+    float m_y;
+};
 
 } // namespace WebCore
 
diff --git a/WebCore/svg/SVGPathSegList.cpp b/WebCore/svg/SVGPathSegList.cpp
index 449e122..aeec0c8 100644
--- a/WebCore/svg/SVGPathSegList.cpp
+++ b/WebCore/svg/SVGPathSegList.cpp
@@ -64,19 +64,19 @@ unsigned SVGPathSegList::getPathSegAtLength(double length, ExceptionCode& ec)
             return 0;
         float segmentLength = 0;
         switch (segment->pathSegType()) {
-        case SVGPathSeg::PATHSEG_MOVETO_ABS:
+        case PathSegMoveToAbs:
         {
             SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment);
             segmentLength = traversalState.moveTo(FloatPoint(moveTo->x(), moveTo->y()));
             break;
         }
-        case SVGPathSeg::PATHSEG_LINETO_ABS:
+        case PathSegLineToAbs:
         {
             SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment);
             segmentLength = traversalState.lineTo(FloatPoint(lineTo->x(), lineTo->y()));
             break;
         }
-        case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
+        case PathSegCurveToCubicAbs:
         {
             SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment);
             segmentLength = traversalState.cubicBezierTo(FloatPoint(curveTo->x1(), curveTo->y1()),
@@ -84,7 +84,7 @@ unsigned SVGPathSegList::getPathSegAtLength(double length, ExceptionCode& ec)
                                       FloatPoint(curveTo->x(), curveTo->y()));
             break;
         }
-        case SVGPathSeg::PATHSEG_CLOSEPATH:
+        case PathSegClosePath:
             segmentLength = traversalState.closeSubpath();
             break;
         default:
@@ -116,48 +116,44 @@ Path SVGPathSegList::toPathData()
         if (ec)
             return Path();
         switch (segment->pathSegType()) {
-            case SVGPathSeg::PATHSEG_MOVETO_ABS:
-            {
-                SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment);
-                FloatPoint endPoint(moveTo->x(), moveTo->y());
-                pathData.moveTo(endPoint);
-                previousEndPoint = endPoint;
-                break;
-            }
-            case SVGPathSeg::PATHSEG_LINETO_ABS:
-            {
-                SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment);
-                FloatPoint endPoint(lineTo->x(), lineTo->y());
-                pathData.addLineTo(endPoint);
-                previousEndPoint = endPoint;
-                break;
-            }
-            case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
-            {
-                SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment);
-                FloatPoint endPoint(curveTo->x(), curveTo->y());
-                pathData.addBezierCurveTo(FloatPoint(curveTo->x1(), curveTo->y1()),
-                                          FloatPoint(curveTo->x2(), curveTo->y2()),
-                                          endPoint);
-                previousEndPoint = endPoint;
-                break;
-            }
-            case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
-            {
-                SVGPathSegCurvetoCubicRel* curveTo = static_cast<SVGPathSegCurvetoCubicRel*>(segment);
-                FloatSize endPoint(curveTo->x(), curveTo->y());
-                pathData.addBezierCurveTo(previousEndPoint + FloatSize(curveTo->x1(), curveTo->y1()),
-                                          previousEndPoint + FloatSize(curveTo->x2(), curveTo->y2()),
-                                          previousEndPoint + endPoint);
-                previousEndPoint += endPoint;
-                break;
-            }
-            case SVGPathSeg::PATHSEG_CLOSEPATH:
-                pathData.closeSubpath();
-                break;
-            default:
-                ASSERT(false); // FIXME: This only works with normalized/processed path data.
-                break;
+        case PathSegMoveToAbs: {
+            SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment);
+            FloatPoint endPoint(moveTo->x(), moveTo->y());
+            pathData.moveTo(endPoint);
+            previousEndPoint = endPoint;
+            break;
+        }
+        case PathSegLineToAbs: {
+            SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment);
+            FloatPoint endPoint(lineTo->x(), lineTo->y());
+            pathData.addLineTo(endPoint);
+            previousEndPoint = endPoint;
+            break;
+        }
+        case PathSegCurveToCubicAbs: {
+            SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment);
+            FloatPoint endPoint(curveTo->x(), curveTo->y());
+            pathData.addBezierCurveTo(FloatPoint(curveTo->x1(), curveTo->y1()),
+                                      FloatPoint(curveTo->x2(), curveTo->y2()),
+                                      endPoint);
+            previousEndPoint = endPoint;
+            break;
+        }
+        case PathSegCurveToCubicRel: {
+            SVGPathSegCurvetoCubicRel* curveTo = static_cast<SVGPathSegCurvetoCubicRel*>(segment);
+            FloatSize endPoint(curveTo->x(), curveTo->y());
+            pathData.addBezierCurveTo(previousEndPoint + FloatSize(curveTo->x1(), curveTo->y1()),
+                                      previousEndPoint + FloatSize(curveTo->x2(), curveTo->y2()),
+                                      previousEndPoint + endPoint);
+            previousEndPoint += endPoint;
+            break;
+        }
+        case PathSegClosePath:
+            pathData.closeSubpath();
+            break;
+        default:
+            ASSERT(false); // FIXME: This only works with normalized/processed path data.
+            break;
         }
     }
     
@@ -213,68 +209,68 @@ PassRefPtr<SVGPathSegList> SVGPathSegList::createAnimated(const SVGPathSegList*
         SVGPathSeg* to = toList->getItem(n, ec).get();
         if (ec)
             return 0;
-        if (from->pathSegType() == SVGPathSeg::PATHSEG_UNKNOWN || from->pathSegType() != to->pathSegType())
+        if (from->pathSegType() == PathSegUnknown || from->pathSegType() != to->pathSegType())
             return 0;
         RefPtr<SVGPathSeg> segment = 0;
-        switch (static_cast<SVGPathSeg::SVGPathSegType>(from->pathSegType())) {
-        case SVGPathSeg::PATHSEG_CLOSEPATH:
+        switch (static_cast<SVGPathSegType>(from->pathSegType())) {
+        case PathSegClosePath:
             segment = SVGPathSegClosePath::create();
             break;
-        case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
+        case PathSegLineToHorizontalAbs:
             segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalAbs, x);
             break;
-        case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
+        case PathSegLineToHorizontalRel:
             segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalRel, x);
             break;   
-        case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
+        case PathSegLineToVerticalAbs:
             segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalAbs, y);
             break;
-        case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
+        case PathSegLineToVerticalRel:
             segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalRel, y);
             break;        
-        case SVGPathSeg::PATHSEG_MOVETO_ABS:
+        case PathSegMoveToAbs:
             segment = BLENDPATHSEG2(SVGPathSegMovetoAbs, x, y);
             break;
-        case SVGPathSeg::PATHSEG_MOVETO_REL:
+        case PathSegMoveToRel:
             segment = BLENDPATHSEG2(SVGPathSegMovetoRel, x, y);
             break;
-        case SVGPathSeg::PATHSEG_LINETO_ABS:
+        case PathSegLineToAbs:
             segment = BLENDPATHSEG2(SVGPathSegLinetoAbs, x, y);
             break;
-        case SVGPathSeg::PATHSEG_LINETO_REL:
+        case PathSegLineToRel:
             segment = BLENDPATHSEG2(SVGPathSegLinetoRel, x, y);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
+        case PathSegCurveToCubicAbs:
             segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicAbs, x, y, x1, y1, x2, y2);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
+        case PathSegCurveToCubicRel:
             segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicRel, x, y, x1, y1, x2, y2);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
+        case PathSegCurveToCubicSmoothAbs:
             segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothAbs, x, y, x2, y2);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
+        case PathSegCurveToCubicSmoothRel:
             segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothRel, x, y, x2, y2);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
+        case PathSegCurveToQuadraticAbs:
             segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticAbs, x, y, x1, y1);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
+        case PathSegCurveToQuadraticRel:
             segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticRel, x, y, x1, y1);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
+        case PathSegCurveToQuadraticSmoothAbs:
             segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothAbs, x, y);
             break;
-        case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
+        case PathSegCurveToQuadraticSmoothRel:
             segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothRel, x, y);
             break;
-        case SVGPathSeg::PATHSEG_ARC_ABS:
+        case PathSegArcAbs:
             segment = BLENDPATHSEG7(SVGPathSegArcAbs, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
             break;
-        case SVGPathSeg::PATHSEG_ARC_REL:
+        case PathSegArcRel:
             segment = BLENDPATHSEG7(SVGPathSegArcRel, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
             break;
-        case SVGPathSeg::PATHSEG_UNKNOWN:
+        case PathSegUnknown:
             ASSERT_NOT_REACHED();
         }
         result->appendItem(segment, ec);
diff --git a/WebCore/svg/SVGPathSegListBuilder.cpp b/WebCore/svg/SVGPathSegListBuilder.cpp
index 1fdc303..342de88 100644
--- a/WebCore/svg/SVGPathSegListBuilder.cpp
+++ b/WebCore/svg/SVGPathSegListBuilder.cpp
@@ -28,7 +28,6 @@
 
 #include "ExceptionCode.h"
 #include "SVGPathElement.h"
-#include "SVGPathParser.h"
 #include "SVGPathSegArc.h"
 #include "SVGPathSegClosePath.h"
 #include "SVGPathSegCurvetoCubic.h"
@@ -43,42 +42,36 @@
 
 namespace WebCore {
 
-SVGPathSegListBuilder::SVGPathSegListBuilder(SVGPathSegList* segList)
-    : m_pathSegList(segList)
+SVGPathSegListBuilder::SVGPathSegListBuilder()
+    : m_pathSegList(0)
 {
 }
 
-bool SVGPathSegListBuilder::build(const String& d, PathParsingMode parsingMode)
-{
-    if (!m_pathSegList)
-        return false;
-
-    SVGPathParser parser(this);
-    return parser.parsePathDataString(d, parsingMode == NormalizedParsing);
-}
-
-void SVGPathSegListBuilder::moveTo(const FloatPoint& point, bool, PathCoordinateMode mode)
+void SVGPathSegListBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoAbs(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoAbs(targetPoint.x(), targetPoint.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoRel(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegMovetoRel(targetPoint.x(), targetPoint.y()), ec);
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::lineTo(const FloatPoint& point, PathCoordinateMode mode)
+void SVGPathSegListBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoAbs(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoAbs(targetPoint.x(), targetPoint.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoRel(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoRel(targetPoint.x(), targetPoint.y()), ec);
     ASSERT(!ec);
 }
 
 void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
         m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoHorizontalAbs(x), ec);
@@ -89,6 +82,7 @@ void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
 
 void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
         m_pathSegList->appendItem(SVGPathElement::createSVGPathSegLinetoVerticalAbs(y), ec);
@@ -97,58 +91,64 @@ void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& point, PathCoordinateMode mode)
+void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicAbs(point.x(), point.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicRel(point.x(), point.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y()), ec);
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point, const FloatPoint& point2, PathCoordinateMode mode)
+void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(point2.x(), point2.y(), point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(targetPoint.x(), targetPoint.y(), point2.x(), point2.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(point2.x(), point2.y(), point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(targetPoint.x(), targetPoint.y(), point2.x(), point2.y()), ec);
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point, const FloatPoint& point1, PathCoordinateMode mode)
+void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(point1.x(), point1.y(), point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticRel(point1.x(), point1.y(), point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y()), ec);
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& point, PathCoordinateMode mode)
+void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(targetPoint.x(), targetPoint.y()), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(point.x(), point.y()), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(targetPoint.x(), targetPoint.y()), ec);
     ASSERT(!ec);
 }
 
-void SVGPathSegListBuilder::arcTo(const FloatPoint& point, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, PathCoordinateMode mode)
+void SVGPathSegListBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     if (mode == AbsoluteCoordinates)
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcAbs(point.x(), point.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcAbs(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
     else
-        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcRel(point.x(), point.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
+        m_pathSegList->appendItem(SVGPathElement::createSVGPathSegArcRel(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag), ec);
     ASSERT(!ec);
 }
 
 void SVGPathSegListBuilder::closePath()
 {
+    ASSERT(m_pathSegList);
     ExceptionCode ec = 0;
     m_pathSegList->appendItem(SVGPathElement::createSVGPathSegClosePath(), ec);
     ASSERT(!ec);
diff --git a/WebCore/svg/SVGPathSegListBuilder.h b/WebCore/svg/SVGPathSegListBuilder.h
index 8c4e6c4..ab0cdf2 100644
--- a/WebCore/svg/SVGPathSegListBuilder.h
+++ b/WebCore/svg/SVGPathSegListBuilder.h
@@ -31,10 +31,11 @@
 
 namespace WebCore {
 
-class SVGPathSegListBuilder : private SVGPathConsumer {
+class SVGPathSegListBuilder : public SVGPathConsumer {
 public:
-    SVGPathSegListBuilder(SVGPathSegList*);
-    bool build(const String&, PathParsingMode);
+    SVGPathSegListBuilder();
+
+    void setCurrentSVGPathSegList(SVGPathSegList* pathSegList) { m_pathSegList = pathSegList; }
 
 private:
     // Used in UnalteredParisng/NormalizedParsing modes.
@@ -50,7 +51,7 @@ private:
     virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
     virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode);
     virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode);
-    virtual void arcTo(const FloatPoint&, float, float, float, bool largeArcFlag, bool sweepFlag, PathCoordinateMode);
+    virtual void arcTo(float, float, float, bool largeArcFlag, bool sweepFlag, const FloatPoint&, PathCoordinateMode);
 
     SVGPathSegList* m_pathSegList;
 };
diff --git a/WebCore/svg/SVGPathSource.h b/WebCore/svg/SVGPathSource.h
new file mode 100644
index 0000000..6540231
--- /dev/null
+++ b/WebCore/svg/SVGPathSource.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathSource_h
+#define SVGPathSource_h
+
+#if ENABLE(SVG)
+#include "SVGPathSeg.h"
+
+namespace WebCore {
+
+class SVGPathSource : public Noncopyable {
+public:
+    virtual ~SVGPathSource() { }
+
+    virtual bool hasMoreData() const = 0;
+    virtual bool moveToNextToken() = 0;
+    virtual bool parseFloat(float& result) = 0;
+    virtual bool parseFlag(bool& result) = 0;
+    virtual bool parseSVGSegmentType(SVGPathSegType&) = 0;
+    virtual SVGPathSegType nextCommand(SVGPathSegType previousCommand) = 0;
+
+public:
+    SVGPathSource() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathSource_h
diff --git a/WebCore/svg/SVGPathStringSource.cpp b/WebCore/svg/SVGPathStringSource.cpp
new file mode 100644
index 0000000..5045098
--- /dev/null
+++ b/WebCore/svg/SVGPathStringSource.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGPathStringSource.h"
+
+#include "SVGParserUtilities.h"
+
+namespace WebCore {
+
+SVGPathStringSource::SVGPathStringSource(const String& string)
+    : m_string(string)
+    , m_current(string.characters())
+    , m_end(m_current + string.length())
+{
+    ASSERT(!string.isEmpty());
+}
+
+SVGPathStringSource::~SVGPathStringSource()
+{
+}
+
+bool SVGPathStringSource::hasMoreData() const
+{
+    return m_current < m_end;
+}
+
+bool SVGPathStringSource::parseFloat(float& result)
+{
+    return parseNumber(m_current, m_end, result);
+}
+
+bool SVGPathStringSource::parseFlag(bool& result)
+{
+    return parseArcFlag(m_current, m_end, result);
+}
+
+bool SVGPathStringSource::moveToNextToken()
+{
+    return skipOptionalSpaces(m_current, m_end);
+}
+
+bool SVGPathStringSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+{
+    switch (*(m_current++)) {
+    case 'Z':
+    case 'z':
+        pathSegType = PathSegClosePath;
+        break;
+    case 'M':
+        pathSegType = PathSegMoveToAbs;
+        break;
+    case 'm':
+        pathSegType = PathSegMoveToRel;
+        break;
+    case 'L':
+        pathSegType = PathSegLineToAbs;
+        break;
+    case 'l':
+        pathSegType = PathSegLineToRel;
+        break;
+    case 'C':
+        pathSegType = PathSegCurveToCubicAbs;
+        break;
+    case 'c':
+        pathSegType = PathSegCurveToCubicRel;
+        break;
+    case 'Q':
+        pathSegType = PathSegCurveToQuadraticAbs;
+        break;
+    case 'q':
+        pathSegType = PathSegCurveToQuadraticRel;
+        break;
+    case 'A':
+        pathSegType = PathSegArcAbs;
+        break;
+    case 'a':
+        pathSegType = PathSegArcRel;
+        break;
+    case 'H':
+        pathSegType = PathSegLineToHorizontalAbs;
+        break;
+    case 'h':
+        pathSegType = PathSegLineToHorizontalRel;
+        break;
+    case 'V':
+        pathSegType = PathSegLineToVerticalAbs;
+        break;
+    case 'v':
+        pathSegType = PathSegLineToVerticalRel;
+        break;
+    case 'S':
+        pathSegType = PathSegCurveToCubicSmoothAbs;
+        break;
+    case 's':
+        pathSegType = PathSegCurveToCubicSmoothRel;
+        break;
+    case 'T':
+        pathSegType = PathSegCurveToQuadraticSmoothAbs;
+        break;
+    case 't':
+        pathSegType = PathSegCurveToQuadraticSmoothRel;
+        break;
+    default:
+        pathSegType = PathSegUnknown;
+    }
+    return true;
+}
+
+SVGPathSegType SVGPathStringSource::nextCommand(SVGPathSegType previousCommand)
+{
+    // Check for remaining coordinates in the current command.
+    if ((*m_current == '+' || *m_current == '-' || *m_current == '.' || (*m_current >= '0' && *m_current <= '9'))
+        && previousCommand != PathSegClosePath) {
+        if (previousCommand == PathSegMoveToAbs)
+            return PathSegLineToAbs;
+        if (previousCommand == PathSegMoveToRel)
+            return PathSegLineToRel;
+        return previousCommand;
+    }
+    SVGPathSegType nextCommand;
+    parseSVGSegmentType(nextCommand);
+    return nextCommand;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathStringSource.h b/WebCore/svg/SVGPathStringSource.h
new file mode 100644
index 0000000..dadfc8a
--- /dev/null
+++ b/WebCore/svg/SVGPathStringSource.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGPathStringSource_h
+#define SVGPathStringSource_h
+
+#if ENABLE(SVG)
+#include "PlatformString.h"
+#include "SVGPathSource.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class SVGPathStringSource : public SVGPathSource {
+public:
+    static PassOwnPtr<SVGPathStringSource> create(const String& string)
+    {
+        return adoptPtr(new SVGPathStringSource(string));
+    }
+
+    virtual ~SVGPathStringSource();
+
+    virtual bool hasMoreData() const;
+    virtual bool moveToNextToken();
+    virtual bool parseFloat(float& result);
+    virtual bool parseFlag(bool& result);
+    virtual bool parseSVGSegmentType(SVGPathSegType&);
+    virtual SVGPathSegType nextCommand(SVGPathSegType previousCommand);
+
+private:
+    SVGPathStringSource(const String&);
+    String m_string;
+
+    const UChar* m_current;
+    const UChar* m_end;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathStringSource_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list