Re: [css-box] shrink-to-fit and floats

Thank you, Tab.

> ​To make sure we're on the same page, here's the markup:

Yes, we agree on the markup, and the window size can be 500px.

I understand the preferred width, available width, minimum preferred width
formula used to compute shrink-to-fit width; I am only confused about how
we compute the width of the div, for the purposes of determining the
preferred
width of the section.

> ​If the div had "margin-right: -10px", all the above still applies, but
> the calculation of the minimum width that doesn't trigger overflow
> changes.  Overflow happens when the *margin box* of an element is
> wider than its container, and in this case the margin box is 0px wide
> - 10px from width, minus 10px from margin-right.

​Am I taking you correctly, then, that margins are treated differently
when determining shrink-to-fit and ordinary width, namely that ​right
margins are not ignored for computing shrink-to-fit width yet are
ignored for computing ordinary width (in situations where that's
applicable)?

​Every other part of the layout for this example you and I agree on.​

​I suppose I can reduce my confusion now to this question:
when is the margin-right ignored, and when is it not?

It sounds like margin-right is ignored during the layout of block-level,
non-replaced elements in flow, when computing their actual layout,
but it is not ignored when computing their width for the purposes of
determining the preferred [minimum] width of a container.

> Sizing spec does correct this lack and define things more precisely.

That's a useful draft to be aware of, thank you. I think the relevant
sentence of that specification would be this one, in §4.3:

> Otherwise, if the computed inline-size of the block is fit-content, auto,
> or fill, its min-content inline-size contribution is its min-content
> inline size plus any inline-axis margin, border, and padding.

Is this referring to the inline-axis (that is, the left & right) *used*
values
for margin, border, and padding or the *computed* values?

The used values are the ones computed by ignoring the specified
margin-right, while the computed values would be the expected ones.
It may be best to amend that draft to make the choice here clearer.

—Pavel Panchekha

Received on Tuesday, 15 March 2016 14:14:17 UTC