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

I am implementing shrink-to-fit for float width computation and had a
question.

Suppose I have an *div* inside a *section*; the *section* is floating
with *width:
auto* while the *div* has a fixed width of *10px*, and no borders or
margins specified. Naturally, the *section* ought to shrink to *10px* wide.

However, a malicious reading of the spec seems to allow the *section* to
have any width, say 0 pixels. For suppose the *section* is 0 pixels wide.
Then by the rules for block-level, non-replaced elements, the *margin-right*
of the *div* is ignored, so that the used value is *-10px*. But then the
preferred width, and thus the shrink-to-fit width, of the *div* is *0*.

How does the specification prevent this reading? Are margins always assumed
not to overflow during rendering?

—Pavel Panchekha

Received on Monday, 7 March 2016 12:49:24 UTC