Skip to content

Commit 69acb59

Browse files
vmpstrtabatkins
andauthored
[css-sizing-4] Add contain-intrinsic-size: auto none syntax (#8989)
Co-authored-by: Tab Atkins Jr. <jackalmage@gmail.com>
1 parent 7649a8d commit 69acb59

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

css-sizing-4/Overview.bs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Preferred Aspect Ratios: the 'aspect-ratio' property</h3>
213213

214214
<dt><dfn>auto && <<ratio>></dfn>
215215
<dd>
216-
If both ''auto'' and a <<ratio>> are specified together,
216+
If both ''aspect-ratio/auto'' and a <<ratio>> are specified together,
217217
the [=preferred aspect ratio=] is the specified ratio
218218
of ''<var>width</var> / <var>height</var>''
219219
unless it is a [=replaced element=] with a [=natural aspect ratio=],
@@ -520,7 +520,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
520520

521521
<pre class=propdef>
522522
Name: contain-intrinsic-width, contain-intrinsic-height, contain-intrinsic-block-size, contain-intrinsic-inline-size
523-
Value: none | <<length>> | auto <<length>>
523+
Value: auto? [ none | <<length>> ]
524524
Initial: none
525525
Inherited: no
526526
Logical property group: contain-intrinsic-size
@@ -543,32 +543,26 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
543543
would still size according to the specified grid,
544544
usually ending up with a larger content size than specified.
545545

546-
Values are defined as:
547-
548546
<dl dfn-type=value dfn-for="contain-intrinsic-width, contain-intrinsic-height, contain-intrinsic-block-size, contain-intrinsic-inline-size, contain-intrinsic-size">
549-
: <dfn>none</dfn>
550-
:: The corresponding axis does not have an [=explicit intrinsic inner size=].
551-
552-
: <dfn><<length>></dfn>
553-
:: The corresponding axis has an [=explicit intrinsic inner size=] of the specified <<length>>.
554-
555-
<wpt pathprefix="css/css-contain/">
556-
content-visibility/content-visibility-058.html
557-
</wpt>
558-
559-
: <dfn>auto <<length>></dfn>
560-
:: If the element has a [=last remembered size=]
547+
: <dfn>auto</dfn>? [ <dfn>none</dfn> | <<length>> ]
548+
:: If ''contain-intrinsic-size/auto'' is specified
549+
and the element has a [=last remembered size=]
561550
and is currently [=skipping its contents=],
562-
its [=explicit intrinsic inner size=]
563-
is the [=last remembered size=].
564-
551+
its [=explicit intrinsic inner size=] in the corresponding axis
552+
is the [=last remembered size=] in that axis.
553+
565554
Note: This occurs, for example,
566555
when an element with ''content-visibility: auto''
567556
is off-screen.
568557

569558
Otherwise,
570-
its [=explicit intrinsic inner size=]
571-
is the specified <<length>>.
559+
the corresponding axis either doesn't have an [=explicit intrinsic inner size=]
560+
(if ''contain-intrinsic-size/none'' is specified)
561+
or has an [=explicit intrinsic inner size=] of the specified <<length>>.
562+
563+
<wpt pathprefix="css/css-contain/">
564+
content-visibility/content-visibility-058.html
565+
</wpt>
572566
</dl>
573567

574568
If an element has an [=explicit intrinsic inner size=] in an axis,
@@ -596,7 +590,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
596590

597591
<pre class="propdef shorthand">
598592
Name: contain-intrinsic-size
599-
Value: [ none | <<length>> | auto <<length>> ]{1,2}
593+
Value: [ auto? [ none | <<length>> ] ]{1,2}
600594
</pre>
601595

602596
'contain-intrinsic-size' is a shorthand property
@@ -619,7 +613,7 @@ Last Remembered Size</h4>
619613
even slightly,
620614
it can cause unsightly scrollbars or accidentally-hidden content.
621615

622-
The ''contain-intrinsic-size: auto'' value allows a middle-ground:
616+
The ''contain-intrinsic-size/auto'' keyword of ''contain-intrinsic-size'' allows a middle-ground:
623617
if an element is ever <em>not</em> [=size containment|size-contained=],
624618
this value causes the element to remember its size
625619
(calculated as normal by layout);
@@ -634,20 +628,20 @@ Last Remembered Size</h4>
634628
The [=last remembered size=] of an element is determined by:
635629

636630
* At the time that {{ResizeObserver}} events are determined and delivered,
637-
if an element has ''contain-intrinsic-size: auto'',
631+
if an element has a ''contain-intrinsic-size/auto'' keyword in ''contain-intrinsic-size'' property,
638632
is capable of being a {{ResizeObserver}} target,
639633
but does not have [=size containment=],
640634
record the current inner dimensions of its [=principal box=]
641635
as its [=last remembered size=].
642636

643637
* At the time that {{ResizeObserver}} events are determined and delivered,
644638
if an element has a [=last remembered size=]
645-
but does <em>not</em> have ''contain-intrinsic-size: auto'',
639+
but does <em>not</em> have ''contain-intrinsic-size/auto'' keyword in ''contain-intrinsic-size'' property,
646640
remove its [=last remembered size=].
647641

648642
Note: The [=last remembered size=] is state attached to the <em>element</em>,
649643
not any particular box generated by the element.
650-
So long as the element retains ''contain-intrinsic-size: auto'',
644+
So long as the element retains ''contain-intrinsic-size/auto'' keywrod in ''contain-intrinsic-size'' property,
651645
it will remember its [=last remembered size=]
652646
even across changes such as going to/from ''display: none''.
653647
</div>
@@ -995,6 +989,7 @@ Recent Changes</h3>
995989
* Fixed some errors in the [[#aspect-ratio-size-transfers]] section,
996990
aligning the behavior to not conflict with behavior defined by CSS2 / CSS Flex Layout / etc.
997991
(<a href="https://github.com/w3c/csswg-drafts/issues/6071">Issue 6071</a>)
992+
* Added ''contain-intrinsic-size: auto none'' syntax.
998993

999994
Significant changes since the <a href="https://www.w3.org/TR/2020/WD-css-sizing-4-20200526/">26 May 2020 First Public Working Draft</a> include:
1000995

0 commit comments

Comments
 (0)