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

Re: [css3-images] Rounding issues in degenerate repeating gradients

From: Brad Kemper <brad.kemper@gmail.com>
Date: Thu, 26 May 2011 08:45:24 -0700
Message-Id: <3ED15260-D3BC-42FF-B553-A29864518BDE@gmail.com>
Cc: www-style list <www-style@w3.org>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
On May 25, 2011, at 2:16 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> 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.)

Shouldn't it be identical to what happens to a non-repeating horizontal or vertical gradient in a repeating background when background-size approaches zero? My expectation there that once it rounds to zero, it disappears. An author should not make things that are nearly zero width if he wants people to see them. If he is animating a gradient width, he can animate it down to one or two px instead of zero, if he is concerned about what decimal of one will cause it to suddenly disappear. 
Received on Thursday, 26 May 2011 15:45:59 GMT

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