CSS4 cross-fade() and images without intrinsic size

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.

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

Received on Monday, 13 February 2012 21:40:29 UTC