[css3-images] Rounding issues in degenerate repeating gradients

Repeating gradients repeat their color-stop list infinitely, shifting
each set forward and backward by multiples of the "width" of the list
(the distance between the first and last color-stop).

This has an obvious degenerate case when the width is 0.  I have a
definition for what to do in this case (just render a solid-color
image with the color of the last color-stop), but there's still a
problem here - the definition of "when the width is 0" is ambiguous
due to rounding issues.  As a general spec design goal, we try to
avoid sharp behavior switches that are sensitive to rounding like
this.  In other words, we try to make the behavior continuous, in a
mathematical sense, such that the behavior at any point is equivalent
to the behavior you converge on as you approach that point.

Implementors, is this worth fixing?  If so, I'm leaning towards
enforcing a minimum width of 1px, so that if the width would be less
than that, the last color-stop is moved so that it's 1px farther than
the first color-stop.  This still resolves the singularity (by
avoiding it entirely), and preserves behavior-continuity across all
values.

(Non-repeating gradients don't suffer from the same problem, despite
having a similar rule about what to do when multiple stops are at the
"same location", because the specified behavior is the same as the
limit behavior as the distance approaches 0; it's behavior-continuous
already.)

~TJ

Received on Wednesday, 25 May 2011 21:17:37 UTC