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

Review URL: https://codereview.chromium.org/1023993002

git-svn-id: svn://svn.chromium.org/blink/trunk@192348 bbb929c8-8fbe-4397-9dbb-9b2b20218538
14 files changed
tree: cf9bb1d23938cff44c742b20e681e853eea3e080
  1. third_party/