Re: [css3-background] background-size and zero length

On 5/12/10 9:15 AM, Boris Zbarsky wrote:
> 1) Specified value (a pair of float and unit).
> 2) Computed value (an integer in units of 1/60 CSS px).
> 3) Used value for layout computations (an integer in units of 1/60 CSS
> px).
> 4) Used value for painting (this depends on the device).
>
> 1-3 above are device-independent.
>
> It looks to me, at a brief glance, that things less than 1/2 a device
> pixel round to 0 at step 4.

I lied, because my testcase was wrong.  Will attach a correct testcase 
that shows that Gecko will in fact try to do something sane with < 1/2 
pixel widths even at paint time.  I tried this testcase in 
Opera/Safari/Chrome and they all show red (as expected in the Webkit 
case based on code inspection).

Note that there have been multiple blog posts on this topic of subpixel 
lengths by dbaron and roc; it might be worth reading them rather than me 
recapitulating them.

Testcase:

<!DOCTYPE html>
<html>
   <head>
     <style>
       div > div {
         width: 0.2px; height: 10px; background: green; display: 
inline-block;
       }
     </style>
   </head>
<body>
   There should be no red.
   <div style="width: 3px; height:10px; background: red; line-height: 0">
 
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
   </div>
</body>
</html>

Received on Wednesday, 12 May 2010 13:23:21 UTC