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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 12 May 2010 09:22:45 -0400
Message-ID: <4BEAABA5.7000905@mit.edu>
To: Boris Zbarsky <bzbarsky@mit.edu>
CC: Brad Kemper <brad.kemper@gmail.com>, Brian Manthos <brianman@microsoft.com>, "www-style@w3.org" <www-style@w3.org>
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 GMT

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