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

[css4-images] Re: CSS4 cross-fade() and images without intrinsic size

From: Leif Arne Storset <lstorset@opera.com>
Date: Tue, 14 Feb 2012 10:20:37 +0100
To: www-style@w3.org, "Tim Horton" <timothy_horton@apple.com>
Message-ID: <op.v9nv8ny9tmo5g6@localhost.localdomain>
Tim Horton <timothy_horton@apple.com> skreiv Mon, 13 Feb 2012 20:47:18  

> Hi, all!
> I've been implementing now-CSS4 cross-fade() in WebKit, and have come  
> across a point I'd like clarified (though I realize the spec isn't  
> remotely in a finished form).
> Here's what the spec currently says about the size of the generated  
> image:
>> More precisely, given ''cross-fade(A,B,p)'', where A and B are images  
>> and
>> p is a percentage between 0% and 100%, the function represents an image
>> with width equal to widthA × (1-p) + widthB × p and height equal to
>> heightA × (1-p) + heightB × p.
> This is all fine (and works great!) for images which have an intrinsic  
> size. However, I'm unsure of what to do in the case where one or both of  
> the source images don't have an intrinsic size - for example, a  
> cross-fade between a linear-gradient() and an image, or between two  
> gradients.
> There are two options that I can see here:
> 1) Use the size of the container for the size of non-fixed-size images.
> 2) Use the size of any fixed-size images for the size of non-fixed-size  
> images.

My hunch is that the spec will refer to the concrete object size of the  
images instead of just "width" and "height". In that case every image will  
have a concrete size, even those without intrinsic dimensions.

This is similar to your option 1, but with the "default object size"  
instead of "the size of the container", although the precise algorithm is  
defined in chapter 5 of css3-images.

> In both cases, the sizes would then be interpolated as in a simple  
> cross-fade.
> Option 1 seems the most appropriate, as option 2 breaks down when  
> cross-fading two images both without intrinsic size. Still, it seemed  
> best to solicit advice in case there's another option that I missed.
> Any comments?
> --Tim

Leif Arne Storset
Core Technology Developer, Opera Software
Oslo, Norway
Received on Tuesday, 14 February 2012 09:21:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:12 UTC