W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2011

[whatwg] Inconsistency between canvas and CSS color serialization

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 03 Feb 2011 14:17:56 -0500
Message-ID: <4D4AFF64.7080606@mit.edu>
On 2/3/11 1:58 PM, Tab Atkins Jr. wrote:
> The alpha value is just a<number>, so whatever we decide on, we
> should make the standard serialization for<number>  and document it in
> the CSSOM.

I'm not sure it's that simple.

In particular, the way browsers actually _store_ the alpha value is not 
as an infinite-precision decimal (which is what <number> is in CSS).

For example, in the case of Gecko the alpha value is stored as an 
integer in the range [0,255].  When serializing we do a floating-point 
division by 255 and then try to make the result not have 6 useless 
significant figures (in fact I believe we always output either 2 or 3).

This is quite different from other <number> uses....

Received on Thursday, 3 February 2011 11:17:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:30 UTC