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

[whatwg] Inconsistency between canvas and CSS color serialization

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 3 Feb 2011 10:58:30 -0800
Message-ID: <AANLkTi=2VM1N88XNCXtPbCJY6eKpJoSfW47u=sMZV5Xj@mail.gmail.com>
On Thu, Feb 3, 2011 at 10:55 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> 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?

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.  (Right now CSSOM just has a note that browsers seem to use
toString to serialize <number>s.)

I have no preference either way.

Received on Thursday, 3 February 2011 10:58:30 UTC

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