[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:52:30 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 97a7ea196c9fcdfbdf718ccdd6320bd0723ed07a
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 10 08:47:50 2010 +0000
2010-08-10 Dirk Schulze <krit at webkit.org>
Reviewed by Nikolas Zimmermann.
Add missing SVGPathSegList source for SVGPathParser
https://bugs.webkit.org/show_bug.cgi?id=43691
Added SVGPathSegListSource to parse normalized or unaltered SVGPathSegLists and transform
them to either a SVG path string, or a SVGPathByteStream. This will be needed to synchronize
all SVGPathSegLists and the SVG path string of the 'd' attribute.
Refactored SVGPathSource code, to read concrete path segments instead of type/flag/coordinates
from the data sources. This is a further abstraction and seperates the reading of content from
the parsing and interpreting.
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/SVGPathByteStreamSource.cpp:
(WebCore::SVGPathByteStreamSource::parseSVGSegmentType):
(WebCore::SVGPathByteStreamSource::nextCommand):
(WebCore::SVGPathByteStreamSource::parseMoveToSegment):
(WebCore::SVGPathByteStreamSource::parseLineToSegment):
(WebCore::SVGPathByteStreamSource::parseLineToHorizontalSegment):
(WebCore::SVGPathByteStreamSource::parseLineToVerticalSegment):
(WebCore::SVGPathByteStreamSource::parseCurveToCubicSegment):
(WebCore::SVGPathByteStreamSource::parseCurveToCubicSmoothSegment):
(WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSegment):
(WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment):
(WebCore::SVGPathByteStreamSource::parseArcToSegment):
* svg/SVGPathByteStreamSource.h:
(WebCore::SVGPathByteStreamSource::moveToNextToken):
* svg/SVGPathParser.cpp:
(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):
* svg/SVGPathSegListSource.cpp: Added.
(WebCore::SVGPathSegListSource::SVGPathSegListSource):
(WebCore::SVGPathSegListSource::~SVGPathSegListSource):
(WebCore::SVGPathSegListSource::hasMoreData):
(WebCore::SVGPathSegListSource::parseSVGSegmentType):
(WebCore::SVGPathSegListSource::nextCommand):
(WebCore::SVGPathSegListSource::parseMoveToSegment):
(WebCore::SVGPathSegListSource::parseLineToSegment):
(WebCore::SVGPathSegListSource::parseLineToHorizontalSegment):
(WebCore::SVGPathSegListSource::parseLineToVerticalSegment):
(WebCore::SVGPathSegListSource::parseCurveToCubicSegment):
(WebCore::SVGPathSegListSource::parseCurveToCubicSmoothSegment):
(WebCore::SVGPathSegListSource::parseCurveToQuadraticSegment):
(WebCore::SVGPathSegListSource::parseCurveToQuadraticSmoothSegment):
(WebCore::SVGPathSegListSource::parseArcToSegment):
* svg/SVGPathSegListSource.h: Added.
(WebCore::SVGPathSegListSource::create):
(WebCore::SVGPathSegListSource::moveToNextToken):
* svg/SVGPathSource.h:
* svg/SVGPathStringSource.cpp:
(WebCore::SVGPathStringSource::parseMoveToSegment):
(WebCore::SVGPathStringSource::parseLineToSegment):
(WebCore::SVGPathStringSource::parseLineToHorizontalSegment):
(WebCore::SVGPathStringSource::parseLineToVerticalSegment):
(WebCore::SVGPathStringSource::parseCurveToCubicSegment):
(WebCore::SVGPathStringSource::parseCurveToCubicSmoothSegment):
(WebCore::SVGPathStringSource::parseCurveToQuadraticSegment):
(WebCore::SVGPathStringSource::parseCurveToQuadraticSmoothSegment):
(WebCore::SVGPathStringSource::parseArcToSegment):
* svg/SVGPathStringSource.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 4b55a46..9c2658e 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -888,6 +888,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
svg/SVGPathSegLinetoVertical.cpp \
svg/SVGPathSegList.cpp \
svg/SVGPathSegListBuilder.cpp \
+ svg/SVGPathSegListSource.cpp \
svg/SVGPathSegMoveto.cpp \
svg/SVGPathStringBuilder.cpp \
svg/SVGPathStringSource.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 6ec933a..fdff627 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1693,6 +1693,7 @@ IF (ENABLE_SVG)
svg/SVGPathSegLinetoVertical.cpp
svg/SVGPathSegList.cpp
svg/SVGPathSegListBuilder.cpp
+ svg/SVGPathSegListSource.cpp
svg/SVGPathSegMoveto.cpp
svg/SVGPathStringBuilder.cpp
svg/SVGPathStringSource.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5c6f1c9..e6b600a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,82 @@
+2010-08-10 Dirk Schulze <krit at webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Add missing SVGPathSegList source for SVGPathParser
+ https://bugs.webkit.org/show_bug.cgi?id=43691
+
+ Added SVGPathSegListSource to parse normalized or unaltered SVGPathSegLists and transform
+ them to either a SVG path string, or a SVGPathByteStream. This will be needed to synchronize
+ all SVGPathSegLists and the SVG path string of the 'd' attribute.
+ Refactored SVGPathSource code, to read concrete path segments instead of type/flag/coordinates
+ from the data sources. This is a further abstraction and seperates the reading of content from
+ the parsing and interpreting.
+
+ 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/SVGPathByteStreamSource.cpp:
+ (WebCore::SVGPathByteStreamSource::parseSVGSegmentType):
+ (WebCore::SVGPathByteStreamSource::nextCommand):
+ (WebCore::SVGPathByteStreamSource::parseMoveToSegment):
+ (WebCore::SVGPathByteStreamSource::parseLineToSegment):
+ (WebCore::SVGPathByteStreamSource::parseLineToHorizontalSegment):
+ (WebCore::SVGPathByteStreamSource::parseLineToVerticalSegment):
+ (WebCore::SVGPathByteStreamSource::parseCurveToCubicSegment):
+ (WebCore::SVGPathByteStreamSource::parseCurveToCubicSmoothSegment):
+ (WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSegment):
+ (WebCore::SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment):
+ (WebCore::SVGPathByteStreamSource::parseArcToSegment):
+ * svg/SVGPathByteStreamSource.h:
+ (WebCore::SVGPathByteStreamSource::moveToNextToken):
+ * svg/SVGPathParser.cpp:
+ (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):
+ * svg/SVGPathSegListSource.cpp: Added.
+ (WebCore::SVGPathSegListSource::SVGPathSegListSource):
+ (WebCore::SVGPathSegListSource::~SVGPathSegListSource):
+ (WebCore::SVGPathSegListSource::hasMoreData):
+ (WebCore::SVGPathSegListSource::parseSVGSegmentType):
+ (WebCore::SVGPathSegListSource::nextCommand):
+ (WebCore::SVGPathSegListSource::parseMoveToSegment):
+ (WebCore::SVGPathSegListSource::parseLineToSegment):
+ (WebCore::SVGPathSegListSource::parseLineToHorizontalSegment):
+ (WebCore::SVGPathSegListSource::parseLineToVerticalSegment):
+ (WebCore::SVGPathSegListSource::parseCurveToCubicSegment):
+ (WebCore::SVGPathSegListSource::parseCurveToCubicSmoothSegment):
+ (WebCore::SVGPathSegListSource::parseCurveToQuadraticSegment):
+ (WebCore::SVGPathSegListSource::parseCurveToQuadraticSmoothSegment):
+ (WebCore::SVGPathSegListSource::parseArcToSegment):
+ * svg/SVGPathSegListSource.h: Added.
+ (WebCore::SVGPathSegListSource::create):
+ (WebCore::SVGPathSegListSource::moveToNextToken):
+ * svg/SVGPathSource.h:
+ * svg/SVGPathStringSource.cpp:
+ (WebCore::SVGPathStringSource::parseMoveToSegment):
+ (WebCore::SVGPathStringSource::parseLineToSegment):
+ (WebCore::SVGPathStringSource::parseLineToHorizontalSegment):
+ (WebCore::SVGPathStringSource::parseLineToVerticalSegment):
+ (WebCore::SVGPathStringSource::parseCurveToCubicSegment):
+ (WebCore::SVGPathStringSource::parseCurveToCubicSmoothSegment):
+ (WebCore::SVGPathStringSource::parseCurveToQuadraticSegment):
+ (WebCore::SVGPathStringSource::parseCurveToQuadraticSmoothSegment):
+ (WebCore::SVGPathStringSource::parseArcToSegment):
+ * svg/SVGPathStringSource.h:
+
2010-08-09 Ilya Tikhonovsky <loislo at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 3c338a0..86fc5b1 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -4108,6 +4108,8 @@ webcore_sources += \
WebCore/svg/SVGPathSegList.h \
WebCore/svg/SVGPathSegListBuilder.cpp \
WebCore/svg/SVGPathSegListBuilder.h \
+ WebCore/svg/SVGPathSegListSource.cpp \
+ WebCore/svg/SVGPathSegListSource.h \
WebCore/svg/SVGPathSegMoveto.cpp \
WebCore/svg/SVGPathSegMoveto.h \
WebCore/svg/SVGPathSource.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index d4cc79f..1959fd8 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3858,6 +3858,8 @@
'svg/SVGPathSegList.h',
'svg/SVGPathSegListBuilder.cpp',
'svg/SVGPathSegListBuilder.h',
+ 'svg/SVGPathSegListSource.cpp',
+ 'svg/SVGPathSegListSource.h',
'svg/SVGPathSegMoveto.cpp',
'svg/SVGPathSegMoveto.h',
'svg/SVGPathSource.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index e9cfa4a..e1674e3 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2868,6 +2868,7 @@ contains(DEFINES, ENABLE_SVG=1) {
svg/SVGPathSegLinetoVertical.cpp \
svg/SVGPathSegList.cpp \
svg/SVGPathSegListBuilder.cpp \
+ svg/SVGPathSegListSource.cpp \
svg/SVGPathSegMoveto.cpp \
svg/SVGPathStringBuilder.cpp \
svg/SVGPathStringSource.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 4f02f7a..48a21f4 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -49413,6 +49413,10 @@
>
</File>
<File
+ RelativePath="..\svg\SVGPathSegListSource.h"
+ >
+ </File>
+ <File
RelativePath="..\svg\SVGPathSegMoveto.h"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 748c285..c816795 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1482,6 +1482,8 @@
84A81F3E0FC7DFF000955300 /* SourceAlpha.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F3C0FC7DFF000955300 /* SourceAlpha.h */; };
84A81F410FC7E02700955300 /* SourceGraphic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */; };
84A81F420FC7E02700955300 /* SourceGraphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F400FC7E02700955300 /* SourceGraphic.h */; };
+ 84B6B977120F13E500B8EFAF /* SVGPathSegListSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */; };
+ 84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */; };
84BDA16B11358D2A00DBF64C /* RenderSVGResourceClipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BDA16911358D2A00DBF64C /* RenderSVGResourceClipper.cpp */; };
84BDA16C11358D2A00DBF64C /* RenderSVGResourceClipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 84BDA16A11358D2A00DBF64C /* RenderSVGResourceClipper.h */; };
84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */; };
@@ -7322,6 +7324,8 @@
84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SSLKeyGeneratorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListSource.cpp; sourceTree = "<group>"; };
+ 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListSource.h; sourceTree = "<group>"; };
84BDA16911358D2A00DBF64C /* RenderSVGResourceClipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceClipper.cpp; sourceTree = "<group>"; };
84BDA16A11358D2A00DBF64C /* RenderSVGResourceClipper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceClipper.h; sourceTree = "<group>"; };
84D0C4031115F1D40018AA34 /* AffineTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AffineTransform.cpp; path = transforms/AffineTransform.cpp; sourceTree = "<group>"; };
@@ -15366,6 +15370,8 @@
B22278EC0D00BF210071B782 /* SVGPathSegList.idl */,
8476C9E311DF6A0B00555B02 /* SVGPathSegListBuilder.cpp */,
8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */,
+ 84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */,
+ 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */,
B22278ED0D00BF210071B782 /* SVGPathSegMoveto.cpp */,
B22278EE0D00BF210071B782 /* SVGPathSegMoveto.h */,
B22278EF0D00BF210071B782 /* SVGPathSegMovetoAbs.idl */,
@@ -19845,6 +19851,7 @@
B2227A7D0D00BF220071B782 /* SVGPathSegLinetoVertical.h in Headers */,
B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
+ 84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */,
B2227A840D00BF220071B782 /* SVGPathSegMoveto.h in Headers */,
84300BD8120C9AD40021954A /* SVGPathSource.h in Headers */,
8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */,
@@ -22309,6 +22316,7 @@
B2227A7C0D00BF220071B782 /* SVGPathSegLinetoVertical.cpp in Sources */,
B2227A800D00BF220071B782 /* SVGPathSegList.cpp in Sources */,
8476C9E511DF6A0B00555B02 /* SVGPathSegListBuilder.cpp in Sources */,
+ 84B6B977120F13E500B8EFAF /* SVGPathSegListSource.cpp in Sources */,
B2227A830D00BF220071B782 /* SVGPathSegMoveto.cpp in Sources */,
8419D2B9120E0C7600141F8F /* SVGPathStringBuilder.cpp in Sources */,
84300BDA120C9AED0021954A /* SVGPathStringSource.cpp in Sources */,
diff --git a/WebCore/svg/SVGAllInOne.cpp b/WebCore/svg/SVGAllInOne.cpp
index 3207a41..6bcf945 100644
--- a/WebCore/svg/SVGAllInOne.cpp
+++ b/WebCore/svg/SVGAllInOne.cpp
@@ -125,6 +125,7 @@
#include "SVGPathSegLinetoVertical.cpp"
#include "SVGPathSegList.cpp"
#include "SVGPathSegListBuilder.cpp"
+#include "SVGPathSegListSource.cpp"
#include "SVGPathSegMoveto.cpp"
#include "SVGPathStringBuilder.cpp"
#include "SVGPathStringSource.cpp"
diff --git a/WebCore/svg/SVGPathByteStreamSource.cpp b/WebCore/svg/SVGPathByteStreamSource.cpp
index 684843f..e6a60e3 100644
--- a/WebCore/svg/SVGPathByteStreamSource.cpp
+++ b/WebCore/svg/SVGPathByteStreamSource.cpp
@@ -41,27 +41,78 @@ bool SVGPathByteStreamSource::hasMoreData() const
return m_streamCurrent < m_streamEnd;
}
-bool SVGPathByteStreamSource::parseFloat(float& result)
+bool SVGPathByteStreamSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
{
- result = readFloat();
+ pathSegType = static_cast<SVGPathSegType>(readSVGSegmentType());
return true;
}
-bool SVGPathByteStreamSource::parseFlag(bool& result)
+SVGPathSegType SVGPathByteStreamSource::nextCommand(SVGPathSegType)
{
- result = readFlag();
+ return static_cast<SVGPathSegType>(readSVGSegmentType());
+}
+
+bool SVGPathByteStreamSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ targetPoint = readFloatPoint();
return true;
}
-bool SVGPathByteStreamSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+bool SVGPathByteStreamSource::parseLineToSegment(FloatPoint& targetPoint)
{
- pathSegType = static_cast<SVGPathSegType>(readSVGSegmentType());
+ targetPoint = readFloatPoint();
return true;
}
-SVGPathSegType SVGPathByteStreamSource::nextCommand(SVGPathSegType)
+bool SVGPathByteStreamSource::parseLineToHorizontalSegment(float& x)
{
- return static_cast<SVGPathSegType>(readSVGSegmentType());
+ x = readFloat();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseLineToVerticalSegment(float& y)
+{
+ y = readFloat();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ point1 = readFloatPoint();
+ point2 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ point2 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ point1 = readFloatPoint();
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ targetPoint = readFloatPoint();
+ return true;
+}
+
+bool SVGPathByteStreamSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ rx = readFloat();
+ ry = readFloat();
+ angle = readFloat();
+ largeArc = readFlag();
+ sweep = readFlag();
+ targetPoint = readFloatPoint();
+ return true;
}
}
diff --git a/WebCore/svg/SVGPathByteStreamSource.h b/WebCore/svg/SVGPathByteStreamSource.h
index f3d5e58..2537ad2 100644
--- a/WebCore/svg/SVGPathByteStreamSource.h
+++ b/WebCore/svg/SVGPathByteStreamSource.h
@@ -39,11 +39,19 @@ public:
virtual bool hasMoreData() const;
virtual bool moveToNextToken() { return true; }
- virtual bool parseFloat(float& result);
- virtual bool parseFlag(bool& result);
virtual bool parseSVGSegmentType(SVGPathSegType&);
virtual SVGPathSegType nextCommand(SVGPathSegType);
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
private:
SVGPathByteStreamSource(SVGPathByteStream*);
diff --git a/WebCore/svg/SVGPathParser.cpp b/WebCore/svg/SVGPathParser.cpp
index ed381db..c729dfb 100644
--- a/WebCore/svg/SVGPathParser.cpp
+++ b/WebCore/svg/SVGPathParser.cpp
@@ -53,48 +53,44 @@ void SVGPathParser::parseClosePathSegment()
bool SVGPathParser::parseMoveToSegment()
{
- float toX;
- float toY;
- if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
+ FloatPoint targetPoint;
+ if (!m_source->parseMoveToSegment(targetPoint))
return false;
- FloatPoint toPoint(toX, toY);
if (m_pathParsingMode == NormalizedParsing) {
if (m_mode == RelativeCoordinates)
- m_currentPoint += toPoint;
+ m_currentPoint += targetPoint;
else
- m_currentPoint = toPoint;
+ m_currentPoint = targetPoint;
m_subPathPoint = m_currentPoint;
m_consumer->moveTo(m_currentPoint, m_closePath, AbsoluteCoordinates);
} else
- m_consumer->moveTo(toPoint, m_closePath, m_mode);
+ m_consumer->moveTo(targetPoint, m_closePath, m_mode);
m_closePath = false;
return true;
}
bool SVGPathParser::parseLineToSegment()
{
- float toX;
- float toY;
- if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
+ FloatPoint targetPoint;
+ if (!m_source->parseLineToSegment(targetPoint))
return false;
- FloatPoint toPoint(toX, toY);
if (m_pathParsingMode == NormalizedParsing) {
if (m_mode == RelativeCoordinates)
- m_currentPoint += toPoint;
+ m_currentPoint += targetPoint;
else
- m_currentPoint = toPoint;
+ m_currentPoint = targetPoint;
m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
} else
- m_consumer->lineTo(toPoint, m_mode);
+ m_consumer->lineTo(targetPoint, m_mode);
return true;
}
bool SVGPathParser::parseLineToHorizontalSegment()
{
float toX;
- if (!m_source->parseFloat(toX))
+ if (!m_source->parseLineToHorizontalSegment(toX))
return false;
if (m_pathParsingMode == NormalizedParsing) {
@@ -111,7 +107,7 @@ bool SVGPathParser::parseLineToHorizontalSegment()
bool SVGPathParser::parseLineToVerticalSegment()
{
float toY;
- if (!m_source->parseFloat(toY))
+ if (!m_source->parseLineToVerticalSegment(toY))
return false;
if (m_pathParsingMode == NormalizedParsing) {
@@ -127,23 +123,12 @@ bool SVGPathParser::parseLineToVerticalSegment()
bool SVGPathParser::parseCurveToCubicSegment()
{
- float x1;
- float y1;
- float x2;
- float y2;
- float toX;
- float 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))
+ FloatPoint point1;
+ FloatPoint point2;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToCubicSegment(point1, point2, targetPoint))
return false;
- FloatPoint point1(x1, y1);
- FloatPoint point2(x2, y2);
- FloatPoint targetPoint(toX, toY);
if (m_pathParsingMode == NormalizedParsing) {
if (m_mode == RelativeCoordinates) {
point1 += m_currentPoint;
@@ -161,14 +146,9 @@ bool SVGPathParser::parseCurveToCubicSegment()
bool SVGPathParser::parseCurveToCubicSmoothSegment()
{
- float x2;
- float y2;
- float toX;
- float toY;
- if (!m_source->parseFloat(x2)
- || !m_source->parseFloat(y2)
- || !m_source->parseFloat(toX)
- || !m_source->parseFloat(toY))
+ FloatPoint point2;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToCubicSmoothSegment(point2, targetPoint))
return false;
if (m_lastCommand != PathSegCurveToCubicAbs
@@ -177,8 +157,6 @@ bool SVGPathParser::parseCurveToCubicSmoothSegment()
&& m_lastCommand != PathSegCurveToCubicSmoothRel)
m_controlPoint = m_currentPoint;
- FloatPoint point2(x2, y2);
- FloatPoint targetPoint(toX, toY);
if (m_pathParsingMode == NormalizedParsing) {
FloatPoint point1 = m_currentPoint;
point1.scale(2, 2);
@@ -199,21 +177,16 @@ bool SVGPathParser::parseCurveToCubicSmoothSegment()
bool SVGPathParser::parseCurveToQuadraticSegment()
{
- float x1;
- float y1;
- float toX;
- float toY;
- if (!m_source->parseFloat(x1)
- || !m_source->parseFloat(y1)
- || !m_source->parseFloat(toX)
- || !m_source->parseFloat(toY))
+ FloatPoint point1;
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToQuadraticSegment(point1, targetPoint))
return false;
- FloatPoint targetPoint(toX, toY);
if (m_pathParsingMode == NormalizedParsing) {
+ m_controlPoint = point1;
FloatPoint point1 = m_currentPoint;
- point1.move(2 * x1, 2 * y1);
- FloatPoint point2(toX + 2 * x1, toY + 2 * y1);
+ point1.move(2 * m_controlPoint.x(), 2 * m_controlPoint.y());
+ FloatPoint point2(targetPoint.x() + 2 * m_controlPoint.x(), targetPoint.y() + 2 * m_controlPoint.y());
if (m_mode == RelativeCoordinates) {
point1.move(2 * m_currentPoint.x(), 2 * m_currentPoint.y());
point2.move(3 * m_currentPoint.x(), 3 * m_currentPoint.y());
@@ -224,20 +197,18 @@ bool SVGPathParser::parseCurveToQuadraticSegment()
m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
- m_controlPoint = FloatPoint(x1, y1);
if (m_mode == RelativeCoordinates)
m_controlPoint += m_currentPoint;
m_currentPoint = targetPoint;
} else
- m_consumer->curveToQuadratic(FloatPoint(x1, y1), targetPoint, m_mode);
+ m_consumer->curveToQuadratic(point1, targetPoint, m_mode);
return true;
}
bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
{
- float toX;
- float toY;
- if (!m_source->parseFloat(toX) || !m_source->parseFloat(toY))
+ FloatPoint targetPoint;
+ if (!m_source->parseCurveToQuadraticSmoothSegment(targetPoint))
return false;
if (m_lastCommand != PathSegCurveToQuadraticAbs
@@ -251,8 +222,7 @@ bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
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 targetPoint(toX, toY);
+ FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2 * cubicPoint.y());
if (m_mode == RelativeCoordinates) {
point2 += m_currentPoint;
targetPoint += m_currentPoint;
@@ -265,29 +235,21 @@ bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
m_controlPoint = cubicPoint;
m_currentPoint = targetPoint;
} else
- m_consumer->curveToQuadraticSmooth(FloatPoint(toX, toY), m_mode);
+ m_consumer->curveToQuadraticSmooth(targetPoint, m_mode);
return true;
}
bool SVGPathParser::parseArcToSegment()
{
- bool largeArc;
- bool sweep;
- float angle;
float rx;
float ry;
- float toX;
- float 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))
+ float angle;
+ bool largeArc;
+ bool sweep;
+ FloatPoint targetPoint;
+ if (!m_source->parseArcToSegment(rx, ry, angle, largeArc, sweep, targetPoint))
return false;
- 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);
diff --git a/WebCore/svg/SVGPathSegListSource.cpp b/WebCore/svg/SVGPathSegListSource.cpp
new file mode 100644
index 0000000..48fa094
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListSource.cpp
@@ -0,0 +1,167 @@
+/*
+ * 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 "SVGPathSegListSource.h"
+
+#include "SVGPathSegArc.h"
+#include "SVGPathSegCurvetoCubic.h"
+#include "SVGPathSegCurvetoCubicSmooth.h"
+#include "SVGPathSegCurvetoQuadratic.h"
+#include "SVGPathSegLinetoHorizontal.h"
+#include "SVGPathSegLinetoVertical.h"
+
+namespace WebCore {
+
+SVGPathSegListSource::SVGPathSegListSource(SVGPathSegList* pathSegList)
+ : m_pathSegList(pathSegList)
+{
+ ASSERT(m_pathSegList);
+ m_itemCurrent = 0;
+ m_itemEnd = m_pathSegList->numberOfItems();
+}
+
+SVGPathSegListSource::~SVGPathSegListSource()
+{
+}
+
+bool SVGPathSegListSource::hasMoreData() const
+{
+ return m_itemCurrent < m_itemEnd;
+}
+
+bool SVGPathSegListSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ m_segment = m_pathSegList->getItem(m_itemCurrent, ec);
+ if (ec)
+ return false;
+ pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
+ ++m_itemCurrent;
+ return true;
+}
+
+SVGPathSegType SVGPathSegListSource::nextCommand(SVGPathSegType)
+{
+ ASSERT(m_pathSegList);
+ ExceptionCode ec = 0;
+ m_segment = m_pathSegList->getItem(m_itemCurrent, ec);
+ if (ec)
+ return PathSegUnknown;
+ SVGPathSegType pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
+ ++m_itemCurrent;
+ return pathSegType;
+}
+
+bool SVGPathSegListSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegMoveToAbs || m_segment->pathSegType() == PathSegMoveToRel);
+ SVGPathSegSingleCoord* moveTo = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(moveTo->x(), moveTo->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToAbs || m_segment->pathSegType() == PathSegLineToRel);
+ SVGPathSegSingleCoord* lineTo = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(lineTo->x(), lineTo->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToHorizontalSegment(float& x)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToHorizontalAbs || m_segment->pathSegType() == PathSegLineToHorizontalRel);
+ SVGPathSegLinetoHorizontal* horizontal = static_cast<SVGPathSegLinetoHorizontal*>(m_segment.get());
+ x = horizontal->x();
+ return true;
+}
+
+bool SVGPathSegListSource::parseLineToVerticalSegment(float& y)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegLineToVerticalAbs || m_segment->pathSegType() == PathSegLineToVerticalRel);
+ SVGPathSegLinetoVertical* vertical = static_cast<SVGPathSegLinetoVertical*>(m_segment.get());
+ y = vertical->y();
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToCubicAbs || m_segment->pathSegType() == PathSegCurveToCubicRel);
+ SVGPathSegCurvetoCubic* cubic = static_cast<SVGPathSegCurvetoCubic*>(m_segment.get());
+ point1 = FloatPoint(cubic->x1(), cubic->y1());
+ point2 = FloatPoint(cubic->x2(), cubic->y2());
+ targetPoint = FloatPoint(cubic->x(), cubic->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToCubicSmoothSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToCubicSmoothAbs || m_segment->pathSegType() == PathSegCurveToCubicSmoothRel);
+ SVGPathSegCurvetoCubicSmooth* cubicSmooth = static_cast<SVGPathSegCurvetoCubicSmooth*>(m_segment.get());
+ point2 = FloatPoint(cubicSmooth->x2(), cubicSmooth->y2());
+ targetPoint = FloatPoint(cubicSmooth->x(), cubicSmooth->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToQuadraticSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToQuadraticAbs || m_segment->pathSegType() == PathSegCurveToQuadraticRel);
+ SVGPathSegCurvetoQuadratic* quadratic = static_cast<SVGPathSegCurvetoQuadratic*>(m_segment.get());
+ point1 = FloatPoint(quadratic->x1(), quadratic->y1());
+ targetPoint = FloatPoint(quadratic->x(), quadratic->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegCurveToQuadraticSmoothAbs || m_segment->pathSegType() == PathSegCurveToQuadraticSmoothRel);
+ SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment.get());
+ targetPoint = FloatPoint(quadraticSmooth->x(), quadraticSmooth->y());
+ return true;
+}
+
+bool SVGPathSegListSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ ASSERT(m_segment);
+ ASSERT(m_segment->pathSegType() == PathSegArcAbs || m_segment->pathSegType() == PathSegArcRel);
+ SVGPathSegArc* arcTo = static_cast<SVGPathSegArc*>(m_segment.get());
+ rx = arcTo->r1();
+ ry = arcTo->r2();
+ angle = arcTo->angle();
+ largeArc = arcTo->largeArcFlag();
+ sweep = arcTo->sweepFlag();
+ targetPoint = FloatPoint(arcTo->x(), arcTo->y());
+ return true;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathSegListSource.h b/WebCore/svg/SVGPathSegListSource.h
new file mode 100644
index 0000000..fd89e3e
--- /dev/null
+++ b/WebCore/svg/SVGPathSegListSource.h
@@ -0,0 +1,69 @@
+/*
+ * 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 SVGPathSegListSource_h
+#define SVGPathSegListSource_h
+
+#if ENABLE(SVG)
+#include "FloatPoint.h"
+#include "SVGPathSeg.h"
+#include "SVGPathSegList.h"
+#include "SVGPathSource.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SVGPathSegListSource : public SVGPathSource {
+public:
+ static PassOwnPtr<SVGPathSegListSource> create(SVGPathSegList* pathSegList)
+ {
+ return adoptPtr(new SVGPathSegListSource(pathSegList));
+ }
+
+ virtual ~SVGPathSegListSource();
+
+ virtual bool hasMoreData() const;
+ virtual bool moveToNextToken() { return true; }
+ virtual bool parseSVGSegmentType(SVGPathSegType&);
+ virtual SVGPathSegType nextCommand(SVGPathSegType);
+
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
+private:
+ SVGPathSegListSource(SVGPathSegList*);
+
+ SVGPathSegList* m_pathSegList;
+ RefPtr<SVGPathSeg> m_segment;
+ int m_itemCurrent;
+ int m_itemEnd;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif // SVGPathSegListSource_h
diff --git a/WebCore/svg/SVGPathSource.h b/WebCore/svg/SVGPathSource.h
index 6540231..6d7ec5f 100644
--- a/WebCore/svg/SVGPathSource.h
+++ b/WebCore/svg/SVGPathSource.h
@@ -31,11 +31,19 @@ public:
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;
+ virtual bool parseMoveToSegment(FloatPoint&) = 0;
+ virtual bool parseLineToSegment(FloatPoint&) = 0;
+ virtual bool parseLineToHorizontalSegment(float&) = 0;
+ virtual bool parseLineToVerticalSegment(float&) = 0;
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&) = 0;
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&) = 0;
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&) = 0;
+
public:
SVGPathSource() { }
};
diff --git a/WebCore/svg/SVGPathStringSource.cpp b/WebCore/svg/SVGPathStringSource.cpp
index 5045098..0efbfd0 100644
--- a/WebCore/svg/SVGPathStringSource.cpp
+++ b/WebCore/svg/SVGPathStringSource.cpp
@@ -43,16 +43,6 @@ 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);
@@ -141,6 +131,117 @@ SVGPathSegType SVGPathStringSource::nextCommand(SVGPathSegType previousCommand)
return nextCommand;
}
+bool SVGPathStringSource::parseMoveToSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX) || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseLineToSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX) || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseLineToHorizontalSegment(float& x)
+{
+ return parseNumber(m_current, m_end, x);
+}
+
+bool SVGPathStringSource::parseLineToVerticalSegment(float& y)
+{
+ return parseNumber(m_current, m_end, y);
+}
+
+bool SVGPathStringSource::parseCurveToCubicSegment(FloatPoint& point1, FloatPoint& point2, FloatPoint& targetPoint)
+{
+ float x1;
+ float y1;
+ float x2;
+ float y2;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x1)
+ || !parseNumber(m_current, m_end, y1)
+ || !parseNumber(m_current, m_end, x2)
+ || !parseNumber(m_current, m_end, y2)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point1 = FloatPoint(x1, y1);
+ point2 = FloatPoint(x2, y2);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToCubicSmoothSegment(FloatPoint& point1, FloatPoint& targetPoint)
+{
+ float x1;
+ float y1;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x1)
+ || !parseNumber(m_current, m_end, y1)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point1 = FloatPoint(x1, y1);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToQuadraticSegment(FloatPoint& point2, FloatPoint& targetPoint)
+{
+ float x2;
+ float y2;
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, x2)
+ || !parseNumber(m_current, m_end, y2)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ point2 = FloatPoint(x2, y2);
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseCurveToQuadraticSmoothSegment(FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+bool SVGPathStringSource::parseArcToSegment(float& rx, float& ry, float& angle, bool& largeArc, bool& sweep, FloatPoint& targetPoint)
+{
+ float toX;
+ float toY;
+ if (!parseNumber(m_current, m_end, rx)
+ || !parseNumber(m_current, m_end, ry)
+ || !parseNumber(m_current, m_end, angle)
+ || !parseArcFlag(m_current, m_end, largeArc)
+ || !parseArcFlag(m_current, m_end, sweep)
+ || !parseNumber(m_current, m_end, toX)
+ || !parseNumber(m_current, m_end, toY))
+ return false;
+ targetPoint = FloatPoint(toX, toY);
+ return true;
+}
+
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGPathStringSource.h b/WebCore/svg/SVGPathStringSource.h
index dadfc8a..d0266f4 100644
--- a/WebCore/svg/SVGPathStringSource.h
+++ b/WebCore/svg/SVGPathStringSource.h
@@ -21,6 +21,7 @@
#define SVGPathStringSource_h
#if ENABLE(SVG)
+#include "FloatPoint.h"
#include "PlatformString.h"
#include "SVGPathSource.h"
#include <wtf/PassOwnPtr.h>
@@ -38,11 +39,19 @@ public:
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);
+ virtual bool parseMoveToSegment(FloatPoint&);
+ virtual bool parseLineToSegment(FloatPoint&);
+ virtual bool parseLineToHorizontalSegment(float&);
+ virtual bool parseLineToVerticalSegment(float&);
+ virtual bool parseCurveToCubicSegment(FloatPoint&, FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToCubicSmoothSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSegment(FloatPoint&, FloatPoint&);
+ virtual bool parseCurveToQuadraticSmoothSegment(FloatPoint&);
+ virtual bool parseArcToSegment(float&, float&, float&, bool&, bool&, FloatPoint&);
+
private:
SVGPathStringSource(const String&);
String m_string;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list