Re: [css-sizing] Intrinsic Sizes of Replaced Elements ignores 'width' and 'height'?

On Thursday 2014-11-13 14:58 +0000, Simon Sapin wrote:
> The "Intrinsic Sizes of Replaced Elements" section of the ED
> currently reads:
> 
> http://dev.w3.org/csswg/css-sizing/#replaced-intrinsic
> >For replaced elements, the min-content size and max-content size are
> >equivalent and correspond to the appropriate dimension of the
> >concrete object size returned by the default sizing algorithm
> >[CSS3-IMAGES] of the element, calculated with an unconstrained
> >specified size.
> 
> css-images-3 defines "specified size" as given (for replaced
> elements) by the 'width' and 'height' properties.
> 
> So css-sizing says to ignore these properties for the intrinsic size
> of an image? That sounds wrong.

I think that's right in general:  we want the concept of intrinsic
size not to be affected by height, width, etc., properties, so that
we can have values of those properties that specify the intrinsic
size.

There's still a concept that css-sizing calls the min/max-content
size contribution that should be affected by these.

> I was looking for what should happen to images with the percentage
> specified width. A possible solution would be to do like for blocks:
> resolve the percentage if it is definite, or ignore it otherwise.
> 
> However, browsers seem to interoperably do something more
> complicated, at least when tables are involved, and I don’t know
> what the algorithm is here.
> 
> Compare the document below with and without the style="width: 50%".
> (The behavior without is explained by tables always getting at least
> their min-content size, even when the specified size is smaller, per
> "shrink-to-fit".)
> 
> <table style="width: 200px">
> <td style="border: solid">
> <img style="width: 50%"
>      src="data:image/svg+xml,<svg width='1000'
>           xmlns='http://www.w3.org/2000/svg'/>">

In Gecko, the image has an intrinsic width of 1000px.  What differs
with and without the width:50px is its intrinsic width contribution
to its parent:  the presence of width: 50% makes that 0 for
min-width only, since the min-content contribution for any element
with a percentage width is 0.

-David

-- 
π„ž   L. David Baron                         http://dbaron.org/   𝄂
𝄒   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Thursday, 13 November 2014 19:33:17 UTC