W3C home > Mailing lists > Public > www-style@w3.org > August 2011

Re: [css3-background] 'background-size: auto auto' and images with intrinsic size in one dimension

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 8 Aug 2011 11:14:34 -0700
Message-ID: <CAAWBYDB94-gLgD93NJndriTRCA8o1Wyo8kKNtNuFLxGHT_mYvw@mail.gmail.com>
To: Brian Manthos <brianman@microsoft.com>
Cc: "L. David Baron" <dbaron@dbaron.org>, "www-style@w3.org" <www-style@w3.org>
On Mon, Aug 8, 2011 at 10:53 AM, Brian Manthos <brianman@microsoft.com> wrote:
> Tab:
>> Brian Manthos:
>>> L. David Baron:
>>>> when 'background-size' is 'auto auto' and the background image has
>>>> only one of an intrinsic width or height, and does not have an
>>>> intrinsic ratio.
>>> Example?
>>Are you asking for an example of an image like that?
>><svg width=100>
>> ...
> My retention for the intricacies of SVG sizing is weak, so I usually bug Aaron to double-check myself.
> But my loose recollection is that this applies...
> http://www.w3.org/TR/SVG/struct.html#SVGElementWidthAttribute
> # height = "<length>"
> # If the attribute is not specified, the effect is as if a value of '100%' were specified.
> And thus the image size is mapped to {100px, <height-of-the-background-positioning-area>} well-before background-size gets evaluated.

Those attributes set the width and height of the <svg> element itself,
not the overall image.  When CSS asks for the image's intrinsic
dimensions, they're reported based on those attributes.  Since there's
no such thing as percentage intrinsic dimensions, and you can't
calculate a ratio from a length and an (unresolved) percentage, the
only thing that gets reported back is an intrinsic width.  After CSS
has massaged this into a concrete object size, that's reported back to
the SVG, and sets the SVG's viewport size.

*Then* the height=100% is resolved against the viewport to set the
size of the <svg> element within the image.

Received on Monday, 8 August 2011 18:15:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:48 UTC