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

On May 26, 2011, at 9:36 AM, Tab Atkins Jr. wrote:

> On Thu, May 26, 2011 at 8:45 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>> 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.
> 
> It could be, sure; the case is roughly equivalent.  Given our goal of
> avoiding non-continuous behavior, I'd say that the background-size
> behavior is a bug.  I don't like dismissing problems with "authors
> shouldn't do that" when we can just fix it easily so that it doesn't
> ever occur.
> 
> We should align these two, though, whether that's by making
> background-size match repeating gradients, or making repeating
> gradients match background-size.

I haven't actually tested to see if that is what backgrounds do, I am just guessing it based on the principal of least surprise. I would expect implementations to clamp away any "divide by zero" issues, rather than defining some sort of magic behavior for what happens at near-zero. I think we have other properties where zero is an invalid value, don't we? Does that really cause problems, or is this just a theoretical purity issue?

I think that if I had a gradient going from black to white that was one device pixel wide, the UA would probably draw it as gray. It seems reasonable that if it took place over 0.5px, that it might be a gray that was half as dark or half as opaque. As the width got smaller, the grey could get lighter until it disappeared. Just another possible way to deal with this in a smooth way, if that is what you are after.

Received on Thursday, 26 May 2011 17:17:31 UTC