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

Tim Horton <timothy_horton@apple.com> skreiv Mon, 13 Feb 2012 20:47:18  
+0100

> 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