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

Re: [cssom] serializing <color>

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 16 Feb 2010 12:05:07 -0500
Message-ID: <4B7AD043.1010001@mit.edu>
To: Anne van Kesteren <annevk@opera.com>
CC: CSS WG <www-style@w3.org>
On 2/16/10 11:50 AM, Anne van Kesteren wrote:

 > E.g. reading out color values and changing them to create a different 
 > kind of contrast.

So this would want to read out used values, right?

 > Though this might be used for debugging as well

Not sure what you mean.

 > Color manipulation is also used for animations, though in most
 > scenarios you would not start from some unknown start value.

Indeed, nor generally from a system color.

> I see. I don't really see how the CSSOM works well for editing except
> simple things, and those things would not be hindered much by
> normalizing <color> values.

Sure they would; it would competely break any use of system colors...

You may want to ask Daniel Glazman for details on how the CSSOM works 
for editing, since he's actually written editors using it.

> Editors can always provide an option to see
> the various ways you can express that <color>. The same goes for
> debuggers I think.

Sure; I'm just asking for use cases other than those, since you say that 
those aren't use cases of the API we're creating.

> Also, it might be worth noting that Gecko does not preserve e.g. #rrggbb
> notation at the moment (have not checked hsl() and hsla()).

Gecko's current behavior (ignoring quirks mode) is the following:

1)  #rgb, #rrggbb, rgb(), rgba(), hsl(), hsla() are converted at
     parse-time into an rgba quadruplet.  So as far as Gecko is
     concerned all of those look the same as specified colors.
2)  Named colors and system colors are stored as identifier strings
     at parse time and converted to rgba quadruplets when determining
     the computed value of the property.

Note that while the conversions from hsl/hsla/rdb/rgba/#whatever to rgba 
quadruplets are compile-time invariants in Gecko, as are the conversions 
from CSS named colors to rgba quadruplets, the conversions from system 
colors to rgba quadruplets depend on the runtime environment and can 
vary from window to window and from frame to frame in the same window. 
So converting those to rgba in fact loses information, in general. 
Debuggers and editors are certainly cases where such dataloss is not 
acceptable.  I'm trying to understand what other use cases we're 
envisioning here and whether such dataloss is acceptable for them.

-Boris
Received on Tuesday, 16 February 2010 17:05:44 GMT

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