DescriptionRework 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. #
Messages
Total messages: 11 (4 generated)
|