Skip to content

Commit

Permalink
[css-sizing-4] Add property to switch among behaviors for zeroing out…
Browse files Browse the repository at this point in the history
… min-content contributions. w3c#4585
  • Loading branch information
fantasai committed Nov 11, 2020
1 parent b46817d commit 1b816b3
Showing 1 changed file with 64 additions and 1 deletion.
65 changes: 64 additions & 1 deletion css-sizing-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ Min/Max Size Transfers</h3>
<h2 id='intrinsic'>
Intrinsic Size Determination</h2>

<h3 id="intrinsic-contribution">
<h3 id="intrinsic-sizes">
Intrinsic Sizes</h3>

ISSUE: [[css-sizing-3#intrinsic-sizes]]
Expand Down Expand Up @@ -628,6 +628,69 @@ Intrinsic Size Contributions</h3>

ISSUE: [[css-sizing-3#intrinsic-contribution]]

<h3 id='intrinsic-contribution-override'>
Zeroing Min-Content Size Contributions: the 'min-intrinsic-sizing' property</h3>

<pre class="propdef">
Name: min-intrinsic-sizing
Value: legacy | zero-if-scroll || zero-if-extrinsic
Initial: legacy
Inherited: no
Applies to: all elements except [=inline boxes=]
Computed value: as specified
Percentages: n/a
Animation type: discrete
</pre>

ISSUE: This property seriously needs some name bikeshedding.

This property defines whether the [=min-content contribution=]
of a [=non-replaced=] box
is “compressed” under certain circumstances.
Values have the following meanings:

<dl dfn-for=min-intrinsic-size dfn-type=value>
<dt><dfn>legacy</dfn>
<dd>
The box’s [=min-content contribution=]
is handled as normal.

<dt><dfn>zero-if-scroll</dfn>
<dd>
The box’s [=min-content contribution=]
is “compressed” if it is a [=scroll container=].

<dt><dfn>zero-if-extrinsic</dfn>
<dd>
The box’s [=min-content contribution=]
is “compressed” if has an [=extrinsic size|extrinsic=]
[=preferred size|preferred=] or [=maximum size|maximum=] size.

Note: This is the default behavior of most [=replaced elements=].
</dl>

<div class="example">
The following rule will make all [=scroll containers=]
essentially ignore their contents
when passing up their size contributions
(unless they specifically requested a content-based size):

<pre highlight=css>*, ::before, ::after { min-intrinsic-size: zero-if-scroll; }</pre>

This prevents the [=scroll container=] from blowing up the size of its ancestors
if it contains large items such as a table or long lines of unbreakable text.
Meanwhile, it allows boxes that are not scroll containers
to continue influencing the [=min-content size=] of their ancestors.
</div>

Note: The behavior of ''zero-if-scroll'' would have been a better default,
but due to Web-compat, it cannot be the initial value. :(

The “compressed” [=min-content contributions=] is calculated
by pretending the box were empty,
except when factoring in sizing constraints imposed by explicit
''width/min-content'', ''width/max-content'', and ''width/fit-content'' values
of the [=sizing properties=].

<!--
████████ ██ ██ ████████ ████████ ████ ██ ██ ██████ ████ ██████
Expand Down

0 comments on commit 1b816b3

Please sign in to comment.