Re: [CSS2.1] list-style-image sizing rules don't match reality

On Mon, Feb 14, 2011 at 10:08 AM, Sylvain Galineau
<sylvaing@microsoft.com> wrote:
> [Tab Atkins:]
>> Opera fills in the missing dimension as 1em, not 50px.  Chrome fills in
>> the missing dimension as, I dunno, .5em?  Something like that, probably
>> related to the width of the default bullet.  It's not exactly right, but
>> it clearly has the same behavior as Opera.
>>
>> I can't seem to get Firefox or IE8 to render an SVG list-style-image.
>> IE9, unfortunately, implements the spec here.  Luckily, this is a tiny
>> edge-case that I suspect is extremely rare.  In all the normal cases
>> (images with all intrinsic dimensions, images with no dimensions, images
>> with just a ratio), everyone does things right.
>>
>> I suggest changing the spec here to match the webkit/opera behavior, so
>> that list-style-image is consistent with every other use of images in CSS.
>> My suggested change is to replace line #3 in the algorithm with "If the
>> image has no intrinsic ratio, intrinsic width, or intrinsic height, then
>> its intrinsic ratio is assumed to be 1:1."
>
> I'm not sure I follow. You suggest adopting the Opera/WebKit behavior yet
> your description implies the intrinsic ration they produce is not 1:1.
>
> Also, the suggested replacement is a bit confusing: I understand "If the
> image has not intrinsic width or intrinsic height, then assume 1:1". Adding
> intrinsic ratio in there, however, implies 'If the image has not intrinsic
> ratio, assume 1:1' but what do you compute this 1:1 ratio for in this case ?

The point of my change was merely to remove the special case of an
image having one intrinsic dimension and no intrinsic ratio. The
intrinsic ratio is used later, in step 6.

Though, that then changes step 3 to merely being a setup for the
no-dimensions-at-all case, which we can probably solve in a clearer
manner by rewriting slightly.  (For that matter, step 2 in the current
algorithm refers to percentage intrinsic widths and heights, which
don't exist per our resolution a little while ago.)

In Lists, I'll just define the right terms and refer to Image Values,
but for 2.1, let's replace those 6 steps with these changes:

| 1. If the image has an intrinsic width or height,
| then that intrinsic width/height becomes the image's
| used width/height.
|
| 2. If the image has an intrinsic ratio, and either an
| intrinsic width or an intrinsic height, calculate the
| missing dimension from the provided dimension and the
| ratio.
|
| 3. If the image has no intrinsic ratio and no intrinsic
| width, the used width is 1em.
|
| 4. If the image has no intrinsic ratio and no intrinsic
| height, the used height is 1em.

Again, for reference, the original steps were:

# 1. If the image has an intrinsic width or height, then
# that intrinsic width/height becomes the image's used
# width/height.
#
# 2. If the image's intrinsic width or height is given as
# a percentage, then that percentage is resolved against 1em.
#
# 3. If the image has no intrinsic ratio and a ratio cannot
# be calculated from its width and height, then its intrinsic
# ratio is assumed to be 1:1.
#
# 4. If the image has a width but no height, its height is
# calculated from the intrinsic ratio.
#
# 5. If the image's height cannot be resolved from the rules
# above, then the image's height is assumed to be 1em.
#
# 6. If the image has no intrinsic width, then its width is
# calculated from the resolved height and the intrinsic ratio.

The normative changes in my suggestion are (1) removing the obsolete
reference to percentage intrinsic widths, and (2) removing the
behavior this thread is about, that images with one intrinsic
dimension and no intrinsic ratio assume a ratio of 1:1 (instead, they
just fill in the second dimension with 1em).  All other changes are
editorial.

No tests need to be updated for this change, because this area wasn't
adequately tested to begin with.  (If it was, we'd have noticed that
the rules were broken.)

~TJ

Received on Monday, 14 February 2011 19:01:13 UTC