[svgwg] Issue: Serialization format for path strings (#321) marked as Paths chapter

dirkschulze has just labeled an issue for https://github.com/w3c/svgwg as "Paths chapter":

== Serialization format for path strings ==
This issue came up in an Intent to Ship (offset-path animation) discussion on blink-dev.
https://groups.google.com/a/chromium.org/d/msg/blink-dev/_DPl-JG6bV8/y2_GUwFVDwAJ

'd' path strings can contain a mix of absolute and relative coordinates, and a mix of comma and 
space separators. https://www.w3.org/TR/SVG2/paths.html#TheDProperty

It is also possible to animate between paths that differ in the use of separators and absolute and
relative coordinates, for example between 'M 200 400 H 500 v -100' and 'm100,200h400V300'.

Now that 'd' is exposed as a presentation attribute, page authors can use getComputedStyle to
inspect the path string.

For consistency between implementations, it would be helpful if the standard specified absolute
[or relative] coordinates in the serialization format, and space separators.

The above example path strings would become 'M 200 400 H 500 V 300' and 'M 100 200 H 500 V300'
when serialized.

Blink's currently shipping implementation uses space separators, and uses the 'to' format for
absolute/relative coordinates, except at animation progress 0, where the 'from' format is used:-
property <d> from [path('M 200 400 H 500 v -100')] to [path('m100,200h400V300')]
 at (0) is   [path('M 200 400 H 500 v -100')]
at (0.5) is [path('m 150 300 h 350 V 300')]
at (1) is   [path('m 100 200 h 400 V 300')]

If we specify absolute coordinates for the serialization format, these would become:
property <d> from [path('M 200 400 H 500 v -100')] to [path('m100,200h400V300')] 
at (0) is   [path('M 200 400 H 500 V 300')]
at (0.5) is [path('M 150 300 H 500 V 300')]
at (1) is   [path('M 100 200 H 500 V 300')]

If we specify relative coordinates for the serialization format, these would become:
property <d> from [path('M 200 400 H 500 v -100')] to [path('m100,200h400V300')] 
at (0) is   [path('m 200 400 h 300 v -100')]
at (0.5) is [path('m 150 300 h 350 v 0')]
at (1) is   [path('m 100 200 h 400 v 100')]

No backward compatibility issues are anticipated in moving to consistent absolute coordinates [or consistent relative coordinates].


If issue #320 is accepted, there is also the choice of quote character around the path string. Blink uses single quotes.





See https://github.com/w3c/svgwg/issues/321

Received on Wednesday, 18 September 2019 22:57:54 UTC