W3C home > Mailing lists > Public > www-style@w3.org > May 2011

[css3-images] Rounding issues in degenerate repeating gradients

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 25 May 2011 14:16:50 -0700
Message-ID: <BANLkTiks5xvzPdEJ4dHxRE03KAo+J8S1Zw@mail.gmail.com>
To: www-style list <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:40 GMT