RESOLVED FIXED 44009
Use SVGPathParser logic to traverse states of a Path
https://bugs.webkit.org/show_bug.cgi?id=44009
Summary Use SVGPathParser logic to traverse states of a Path
Dirk Schulze
Reported 2010-08-14 07:20:41 PDT
Use SVGPathParser logic to traverse states of a Path.
Attachments
Patch (29.65 KB, patch)
2010-08-14 09:36 PDT, Dirk Schulze
no flags
Patch (29.51 KB, patch)
2010-08-14 10:11 PDT, Dirk Schulze
no flags
Patch (29.58 KB, patch)
2010-08-16 06:16 PDT, Dirk Schulze
zimmermann: review+
Dirk Schulze
Comment 1 2010-08-14 09:36:49 PDT
Eric Seidel (no email)
Comment 2 2010-08-14 09:52:49 PDT
Dirk Schulze
Comment 3 2010-08-14 10:08:43 PDT
(In reply to comment #2) > Attachment 64417 [details] did not build on mac: > Build output: http://queues.webkit.org/results/3772165 Hah, just tried the debug build on Mac :-)
Dirk Schulze
Comment 4 2010-08-14 10:11:52 PDT
Nikolas Zimmermann
Comment 5 2010-08-15 13:33:37 PDT
Comment on attachment 64420 [details] Patch Hi Dirk, good job, some comments: WebCore/ChangeLog:8 + Move the getPathSegAtLength logic from SVGPathSegList to a new SVGPathParser Consumer. Move the getPathsegAtLength logic from SVGPathSegList into a new SVGPathConsumer class: SVGPathTraversalStateBuilder. WebCore/ChangeLog:9-10 + This allows us to get a SVGPathSeg at a given length of SVGPathByteStreams, as + well as of SVGPathSegLists. This allows us to get a SVGPathSeg at a given length for SVGPathByteStreams and SVGPathSegLists. WebCore/svg/SVGPathBuilder.h:39 + virtual void nextPathSegment() { } nextPathSegment sounds like it would give you the next path segment type or something. suggestion: "pathSegmentStarted". (wrong, see below :-) Just saw that you're calling it after the segment has been processed, so "incrementPathSegmentCount" sounds even better. WebCore/svg/SVGPathBuilder.h:40 + virtual bool quitEarlier() { return false; } I'd name it "continueConsuming" return true by default. WebCore/svg/SVGPathElement.idl:40 + unsigned long getPathSegAtLength(in float distance); Ok, just checked SVG 1.1, this is indeed correct, getPathSegAtLength doesn't raise exceptions, so fine with me. WebCore/svg/SVGPathParserFactory.cpp:79 + static SVGPathTraversalStateBuilder* globalSVGPathTraversalStateBuilder(PathTraversalState* traversalState, float length) Take a PathTraversalState& reference here. WebCore/svg/SVGPathParserFactory.cpp:85 + s_builder->setCurrentTraversalState(traversalState); Use &traversalState. WebCore/svg/SVGPathParserFactory.cpp:275 + OwnPtr<PathTraversalState> traversalState = adoptPtr(new PathTraversalState(PathTraversalState::TraversalSegmentAtLength)); Don't create this on the heap - there's no gain in doing so, just create it on the stack. WebCore/svg/SVGPathTraversalStateBuilder.cpp:70 + return (m_traversalState->m_totalLength >= m_traversalState->m_desiredLength); Useless braces. WebCore/svg/SVGPathTraversalStateBuilder.cpp:76 + m_traversalState->m_segmentIndex++; ++m_traversalState->m_segmentIndex.
Dirk Schulze
Comment 6 2010-08-15 22:47:25 PDT
(In reply to comment #5) > WebCore/svg/SVGPathElement.idl:40 > + unsigned long getPathSegAtLength(in float distance); > Ok, just checked SVG 1.1, this is indeed correct, getPathSegAtLength doesn't raise exceptions, so fine with me. Sure, I wouldn't change IDL's if they are not wrong :-) Working on the other issues.
Dirk Schulze
Comment 7 2010-08-16 06:16:15 PDT
Nikolas Zimmermann
Comment 8 2010-08-18 01:19:52 PDT
Comment on attachment 64488 [details] Patch r=me, with two small suggestions: WebCore/ChangeLog:8 + Move the getPathsegAtLength logic from SVGPathSegList into a new SVGPathConsumer s/Pathseg/PathSeg/ WebCore/svg/SVGPathTraversalStateBuilder.h:35 + unsigned long getSVGPathSeg(); s/getSVGPathSeg/pathSegmentIndex/
Dirk Schulze
Comment 9 2010-08-18 06:21:30 PDT
Note You need to log in before you can comment on or make changes to this bug.