@@ -46,6 +46,10 @@ spec:css-sizing-4; type:property; text:contain-intrinsic-size
4646spec:css-sizing-4; type:property; text:aspect-ratio
4747spec:intersection-observer; type:dfn; text:intersection root
4848spec:css-sizing-3; type:value; for:height; text:auto
49+ spec:css-sizing-3; type:property; text:width
50+ spec:css-sizing-3; type:property; text:height
51+ spec:css-sizing-3; type:value; for:width; text:min-content
52+ spec:css-sizing-3; type:value; for:width; text:max-content
4953</pre>
5054
5155<h2 id='intro'>
@@ -476,59 +480,15 @@ Size Containment</h3>
476480 contain-size-056.html
477481 </wpt>
478482
479- 1. When calculating the size of the [=size containment box=] ,
480- including when computing its [=intrinsic size=] ,
481- it must be treated as having no contents.
483+ 1.
484+ The [=intrinsic sizes=] of the [=size containment box=]
485+ are determined as if the element had no content,
486+ following the same logic as when [=sizing as if empty=] .
482487
483- <wpt>
484- contain-size-021.html
485- contain-size-023.html
486- contain-size-025.html
487- contain-size-027.html
488- contain-size-061.html
489- contain-size-062.html
490- contain-size-063.html
491- contain-size-borders.html
492- contain-size-fieldset-001.html
493- contain-size-fieldset-002.html
494- contain-size-select-001.html
495- contain-size-select-002.html
496- contain-size-scrollbars-001.html
497- contain-size-scrollbars-002.html
498- contain-size-scrollbars-003.html
499- contain-size-scrollbars-004.html
500-
501- contain-size-button-001.html
502- contain-size-flexbox-001.html
503- contain-size-flexbox-002.html
504- contain-size-grid-001.html
505- </wpt>
506-
507- Note: Even when the element's [=sizing properties=] are ''height/auto''
508- this does not necessarily make the element zero-sized:
509- properties set on the element itself,
510- such as the 'columns' property or the 'grid' property,
511- continue to be taken into account.
512-
513- <wpt>
514- contain-size-grid-002.html
515- contain-size-grid-003.html
516- contain-size-multicol-001.html
517- contain-size-multicol-as-flex-item.html
518- </wpt>
519-
520- Then,
521- its contents must then be laid out into the [=size containment box=] 's resolved size normally (including any pseudo-elements),
522- i.e. [=size containment=] has no effect in this phase.
523-
524- Note: [=size containment=] does not suppress baseline alignment.
525- See [=layout containment=] for that.
526-
527- <wpt>
528- contain-size-baseline-001.html
529- </wpt>
530-
531- <a>Replaced elements</a> must be treated as having an intrinsic width and height of 0.
488+ Note: This affects explicit invocations of the ''min-content'' or ''max-content'' keywords,
489+ as well as any calculation that depends on these measurement,
490+ such as sizing <span class=informative> [=grid tracks=] </span> into which a size contained item is placed,
491+ or if [=fit-content sizing=] the containment box's parent.
532492
533493 <wpt>
534494 contain-size-013.html
@@ -544,38 +504,98 @@ Size Containment</h3>
544504 contain-size-replaced-006.html
545505 </wpt>
546506
547- 2. [=Size containment boxes=] must be treated
548- as if they had no [=intrinsic aspect ratio=] .
507+ 2. Laying out a [=size containment box=] and its content is conceptually done in two phases:
508+ <dl>
509+ <dt> <dfn>Sizing as if empty</dfn>
510+ <dd>
511+ The [=used value|used=] 'width' and 'height' of the [=size containment box|containment box=]
512+ are determined as if performing a normal layout of the box,
513+ except that it is treated as having no content--
514+ not even through pseudo elements such as ''::before'' , ''::after'' , or ''::marker'' .
549515
550- Note: Size containment only suppresses the [=intrinsic aspect ratio=] ,
551- not [=preferred aspect ratio=] ,
552- so properties like 'aspect-ratio' which affect that [=preferred aspect ratio=] directly
553- are honored.
516+ <wpt>
517+ contain-size-021.html
518+ contain-size-023.html
519+ contain-size-025.html
520+ contain-size-027.html
521+ contain-size-061.html
522+ contain-size-062.html
523+ contain-size-063.html
524+ contain-size-borders.html
525+ contain-size-fieldset-001.html
526+ contain-size-fieldset-002.html
527+ contain-size-select-001.html
528+ contain-size-select-002.html
529+ contain-size-scrollbars-001.html
530+ contain-size-scrollbars-002.html
531+ contain-size-scrollbars-003.html
532+ contain-size-scrollbars-004.html
554533
555- <wpt pathprefix=css/css-sizing/aspect-ratio/>
556- replaced-element-023 .html
557- replaced-element-025 .html
558- replaced-element-027 .html
559- </wpt>
534+ contain-size-button-001.html
535+ contain-size-flexbox-001 .html
536+ contain-size-flexbox-002 .html
537+ contain-size-grid-001 .html
538+ </wpt>
560539
561- <div class=example>
562- Given the following markup and style, the image would be sized to 100px by 100px,
563- as the aspect ratio set by the 'aspect-ratio' property takes effect.
564- <pre><code class=lang-css>
565- img {
566- width: 100px;
567- aspect-ratio: 1/1;
568- contain: size;
569- }
570- </code><code class=lang-html>
571- <img src="https://www.example.com/300x100.jpg">
572- </code></pre>
540+ <a>Replaced elements</a> must be treated as having an intrinsic width and height of 0
541+ and no [=intrinsic aspect ratio=] .
573542
574- If the 'aspect-ratio' property had not been declared,
575- the image would have been 100px by 0px,
576- as its intrinsic aspect ratio is suppressed,
577- and its intrinsic height is treated as 0.
578- </div>
543+ Note: Size containment only suppresses the [=intrinsic aspect ratio=] ,
544+ so properties like 'aspect-ratio' which affect that [=preferred aspect ratio=] directly
545+ are honored.
546+
547+ <wpt>
548+ contain-size-013.html
549+ contain-size-041.html
550+ contain-size-042.html
551+ contain-size-replaced-001.html
552+ contain-size-replaced-002.html
553+ contain-size-replaced-003a.html
554+ contain-size-replaced-003b.html
555+ contain-size-replaced-003c.html
556+ contain-size-replaced-004.html
557+ contain-size-replaced-005.html
558+ </wpt>
559+ <wpt pathprefix=css/css-sizing/aspect-ratio/>
560+ replaced-element-023.html
561+ replaced-element-025.html
562+ replaced-element-027.html
563+ </wpt>
564+
565+ All CSS properties of the [=size containment box=] are taken into account
566+ as they would be when performing layout normally.
567+ Other specifications may make specific exemptions.
568+
569+ <wpt>
570+ contain-size-replaced-006.html
571+ </wpt>
572+
573+ Note: Even when the element's [=sizing properties=] specify an intrinsic size,
574+ this does not necessarily make the element zero-sized:
575+ properties set on the element itself
576+ continue to be taken into account,
577+ which can cause it to be larger.
578+
579+ <wpt>
580+ contain-size-grid-002.html
581+ contain-size-grid-003.html
582+ contain-size-multicol-001.html
583+ contain-size-multicol-as-flex-item.html
584+ </wpt>
585+
586+ <dt> <dfn>Laying out in-place</dfn>
587+ <dd>
588+ The [=size containment box|containment box=] 's content
589+ (including any pseudo-elements)
590+ must then be laid out into the now fixed-size [=size containment box|containment box=] normally.
591+ </dl>
592+
593+ Note: [=Size containment=] does not suppress baseline alignment.
594+ See [=layout containment=] for that.
595+
596+ <wpt>
597+ contain-size-baseline-001.html
598+ </wpt>
579599
580600 3. [=Size containment boxes=] are <a spec=css-break-3>monolithic</a> (See [[CSS-BREAK-3#possible-breaks]] ).
581601
@@ -584,6 +604,25 @@ Size Containment</h3>
584604 contain-size-monolithic-001.html
585605 </wpt>
586606
607+ <div class=example>
608+ Given the following markup and style, the image would be sized to 100px by 100px,
609+ as the aspect ratio set by the 'aspect-ratio' property takes effect.
610+ <pre><code class=lang-css>
611+ img {
612+ width: 100px;
613+ aspect-ratio: 1/1;
614+ contain: size;
615+ }
616+ </code><code class=lang-html>
617+ <img src="https://www.example.com/300x100.jpg">
618+ </code></pre>
619+
620+ If the 'aspect-ratio' property had not been declared,
621+ the image would have been 100px by 0px,
622+ as its intrinsic aspect ratio is suppressed,
623+ and its intrinsic height is treated as 0.
624+ </div>
625+
587626 By itself, <a>size containment</a> does not offer much optimization opportunity.
588627 Its primary benefit on its own is that tools which want to lay out the [=size containment box|containment box=] 's contents
589628 based on the [=size containment box|containment box=] 's size
@@ -604,7 +643,7 @@ Size Containment</h3>
604643
605644 2. When laying out the page,
606645 if the [=size containment box|containment box=] is off-screen or obscured,
607- the layout of its contents can be delayed or done at a lower priority.
646+ the layout of its contents (i.e. " [=laying out in-place=] ") can be delayed or done at a lower priority.
608647
609648<h3 id='containment-layout'>
610649Layout Containment</h3>
0 commit comments