[whatwg] Inconsistency between canvas and CSS color serialization

It looks like CSS rgba colors with an alpha value of 0 are serialized as 
rgba() with "0" as the alpha value. in at least Gecko, Webkit, and Presto.

It also looks like canvas style color with an alpha value of 0 are 
serialized as rgba() with "0.0" as the alpha value in Gecko 3.6, Webkit, 
and Presto.

In Gecko 2.0 we made a change to the canvas code to fix some bugs in the 
serialization by the simple expedient of reusing the well-tested code 
that CSS colors use.  This has the incidental benefit of more behavior 
consistency for authors.  Unfortunately, this makes us not do what these 
other UAs do, nor do what the current spec draft says.

While we can clearly special-case 0 in this code, it seems like an 
authoring pitfall to have the two different serialization styles, so I 
would prefer to have consistent behavior between the two.  What do other 
UA vendors think of standardizing on "0" as the serialization for canvas 
color alpha channels when they're transparent?  Alternately, what about 
using "0.0" for CSS colors?

-Boris

Received on Thursday, 3 February 2011 10:55:21 UTC