Skip to content

Commit 3b6a055

Browse files
committed
[css-sizing-3] Fix the definitions of replaced max-content sizes. w3c#6072
1 parent ba75f3e commit 3b6a055

1 file changed

Lines changed: 63 additions & 60 deletions

File tree

css-sizing-3/Overview.bs

Lines changed: 63 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -868,66 +868,69 @@ Intrinsic Sizes</h3>
868868
and if its containing block was <em>zero</em>-sized in that axis.
869869
(In other words, the minimum size it has when sized as “shrink-to-fit”.)
870870

871-
The <a>max-content size</a> of a box in each axis
872-
is the size it would have if it was
873-
a float given an ''width/auto'' size in that axis
874-
(and no <a lt="min size">minimum</a> or <a>maximum size</a> in that axis),
875-
and if its containing block was <em>infinitely</em>-sized in that axis.
876-
(In other words, the maximum size it has when sized as “shrink-to-fit”.)
877-
878-
The [=min-content size=] and [=max-content size=] are collectively referred to
879-
as the [=intrinsic sizes=].
880-
881-
Note: Note that when the box has a [=preferred aspect ratio=],
882-
size constraints in the opposite dimension will transfer through
883-
and can affect the ''width/auto'' size in the considered one.
884-
See <a href="https://www.w3.org/TR/CSS2/visudet.html">CSS2&sect;10</a>.
885-
886-
If the <a>max-content size</a> would depend
887-
on the size of the containing block
888-
(as it sometimes does for images with a [=natural aspect ratio=] but no [=natural dimensions|natural size=],
889-
see <a href="https://www.w3.org/TR/CSS2/visudet.html#inline-replaced-width">CSS2&sect;10.3.2</a>)
890-
such that it can't be calculated against an infinitely-sized containing block
891-
then:
892-
893-
<dl>
894-
<dt>For boxes with a [=preferred aspect ratio=], but no [=natural dimensions|natural size=]:
895-
<dd>
896-
* If the <a>available space</a> is <a>definite</a>
897-
in the <a>inline axis</a>,
898-
use the <a>stretch fit</a> into that size for the inline size
899-
and calculate the block size using the aspect ratio.
900-
* Otherwise
901-
if the box has a <<length>> as its [=computed value=]
902-
for 'min-width' or 'min-height',
903-
use that size and calculate the other dimension using the aspect ratio;
904-
if both dimensions have a <<length>> minimum,
905-
choose the one that results in the larger overall size.
906-
907-
Note: This case was previous calculated from a 300x150 default size,
908-
rather than the box's min size.
909-
This is believed to be a better behavior,
910-
and likely to be web compatible,
911-
but please send feedback to the CSSWG if there are any problems.
912-
* Otherwise
913-
use an [=inline size=] matching
914-
the corresponding dimension of the [=initial containing block=]
915-
and calculate the other dimension using the aspect ratio.
916-
917-
<dt>For boxes without a [=preferred aspect ratio=]:
918-
<dd>
919-
* If the <a>available space</a> is <a>definite</a>
920-
in the appropriate dimension,
921-
use the <a>stretch fit</a> into that size in that dimension.
922-
* Otherwise,
923-
if the box has a <<length>> as its [=computed value|computed=]
924-
[=minimum size=] ('min-width'/'min-height') in that dimension,
925-
use that size.
926-
* Otherwise,
927-
use ''300px'' for the width
928-
and/or ''150px'' for the height
929-
as needed.
930-
</dl>
871+
The <a>max-content size</a> of a box in each axis
872+
is the size it would have if it was
873+
a float given an ''width/auto'' size in that axis
874+
(and no <a lt="min size">minimum</a> or <a>maximum size</a> in that axis),
875+
and if its containing block was <em>infinitely</em>-sized in that axis.
876+
(In other words, the maximum size it has when sized as “shrink-to-fit”.)
877+
878+
The [=min-content size=] and [=max-content size=] are collectively referred to
879+
as the [=intrinsic sizes=].
880+
881+
Note: Note that when the box has a [=preferred aspect ratio=],
882+
size constraints in the opposite dimension will transfer through
883+
and can affect the ''width/auto'' size in the considered one.
884+
See <a href="https://www.w3.org/TR/CSS2/visudet.html">CSS2&sect;10</a>.
885+
886+
This specification does not define how to determine the sizes of floats.
887+
Please refer to [[CSS2]].
888+
However, the [=max-content size=] of a [=replaced element=] with no [=natural size=]
889+
is defined below:
890+
891+
<dl>
892+
<dt>For [=replaced=] elements with a [=preferred aspect ratio=]:
893+
<dd>
894+
* If the <a>available space</a> is <a>definite</a>
895+
in the <a>inline axis</a>,
896+
use the <a>stretch fit</a> into that size for the inline size
897+
and calculate the block size using the aspect ratio.
898+
<!-- Technically undefined in CSS2, but this was recommended. -->
899+
900+
* Otherwise
901+
if the box has a <<length>> as its [=computed value=]
902+
for 'min-width' or 'min-height',
903+
use that size and calculate the other dimension using the aspect ratio;
904+
if both dimensions have a <<length>> minimum,
905+
choose the one that results in the larger overall size.
906+
907+
Note: This case was previous calculated from a 300x150 default size,
908+
rather than the box's min size.
909+
This is believed to be a better behavior,
910+
and likely to be web compatible,
911+
but please send feedback to the CSSWG if there are any problems.
912+
<!-- Brand new behavior not defined in CSS2 -->
913+
914+
* Otherwise
915+
use an [=inline size=] matching
916+
the corresponding dimension of the [=initial containing block=]
917+
and calculate the other dimension using the aspect ratio.
918+
<!-- More brand-new behavior, to prevent max-content size from going infinite. -->
919+
920+
<dt>For [=replaced elements=] without a [=preferred aspect ratio=]:
921+
<dd>
922+
* If the box has a <<length>> as its [=computed value|computed=]
923+
[=minimum size=] ('min-width'/'min-height') in that dimension,
924+
use that size.
925+
<!-- New behavior made possible by auto initial value;
926+
we think it's good, not 100% sure if Web-compatible. -->
927+
928+
* Otherwise,
929+
use ''300px'' for the width
930+
and/or ''150px'' for the height
931+
as needed.
932+
<!-- Required by CSS2 (due to Web-compat). -->
933+
</dl>
931934

932935
Since a block-level or inline-level replaced element
933936
whose 'height' or 'width' <a>behaves as auto</a>

0 commit comments

Comments
 (0)