Re: [svgwg] Serialization format for path strings

The reason that the path syntaxes (with and without `path()` function notation) use strings is because implementations did not want to have to parse path data with the CSS parser.  Given that the path data is just a string to the parser, it seems a bit strange to normalize it for `getComputedStyle`.  Are there any other examples of normalization of string values during serialization (e.g., in `font-family`)?  You might need to run this by the CSS folks to make sure that's ok.

That said:

I like the idea of being able to access normalized path data for `path()` functions used in CSS, not only for entire elements. `getComputedStyle` seems an appropriate means of doing that normalization.  I suppose we could define a new data type `<path-string>` which is equal to a string for parsing but which is internally parsed and normalized when returning computed styles.

As you say, using normalized paths for computed styles would increase the flexibility of path interpolation considerably.  It wouldn't be that much of a stretch to go one step farther and allow interpolation to/from the other shape functions, by converting them to [equivalent paths](https://svgwg.org/svg2-draft/paths.html#TermEquivalentPath).

There is an existing standard for what a "normalized" path string looks like: the [`normalizedPathSegList'](https://www.w3.org/TR/SVG11/paths.html#__svg__SVGAnimatedPathData__normalizedPathSegList) getter from SVG 1.1 (removed from SVG 2 along with all the other PathSeg DOM), which is re-created as the `normalize` option in the [`getPathData()` method](https://svgwg.org/specs/paths/#InterfaceSVGPathData) in the SVG Paths module.

The big limitation of that standard is that the normalized path notation doesn't include true arcs, and instead recommends they get converted into straight lines!  I'd definitely not want to see that re-created in any new spec.  (If you have to normalize arcs to another segment type, at least use cubic beziers!)




-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/321#issuecomment-304470180 using your GitHub account

Received on Saturday, 27 May 2017 18:56:50 UTC