Changeset 64909 in webkit
- Timestamp:
- Aug 7, 2010 8:17:47 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.mk
r64898 r64909 872 872 svg/SVGParserUtilities.cpp \ 873 873 svg/SVGPathBuilder.cpp \ 874 svg/SVGPathByteStreamBuilder.cpp \ 875 svg/SVGPathByteStreamSource.cpp \ 874 876 svg/SVGPathElement.cpp \ 875 877 svg/SVGPathParser.cpp \ -
trunk/WebCore/CMakeLists.txt
r64898 r64909 1680 1680 svg/SVGParserUtilities.cpp 1681 1681 svg/SVGPathBuilder.cpp 1682 svg/SVGPathByteStreamBuilder.cpp 1683 svg/SVGPathByteStreamSource.cpp 1682 1684 svg/SVGPathElement.cpp 1683 1685 svg/SVGPathParser.cpp -
trunk/WebCore/ChangeLog
r64908 r64909 1 2010-08-07 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 Come up with a more efficient way to represent Path segments 6 https://bugs.webkit.org/show_bug.cgi?id=41159 7 8 Introduce SVGPathByteStream as a fast and efficient way to organize the synchronization 9 of Path, SVG path data string and SVGPathSegList in normalized and unaltered modes. 10 Extended SVGPathParserFactory to accept SVGPathByteStreams as input source and to create 11 a SVGPathByteStream from a SVG path data string. 12 13 Doesn't affect any tests. 14 15 * Android.mk: 16 * CMakeLists.txt: 17 * GNUmakefile.am: 18 * WebCore.gypi: 19 * WebCore.pro: 20 * WebCore.vcproj/WebCore.vcproj: 21 * svg/SVGAllInOne.cpp: 22 * svg/SVGPathByteStream.h: Added. 23 (WebCore::): 24 (WebCore::SVGPathByteStream::create): 25 (WebCore::SVGPathByteStream::data): 26 (WebCore::SVGPathByteStream::begin): 27 (WebCore::SVGPathByteStream::end): 28 (WebCore::SVGPathByteStream::append): 29 (WebCore::SVGPathByteStream::clear): 30 (WebCore::SVGPathByteStream::isEmpty): 31 (WebCore::SVGPathByteStream::SVGPathByteStream): 32 * svg/SVGPathByteStreamBuilder.cpp: Added. 33 (WebCore::SVGPathByteStreamBuilder::SVGPathByteStreamBuilder): 34 (WebCore::SVGPathByteStreamBuilder::moveTo): 35 (WebCore::SVGPathByteStreamBuilder::lineTo): 36 (WebCore::SVGPathByteStreamBuilder::lineToHorizontal): 37 (WebCore::SVGPathByteStreamBuilder::lineToVertical): 38 (WebCore::SVGPathByteStreamBuilder::curveToCubic): 39 (WebCore::SVGPathByteStreamBuilder::curveToCubicSmooth): 40 (WebCore::SVGPathByteStreamBuilder::curveToQuadratic): 41 (WebCore::SVGPathByteStreamBuilder::curveToQuadraticSmooth): 42 (WebCore::SVGPathByteStreamBuilder::arcTo): 43 (WebCore::SVGPathByteStreamBuilder::closePath): 44 * svg/SVGPathByteStreamBuilder.h: Added. 45 (WebCore::SVGPathByteStreamBuilder::setCurrentByteStream): 46 (WebCore::SVGPathByteStreamBuilder::writeType): 47 (WebCore::SVGPathByteStreamBuilder::writeFlag): 48 (WebCore::SVGPathByteStreamBuilder::writeFloat): 49 (WebCore::SVGPathByteStreamBuilder::writeFloatPoint): 50 (WebCore::SVGPathByteStreamBuilder::writeSegmentType): 51 * svg/SVGPathByteStreamSource.cpp: Added. 52 (WebCore::SVGPathByteStreamSource::SVGPathByteStreamSource): 53 (WebCore::SVGPathByteStreamSource::~SVGPathByteStreamSource): 54 (WebCore::SVGPathByteStreamSource::hasMoreData): 55 (WebCore::SVGPathByteStreamSource::parseFloat): 56 (WebCore::SVGPathByteStreamSource::parseFlag): 57 (WebCore::SVGPathByteStreamSource::parseSVGSegmentType): 58 (WebCore::SVGPathByteStreamSource::nextCommand): 59 * svg/SVGPathByteStreamSource.h: Added. 60 (WebCore::SVGPathByteStreamSource::create): 61 (WebCore::SVGPathByteStreamSource::readType): 62 (WebCore::SVGPathByteStreamSource::readFlag): 63 (WebCore::SVGPathByteStreamSource::readFloat): 64 (WebCore::SVGPathByteStreamSource::readSVGSegmentType): 65 (WebCore::SVGPathByteStreamSource::readFloatPoint): 66 * svg/SVGPathParserFactory.cpp: 67 (WebCore::globalSVGPathByteStreamBuilder): 68 (WebCore::SVGPathParserFactory::buildPathFromByteStream): 69 (WebCore::SVGPathParserFactory::buildSVGPathSegListFromByteStream): 70 (WebCore::SVGPathParserFactory::buildSVGPathByteStreamFromString): 71 * svg/SVGPathParserFactory.h: 72 1 73 2010-08-07 Dirk Schulze <krit@webkit.org> 2 74 -
trunk/WebCore/GNUmakefile.am
r64898 r64909 4075 4075 WebCore/svg/SVGPathBuilder.cpp \ 4076 4076 WebCore/svg/SVGPathBuilder.h \ 4077 WebCore/svg/SVGPathByteStream.h \ 4078 WebCore/svg/SVGPathByteStreamBuilder.cpp \ 4079 WebCore/svg/SVGPathByteStreamBuilder.h \ 4080 WebCore/svg/SVGPathByteStreamSource.cpp \ 4081 WebCore/svg/SVGPathByteStreamSource.h \ 4077 4082 WebCore/svg/SVGPathConsumer.h \ 4078 4083 WebCore/svg/SVGPathElement.cpp \ -
trunk/WebCore/WebCore.gypi
r64898 r64909 3829 3829 'svg/SVGPathBuilder.cpp', 3830 3830 'svg/SVGPathBuilder.h', 3831 'svg/SVGPathByteStream.h', 3832 'svg/SVGPathByteStreamBuilder.cpp', 3833 'svg/SVGPathByteStreamBuilder.h', 3834 'svg/SVGPathByteStreamSource.cpp', 3835 'svg/SVGPathByteStreamSource.h', 3831 3836 'svg/SVGPathConsumer.h', 3832 3837 'svg/SVGPathElement.cpp', -
trunk/WebCore/WebCore.pro
r64906 r64909 2854 2854 svg/SVGParserUtilities.cpp \ 2855 2855 svg/SVGPathBuilder.cpp \ 2856 svg/SVGPathByteStreamBuilder.cpp \ 2857 svg/SVGPathByteStreamSource.cpp \ 2856 2858 svg/SVGPathElement.cpp \ 2857 2859 svg/SVGPathParser.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r64898 r64909 49442 49442 </File> 49443 49443 <File 49444 RelativePath="..\svg\SVGPathByteStream.h" 49445 > 49446 </File> 49447 <File 49448 RelativePath="..\svg\SVGPathByteStreamBuilder.h" 49449 > 49450 </File> 49451 <File 49452 RelativePath="..\svg\SVGPathByteStreamSource.h" 49453 > 49454 </File> 49455 <File 49444 49456 RelativePath="..\svg\SVGPathConsumer.h" 49445 49457 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r64908 r64909 1433 1433 82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B658971189E39200E052A1 /* InspectorCSSStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1434 1434 82B6589A1189E47600E052A1 /* InspectorCSSStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */; }; 1435 8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */; }; 1436 8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */; }; 1437 8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */; }; 1438 8419D2AC120D92FC00141F8F /* SVGPathByteStreamSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8419D2AA120D92FC00141F8F /* SVGPathByteStreamSource.cpp */; }; 1439 8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */; }; 1435 1440 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */; }; 1436 1441 841FDC271178C9BE00F8AC9B /* RenderSVGResourceFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */; }; … … 7262 7267 82B658971189E39200E052A1 /* InspectorCSSStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorCSSStore.h; sourceTree = "<group>"; }; 7263 7268 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCSSStore.cpp; sourceTree = "<group>"; }; 7269 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStream.h; sourceTree = "<group>"; }; 7270 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathByteStreamBuilder.cpp; sourceTree = "<group>"; }; 7271 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStreamBuilder.h; sourceTree = "<group>"; }; 7272 8419D2AA120D92FC00141F8F /* SVGPathByteStreamSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathByteStreamSource.cpp; sourceTree = "<group>"; }; 7273 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStreamSource.h; sourceTree = "<group>"; }; 7264 7274 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceFilter.cpp; sourceTree = "<group>"; }; 7265 7275 841FDC251178C9BE00F8AC9B /* RenderSVGResourceFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceFilter.h; sourceTree = "<group>"; }; … … 15302 15312 8476C9E711DF6A2900555B02 /* SVGPathBuilder.cpp */, 15303 15313 8476C9E811DF6A2900555B02 /* SVGPathBuilder.h */, 15314 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */, 15315 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */, 15316 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */, 15317 8419D2AA120D92FC00141F8F /* SVGPathByteStreamSource.cpp */, 15318 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */, 15304 15319 8476C9E911DF6A2900555B02 /* SVGPathConsumer.h */, 15305 15320 B22278C20D00BF200071B782 /* SVGPathElement.cpp */, … … 19811 19826 B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */, 19812 19827 8476C9EB11DF6A2900555B02 /* SVGPathBuilder.h in Headers */, 19828 8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */, 19829 8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */, 19830 8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */, 19813 19831 8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */, 19814 19832 B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */, … … 22274 22292 B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */, 22275 22293 8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */, 22294 8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */, 22295 8419D2AC120D92FC00141F8F /* SVGPathByteStreamSource.cpp in Sources */, 22276 22296 B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */, 22277 22297 8476C9EF11DF6A5800555B02 /* SVGPathParser.cpp in Sources */, -
trunk/WebCore/svg/SVGAllInOne.cpp
r64898 r64909 109 109 #include "SVGParserUtilities.cpp" 110 110 #include "SVGPathBuilder.cpp" 111 #include "SVGPathByteStreamBuilder.cpp" 112 #include "SVGPathByteStreamSource.cpp" 111 113 #include "SVGPathElement.cpp" 112 114 #include "SVGPathParser.cpp" -
trunk/WebCore/svg/SVGPathParserFactory.cpp
r64898 r64909 24 24 25 25 #include "SVGPathBuilder.h" 26 #include "SVGPathByteStreamBuilder.h" 27 #include "SVGPathByteStreamSource.h" 26 28 #include "SVGPathParser.h" 27 29 #include "SVGPathSegListBuilder.h" … … 44 46 if (!s_builder) 45 47 s_builder = new SVGPathSegListBuilder; 48 49 return s_builder; 50 } 51 52 static SVGPathByteStreamBuilder* globalSVGPathByteStreamBuilder() 53 { 54 static SVGPathByteStreamBuilder* s_builder = 0; 55 if (!s_builder) 56 s_builder = new SVGPathByteStreamBuilder; 46 57 47 58 return s_builder; … … 95 106 } 96 107 108 bool SVGPathParserFactory::buildPathFromByteStream(SVGPathByteStream* stream, Path& result) 109 { 110 ASSERT(stream); 111 if (stream->isEmpty()) 112 return false; 113 114 SVGPathBuilder* builder = globalSVGPathBuilder(); 115 builder->setCurrentPath(&result); 116 117 SVGPathParser* parser = globalSVGPathParser(); 118 parser->setCurrentConsumer(builder); 119 120 OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); 121 parser->setCurrentSource(source.get()); 122 123 bool ok = parser->parsePathDataFromSource(NormalizedParsing); 124 parser->setCurrentConsumer(0); 125 parser->setCurrentSource(0); 126 builder->setCurrentPath(0); 127 return ok; 128 } 129 97 130 bool SVGPathParserFactory::buildSVGPathSegListFromString(const String& d, SVGPathSegList* result, PathParsingMode parsingMode) 98 131 { … … 117 150 } 118 151 152 bool SVGPathParserFactory::buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathSegList* result, PathParsingMode parsingMode) 153 { 154 ASSERT(stream); 155 ASSERT(result); 156 157 SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(); 158 builder->setCurrentSVGPathSegList(result); 159 160 SVGPathParser* parser = globalSVGPathParser(); 161 parser->setCurrentConsumer(builder); 162 163 OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); 164 parser->setCurrentSource(source.get()); 165 166 bool ok = parser->parsePathDataFromSource(parsingMode); 167 parser->setCurrentConsumer(0); 168 parser->setCurrentSource(0); 169 builder->setCurrentSVGPathSegList(0); 170 return ok; 171 } 172 173 PassOwnPtr<SVGPathByteStream> SVGPathParserFactory::createSVGPathByteStreamFromString(const String& d, PathParsingMode parsingMode, bool& ok) 174 { 175 if (d.isEmpty()) 176 return false; 177 178 SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(); 179 OwnPtr<SVGPathByteStream> stream = SVGPathByteStream::create(); 180 builder->setCurrentByteStream(stream.get()); 181 182 SVGPathParser* parser = globalSVGPathParser(); 183 parser->setCurrentConsumer(builder); 184 185 OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d); 186 parser->setCurrentSource(source.get()); 187 188 ok = parser->parsePathDataFromSource(parsingMode); 189 parser->setCurrentConsumer(0); 190 parser->setCurrentSource(0); 191 builder->setCurrentByteStream(0); 192 return stream.release(); 193 } 194 119 195 } 120 196 -
trunk/WebCore/svg/SVGPathParserFactory.h
r64898 r64909 26 26 #include "SVGPathConsumer.h" 27 27 #include "SVGPathSegList.h" 28 #include "SVGPathByteStream.h" 29 #include <OwnPtr.h> 28 30 29 31 namespace WebCore { … … 34 36 35 37 bool buildPathFromString(const String&, Path&); 38 bool buildPathFromByteStream(SVGPathByteStream*, Path& result); 36 39 37 40 bool buildSVGPathSegListFromString(const String&, SVGPathSegList*, PathParsingMode); 41 bool buildSVGPathSegListFromByteStream(SVGPathByteStream*, SVGPathSegList*, PathParsingMode); 42 43 PassOwnPtr<SVGPathByteStream> createSVGPathByteStreamFromString(const String&, PathParsingMode, bool& ok); 38 44 39 45 private:
Note: See TracChangeset
for help on using the changeset viewer.