WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 43691
Add missing SVGPathSegList source for SVGPathParser
https://bugs.webkit.org/show_bug.cgi?id=43691
Summary
Add missing SVGPathSegList source for SVGPathParser
Dirk Schulze
Reported
2010-08-08 10:07:31 PDT
Add missing SVGPathSegList source for SVGPathParser, to create different Path data from SVGPathSegList.
Attachments
Patch
(38.88 KB, patch)
2010-08-08 10:31 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Patch
(39.98 KB, patch)
2010-08-10 01:01 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Patch
(39.91 KB, patch)
2010-08-10 01:23 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Dirk Schulze
Comment 1
2010-08-08 10:31:05 PDT
Created
attachment 63847
[details]
Patch
Nikolas Zimmermann
Comment 2
2010-08-09 23:08:49 PDT
Comment on
attachment 63847
[details]
Patch Still needs some tweaks: WebCore/ChangeLog:11 + Did some refactoring of SVGPathSource, the input data of SVGPathParser. The parsing process 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. WebCore/svg/SVGPathByteStreamSource.cpp:79 + bool SVGPathByteStreamSource::parseCurveToCubicSegment(FloatPoint& point1 , FloatPoint& point2, FloatPoint& targetPoint) Superfluous space before comma. WebCore/svg/SVGPathParser.cpp:76 + if (!m_source->parseMoveToSegment(targetPoint)) parseLineToSegment! :-) WebCore/svg/SVGPathSegListSource.cpp:39 + m_itemEnd = pathSegList->numberOfItems(); For consistency: s/pathSegList/m_pathSegList/ WebCore/svg/SVGPathSegListSource.cpp:78 + SVGPathSegSingleCoord* moveTo = static_cast<SVGPathSegSingleCoord*>(m_segment); You should ASSERT that the type is correct before casting, and also in all the other parse*Segment functions. WebCore/svg/SVGPathSegListSource.cpp:107 + bool SVGPathSegListSource::parseCurveToCubicSegment(FloatPoint& point1 , FloatPoint& point2, FloatPoint& targetPoint) Superfluous space before comma. WebCore/svg/SVGPathSegListSource.cpp:138 + SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment); You can cast to the concrete SVGPathSegCurveToQudaraticSmoothSegment, no? WebCore/svg/SVGPathSegListSource.h:60 + SVGPathSeg* m_segment; Hm, as SVGPathSeg is refcounted, you'd better store a RefPtr<SVGPathSeg> here, it's safer. Instead of using static_cast to cast from SVGPathSeg to the individual types, you can use static_pointer_cast, that gives the same functionality but operates on RefPtrs. WebCore/svg/SVGPathStringSource.cpp:164 + bool SVGPathStringSource::parseCurveToCubicSegment(FloatPoint& point1 , FloatPoint& point2, FloatPoint& targetPoint) Superfluous space before comma.
Dirk Schulze
Comment 3
2010-08-09 23:22:58 PDT
(In reply to
comment #2
)
> (From update of
attachment 63847
[details]
)
> WebCore/svg/SVGPathSegListSource.cpp:138 > + SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment); > You can cast to the concrete SVGPathSegCurveToQudaraticSmoothSegment, no?
Sure, but I want to avoid unneccessary includes here. The same for lineTo and moveTo. All of them need to be included, just to get x and y. Not needed in my eyes.
Dirk Schulze
Comment 4
2010-08-09 23:42:58 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > (From update of
attachment 63847
[details]
[details]) > > > WebCore/svg/SVGPathSegListSource.cpp:138 > > + SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment); > > You can cast to the concrete SVGPathSegCurveToQudaraticSmoothSegment, no? > > Sure, but I want to avoid unneccessary includes here. The same for lineTo and moveTo. All of them need to be included, just to get x and y. Not needed in my eyes.
With ther type ASSERT you mentioned above, I had to include all these files and have to write something like: ASSERT(static_cast<SVGPathSegType>(m_segment->pathSegType()) == PathSegMoveToAbs || static_cast<SVGPathSegType>(m_segment->pathSegType()) == PathSegMoveToRel); for every function :-/
Nikolas Zimmermann
Comment 5
2010-08-10 00:07:56 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > (From update of
attachment 63847
[details]
[details]) > > > WebCore/svg/SVGPathSegListSource.cpp:138 > > + SVGPathSegSingleCoord* quadraticSmooth = static_cast<SVGPathSegSingleCoord*>(m_segment); > > You can cast to the concrete SVGPathSegCurveToQudaraticSmoothSegment, no? > > Sure, but I want to avoid unneccessary includes here. The same for lineTo and moveTo. All of them need to be included, just to get x and y. Not needed in my eyes.
Ok, you can leave it as is. (In reply to
comment #4
)
> > With ther type ASSERT you mentioned above, I had to include all these files and have to write something like: > > ASSERT(static_cast<SVGPathSegType>(m_segment->pathSegType()) == PathSegMoveToAbs > || static_cast<SVGPathSegType>(m_segment->pathSegType()) == PathSegMoveToRel);
Not at all, why would you want to cast? ASSERT(m_segment->pathSegType() == PathSegMoveToAbs || m_segment->pathSegType() == PathSegMoveToRel); would work fine.
Dirk Schulze
Comment 6
2010-08-10 01:01:24 PDT
Created
attachment 63982
[details]
Patch
Nikolas Zimmermann
Comment 7
2010-08-10 01:11:33 PDT
Comment on
attachment 63982
[details]
Patch Ok, I gave a bad suggestion. Storing m_segment as RefPtr is fine, but using static_pointer_cast is pointless, as we'd ref/and deref the object during RefPtr<> creation and destruction, in parse*Segment, which is unncessary and just creates usless refs/derefs. Leave RefPtr<SVGPathSeg> m_segment this is fine, but use: SVGPathSegSingleCoord* moveTo = static_cast<SVGPathSegSingleCoord*>(m_segment.get()); here. Sorry for the wrong suggestion.
Nikolas Zimmermann
Comment 8
2010-08-10 01:13:15 PDT
Comment on
attachment 63982
[details]
Patch Forgot to say, other than that it looks great. Please fix the casts, then I'll r+ it... r- for now as EWS is done.
Dirk Schulze
Comment 9
2010-08-10 01:23:22 PDT
Created
attachment 63986
[details]
Patch
Nikolas Zimmermann
Comment 10
2010-08-10 01:36:49 PDT
Comment on
attachment 63986
[details]
Patch Looks good, r=me.
Dirk Schulze
Comment 11
2010-08-10 01:47:57 PDT
Comment on
attachment 63986
[details]
Patch Clearing flags on attachment: 63986 Committed
r65059
: <
http://trac.webkit.org/changeset/65059
>
Dirk Schulze
Comment 12
2010-08-10 01:48:07 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug