Chromium Code Reviews

Issue 1023993002: Rework the SVGPathSource interface (Closed)

Created:
5 years, 9 months ago by fs
Modified:
5 years, 9 months ago
Reviewers:
pdr., Erik Dahlström (inactive), f(malita), Stephen Chennney, kouhei (in TOK)
CC:
blink-reviews, krit, kouhei+svg_chromium.org, fs, ed+blinkwatch_opera.com, f(malita), gyuyoung.kim_webkit.org, Stephen Chennney, pdr+svgwatchlist_chromium.org, rwlbuis
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Rework the SVGPathSource interface This CL replaces the current per-command interface of SVGPathSource with a per-segment interface. A new struct PathSegmentData is added, and existing SVGPathSources are modified to implement parse into this struct. For the most part this is a trivial copy and paste operation. In SVGPathStringSource, some of the helpers are refactored, and leading whitespace is consumed in the constructor to avoid having something similar to moveToNextToken() in the new interface. Number parsing is also made "latched", by setting a flag on error, and only check that flag when all the input has been considered. This makes the code a bit more streamlined while optimizing for the common case (of no error.) This also renders the parseFloatPoint* helpers unused, so they are removed. peekSegmentType() is added to support checking if the first segment is a move command without directly affecting the common 'transformation' loop. Users of the SVGPathSource interface (SVGPathParser and SVGPathBlender) are refactored to make use of the new interface. For SVGPathParser this means renaming the parse* methods to emit*, while hoisting the input-handling out into the main "parsing" loop, and passing the parsed PathSegmentData to the right emitter. Similarly for SVGPathBlender, the input-handling is hoisted out of the blend* methods, and the two inputs are passed as parameters. The command equality check is changed to only be based on the command type. BUG=467592 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=192348

Patch Set 1 #

Total comments: 6

Patch Set 2 : Blender fixups. #

Unified diffs Side-by-side diffs Stats (+497 lines, -792 lines)
M Source/core/svg/SVGParserUtilities.h View 1 chunk +0 lines, -7 lines 0 comments
M Source/core/svg/SVGParserUtilities.cpp View 1 chunk +0 lines, -60 lines 0 comments
M Source/core/svg/SVGPathBlender.h View 2 chunks +10 lines, -9 lines 0 comments
M Source/core/svg/SVGPathBlender.cpp View 3 chunks +81 lines, -171 lines 0 comments
M Source/core/svg/SVGPathByteStreamSource.h View 1 chunk +2 lines, -13 lines 0 comments
M Source/core/svg/SVGPathByteStreamSource.cpp View 1 chunk +55 lines, -67 lines 0 comments
M Source/core/svg/SVGPathParser.h View 1 chunk +10 lines, -10 lines 0 comments
M Source/core/svg/SVGPathParser.cpp View 7 chunks +101 lines, -165 lines 0 comments
M Source/core/svg/SVGPathSeg.h View 2 chunks +32 lines, -0 lines 0 comments
M Source/core/svg/SVGPathSegListSource.h View 2 chunks +3 lines, -21 lines 0 comments
M Source/core/svg/SVGPathSegListSource.cpp View 2 chunks +69 lines, -105 lines 0 comments
M Source/core/svg/SVGPathSource.h View 2 chunks +2 lines, -15 lines 0 comments
M Source/core/svg/SVGPathStringSource.h View 2 chunks +8 lines, -12 lines 0 comments
M Source/core/svg/SVGPathStringSource.cpp View 5 chunks +124 lines, -137 lines 0 comments

Messages

Total messages: 11 (4 generated)
fs
So this is where the "meatier" parts start - still not too big a CL ...
5 years, 9 months ago (2015-03-20 13:46:09 UTC) #2
Stephen Chennney
LGTM. Tricky to review, but the new code is indeed much better. https://codereview.chromium.org/1023993002/diff/1/Source/core/svg/SVGPathStringSource.cpp File Source/core/svg/SVGPathStringSource.cpp ...
5 years, 9 months ago (2015-03-20 19:40:55 UTC) #4
f(malita)
lgtm++ I agree, this looks much nicer. https://codereview.chromium.org/1023993002/diff/1/Source/core/svg/SVGPathBlender.cpp File Source/core/svg/SVGPathBlender.cpp (right): https://codereview.chromium.org/1023993002/diff/1/Source/core/svg/SVGPathBlender.cpp#newcode300 Source/core/svg/SVGPathBlender.cpp:300: case PathSegUnknown: ...
5 years, 9 months ago (2015-03-22 14:18:48 UTC) #5
kouhei (in TOK)
lgtm
5 years, 9 months ago (2015-03-23 01:44:48 UTC) #6
fs
https://codereview.chromium.org/1023993002/diff/1/Source/core/svg/SVGPathBlender.cpp File Source/core/svg/SVGPathBlender.cpp (right): https://codereview.chromium.org/1023993002/diff/1/Source/core/svg/SVGPathBlender.cpp#newcode300 Source/core/svg/SVGPathBlender.cpp:300: case PathSegUnknown: On 2015/03/22 14:18:48, f(malita) wrote: > Let's ...
5 years, 9 months ago (2015-03-23 11:22:10 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1023993002/20001
5 years, 9 months ago (2015-03-23 12:03:52 UTC) #10
commit-bot: I haz the power
5 years, 9 months ago (2015-03-23 12:07:23 UTC) #11
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=192348

Powered by Google App Engine