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

On Tue, Feb 14, 2012 at 1:20 AM, Leif Arne Storset <lstorset@opera.com> wrote:
> 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.

Leif has it right.  Resolve the size of the images using the sizing
algorithm, *then* do the cross-fading based on that.

Note that neither of your suggested approaches would have worked,
given that any of width, height, or ratio can be missing when using
SVG images.

~TJ

Received on Tuesday, 14 February 2012 21:29:02 UTC