Re: Expected behavior for stroke-dasharray="0"

Thanks for the clarification, Robert, regarding why the Firefox
implementation is the way it is.

I agree, on second reading, that it is an unfortunately ambiguous bit of
prose, which should be cleared up in SVG 2.

(If I was to be argumentative, I would say that "the stroke is rendered as
if" pushes it towards the no-dashing interpretation instead of the
no-stroke interpretation, since in that case no stroke is rendered at all
-- but that is getting into finer dissections of English grammar than any
technical spec should rely on!)

Regardless, the new stroke implementation notes in SVG 2, while not short
and sweet like the prose, do make it quite clear that if stroke-dasharray
is 0 the behavior is the same as stroke-dasharray: none, with the result
being a single "dash" that extends the entire length of the path:

The dash positions for a given subpath of the equivalent path
<https://svgwg.org/svg2-draft/paths.html#TermEquivalentPath> of a ‘path
<https://svgwg.org/svg2-draft/paths.html#PathElement>’ or basic shape
<https://svgwg.org/svg2-draft/shapes.html#TermBasicShapeElement> is a
sequence of pairs of values, which represent the starting and ending
distance along the subpath for each of the dashes that form the subpath's
stroke. It is determined as follows:


   1. Let pathlength be the length of the subpath.
      2. Let dashes be the list of values of ‘stroke-dasharray
      <https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty>’
      on the element, converted to user units, repeated if necessary so that it
      has an even number of elements; if the property has the value none,
      then the list has a single value 0.
      3. Let count be the number of values in dashes.
      4. Let sum be the sum of the values in dashes.
      5. If sum = 0, then return a sequence with the single pair <0,
      pathlength>.

http://www.w3.org/TR/2014/WD-SVG2-20140211/painting.html#StrokeShape
(permalink to last published draft)
https://svgwg.org/svg2-draft/painting.html#StrokeShape (current editor's
draft)

That leaves two questions for Robert and the rest of the Firefox team:

   - Do you have any fundamental objection to these new implementation
   instructions?
   - If we agreed here that this is the intended effect, would you be able
   to push the changes to Firefox sooner rather than later?

For the prose, I would suggest the following text:


   - If any value in the list is negative, the <dasharray>
   <http://www.w3.org/TR/2014/WD-SVG2-20140211/painting.html#DataTypeDasharray>
value
   is invalid
   <http://www.w3.org/TR/2014/WD-SVG2-20140211/intro.html#TermInvalidValue>.
   If all of the values in the list are zero, then the stroke is rendered as a
   solid line without any dashing.


This is an error-like edge case, but it would be nice to sort it out and
get consistent behavior.  I'm sure there are some animation sequences which
would be easier if you could count on a clear behavior for the zero
condition.

Received on Thursday, 2 April 2015 14:53:11 UTC