Re: Serializing gradient function

On Wed, 12 Jan 2011 18:04:38 +0100, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:
> 2011/1/11 Rafal Chlodnicki <rchlodnicki@opera.com>:
>> Given the linear-gradient(black, white) value for background property,
>> should serialized value include implicit "top" gradient-line?
>>
>> Quote from http://dev.w3.org/csswg/cssom/#css-values:
>>
>> "Where CSS component values of the value can be omitted without  
>> changing the
>> meaning of the value (e.g. initial values in shorthand properties), omit
>> them. If this would remove all the values, then include the first  
>> allowed
>> value.
>>
>> That could apply here but not necessary as it's unclear if it applies to
>> arguments of css functions too.
>>
>> Currently, internal implementation in Opera does not return it. I can  
>> see
>> that webkit's does (and Gecko's is not quite up to date so not sure if  
>> it's
>> relevant).
>
> The spec has explicit instructions for how to serialize gradient
> functions <http://dev.w3.org/csswg/css3-images/#serializing-gradients>.
>
> Or rather, it *would*, if I hadn't mucked up something when I
> committed last night.  Looks like I've uncovered a bug in the spec
> formatter.  For now, check out
> <http://dev.w3.org/csswg/css3-images/Overview.src.html> and look near
> the bottom for the gradient serialization algorithm.
>
> Short answer: the spec currently requires that gradient to be
> serialized as "linear-gradient(top, black, white)".

Thank you, missed the obvious place.

While we are at it...

Given examples:
  linear-gradient(top left, black, white)
  linear-gradient(left top, black, white)

if following citation from CSSOM spec again:

   "Where multiple CSS component values can appear in any order without  
changing the meaning of the value (typically represented by a double bar  
|| in the value syntax), use the order as given in the syntax."

both of these examples should have "linear-gradient(top left, black,  
white)" computed value as gradient syntax specifies them in that order:

   [ [top | bottom] || [left | right] ]

-- 
Rafał Chłodnicki
Core QA, Opera Software ASA

Received on Wednesday, 12 January 2011 17:38:57 UTC