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

On 02/23/2011 10:59 AM, Tab Atkins Jr. wrote:
>
> Here's an edited proposal, somewhat rearranged for added clarity.
> Now, each step "finishes" an image - as soon as you hit the one that
> you pass the condition for, you can abort with a properly-sized image.
>
> | 1. If the image has a intrinsic width and height, the
> | used width and height are the same.
> |
> | 2. Otherwise, if the image has an intrinsic ratio and
> | either an intrinsic width or an intrinsic height, the
> | used width/height is the same as the provided intrinsic
> | width/height, and the used value of the missing dimension
> | is calculated from the provided dimension and the ratio.
> |
> | 3. Otherwise, if the image has an intrinsic ratio, the used
> | width is 1em and the used height is calculated from this width
> | and the intrinsic ratio.  If this would produce a height larger
> | than 1em, then the used height is instead set to 1em and the
> | used width is calculated from this height and the intrinsic
> | ratio.
> |
> | 4. Otherwise, the image's used width is its intrinsic width
> | if it has one, or else 1em.  The image's used height is its
> | intrinsic height if it has one, or else 1em.

Here's a proposal that reduces the number of edits

Original text:

  # The size of the image is calculated from the following rules:
  #
  # 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.

First, remove rules #3 and #6.

Second, replace rule #4 with

  | 4. If the image has a width but no height or vice versa, the missing
  |    dimension is calculated from the intrinsic ratio (if any).

Third, replace rule #5 with
  | 5. If the image's width or height cannot be resolved from the rules above,
  |    then that dimension is assumed to be 1em.

~fantasai

Received on Monday, 7 March 2011 17:37:16 UTC