You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-grid] Automatic minimum size clamping by grid area should transfer through aspect ratio #767
However, if the grid item spans only grid tracks that have a fixed max track sizing function, its automatic minimum size in that dimension is further clamped to less than or equal to the size necessary to fit its margin box within the resulting grid area (flooring at zero).
I think that if the transferred size (this dimension's size transferred through the aspect ratio to the other dimension) is controlling the size in the other dimension, then that transferred size should also get clamped accordingly.
Possible edits for this would be
However, if the grid item spans only grid tracks that have a fixed max track sizing function, its automatic minimum size in that dimension is further limited by treating the item’s fill-available fit into the sum of those track sizes as an additional maximum limit (floored at zero) for clamping the “specified size” and “content size” in that dimension and accordingly the “transferred size”, if any, in the other dimension, so as to prevent the automatic minimum from forcing overflow of its fixed-size grid area.
Yes, I think this is a good idea for "transferred size". Firefox currently doesn't do this -- we only clamp the intrinsic size, but that can lead to non-intuitive results since it may overflow the clamped axis when stretching an image with preserved ratio.
I don't think clamping should shrink an item below its specified width/height in the same axis though (as you seem to suggest, but maybe I misunderstood?).
I wonder if it would be better to define the grid area clamping in terms of max-width/height instead?
It's currently a bit undefined how clamping interacts with min/max-width/height (and over-constrained situations), even with your suggested additions above.
Something like "clamping acts as an extra max-size on the item in the relevant axis, that is, the used max-width/height is the minimum of the grid area size and the computed value of the relevant max-width/height, if any".
That makes it much better defined, since we re-use all spec text for max-width/height. It's immediately clear that a specified larger width/height trumps the clamping, for example.
(Warning: I haven't really investigated this idea in depth.)
Actually, I was mostly thinking about a transferred size that comes from stretching an item with a preserved ratio when I wrote the above. I'm less sure it's a good idea when the transferred size comes from an actual specified size in the other axis. We might want to treat those differently...
Keep in mind that we're clamping a minimum size! Not the actual size. :) Defining it in terms of max-width/height wouldn't make any sense. (And the interaction with max-width/height isn't underdefined: max-width/height reduces the automatic minimum if necessary, that's clearly specified in the definition.)
The specified size is a maximum on that minimum -- it's there so that if the specified size is less than the intrinsic size, then we use the specified size as the minimum instead. A specified size doesn't increase the automatic minimum: we take the most conservative minimum as the automatic minimum, so it's min(specified size, content size) if there's a specified size and min(transferred size, content size) if there isn't but there's an aspect ratio, and simply content size if neither specified size nor transferred size exist.
However, if the <a>grid item</a> spans only <a>grid tracks</a>
that have a <a lt="fixed sizing function">fixed</a> <a>max track sizing function</a>,
- its <a>automatic minimum size</a> in that dimension- is further clamped to less than or equal to the size necessary+ the “specified size” and “content size” in that dimension+ (and the input to the "transferred size" in the other dimension)+ are further clamped to less than or equal to the size necessary
to fit its margin box within the resulting <a>grid area</a> (flooring at zero)
+ so as to prevent the automatic minimum from forcing overflow of its fixed-size grid area
Activity
MatsPalmgren commentedon Nov 26, 2016
Yes, I think this is a good idea for "transferred size". Firefox currently doesn't do this -- we only clamp the intrinsic size, but that can lead to non-intuitive results since it may overflow the clamped axis when stretching an image with preserved ratio.
I don't think clamping should shrink an item below its specified
width/heightin the same axis though (as you seem to suggest, but maybe I misunderstood?).I wonder if it would be better to define the grid area clamping in terms of
max-width/heightinstead?It's currently a bit undefined how clamping interacts with
min/max-width/height(and over-constrained situations), even with your suggested additions above.Something like "clamping acts as an extra max-size on the item in the relevant axis, that is, the used
max-width/heightis the minimum of the grid area size and the computed value of the relevantmax-width/height, if any".That makes it much better defined, since we re-use all spec text for
max-width/height. It's immediately clear that a specified largerwidth/heighttrumps the clamping, for example.(Warning: I haven't really investigated this idea in depth.)
MatsPalmgren commentedon Nov 27, 2016
Actually, I was mostly thinking about a transferred size that comes from stretching an item with a preserved ratio when I wrote the above. I'm less sure it's a good idea when the transferred size comes from an actual specified size in the other axis. We might want to treat those differently...
fantasai commentedon Nov 27, 2016
Keep in mind that we're clamping a minimum size! Not the actual size. :) Defining it in terms of
max-width/heightwouldn't make any sense. (And the interaction withmax-width/heightisn't underdefined:max-width/heightreduces the automatic minimum if necessary, that's clearly specified in the definition.)The specified size is a maximum on that minimum -- it's there so that if the specified size is less than the intrinsic size, then we use the specified size as the minimum instead. A specified size doesn't increase the automatic minimum: we take the most conservative minimum as the automatic minimum, so it's min(specified size, content size) if there's a specified size and min(transferred size, content size) if there isn't but there's an aspect ratio, and simply content size if neither specified size nor transferred size exist.
tabatkins commentedon Dec 19, 2016
All right, fix checked in
fantasai commentedon Dec 19, 2016
Agenda+ to get wg resolution
tabatkins commentedon Dec 21, 2016
WG resolved to take this edit.