@@ -46,6 +46,10 @@ spec:css-sizing-4; type:property; text:contain-intrinsic-size
46
46
spec:css-sizing-4; type:property; text:aspect-ratio
47
47
spec:intersection-observer; type:dfn; text:intersection root
48
48
spec: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
49
53
</pre>
50
54
51
55
<h2 id='intro'>
@@ -476,50 +480,91 @@ Size Containment</h3>
476
480
contain-size-056.html
477
481
</wpt>
478
482
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. Laying out a [=size containment box=] and its content is conceptually done in two phases:
484
+ <dl>
485
+ <dt> <dfn>Sizing as if empty</dfn>
486
+ <dd>
487
+ The [=used value|used=] 'width' and 'height' of the [=size containment box|containment box=]
488
+ are determined as if performing a normal layout of the box,
489
+ except that it is treated as having no content--
490
+ not even through pseudo elements such as ''::before'' , ''::after'' , or ''::marker'' .
482
491
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>
492
+ <wpt>
493
+ contain-size-021.html
494
+ contain-size-023.html
495
+ contain-size-025.html
496
+ contain-size-027.html
497
+ contain-size-061.html
498
+ contain-size-062.html
499
+ contain-size-063.html
500
+ contain-size-borders.html
501
+ contain-size-fieldset-001.html
502
+ contain-size-fieldset-002.html
503
+ contain-size-select-001.html
504
+ contain-size-select-002.html
505
+ contain-size-scrollbars-001.html
506
+ contain-size-scrollbars-002.html
507
+ contain-size-scrollbars-003.html
508
+ contain-size-scrollbars-004.html
506
509
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.
510
+ contain-size-button-001.html
511
+ contain-size-flexbox-001.html
512
+ contain-size-flexbox-002.html
513
+ contain-size- grid-001.html
514
+ </wpt>
512
515
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>
516
+ <a>Replaced elements</a> must be treated as having an intrinsic width and height of 0.
519
517
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.
518
+ <wpt>
519
+ contain-size-013.html
520
+ contain-size-041.html
521
+ contain-size-042.html
522
+ contain-size-replaced-001.html
523
+ contain-size-replaced-002.html
524
+ contain-size-replaced-003a.html
525
+ contain-size-replaced-003b.html
526
+ contain-size-replaced-003c.html
527
+ contain-size-replaced-004.html
528
+ contain-size-replaced-005.html
529
+ </wpt>
530
+
531
+ [=Size containment boxes=] must be treated
532
+ as if they had no [=intrinsic aspect ratio=] .
533
+
534
+ Note: Size containment only suppresses the [=intrinsic aspect ratio=] ,
535
+ not [=preferred aspect ratio=] ,
536
+ so properties like 'aspect-ratio' which affect that [=preferred aspect ratio=] directly
537
+ are honored.
538
+
539
+ All CSS properties of the [=size containment box=] are taken into account
540
+ as they would be when performing layout norally.
541
+ <!-- uncomment this (and edit the following note) if we want to allow grid to opt into not doing track sizing etc:
542
+ Other specifications may make specific explicit exemptions.
543
+ -->
544
+
545
+ <wpt>
546
+ contain-size-replaced-006.html
547
+ </wpt>
548
+
549
+ Note: Even when the element's [=sizing properties=] are ''height/auto''
550
+ this does not necessarily make the element zero-sized:
551
+ properties set on the element itself,
552
+ such as the 'columns' property or the 'grid' property,
553
+ continue to be taken into account.
554
+
555
+ <wpt>
556
+ contain-size-grid-002.html
557
+ contain-size-grid-003.html
558
+ contain-size-multicol-001.html
559
+ contain-size-multicol-as-flex-item.html
560
+ </wpt>
561
+
562
+ <dt> <dfn>Laying out in-place</dfn>
563
+ <dd>
564
+ The [=size containment box|containment box=] 's content
565
+ (including any pseudo-element)
566
+ must then be laid out into the now fixed-size [=size containment box|containment box=] normally.
567
+ </dl>
523
568
524
569
Note: [=size containment=] does not suppress baseline alignment.
525
570
See [=layout containment=] for that.
@@ -528,7 +573,15 @@ Size Containment</h3>
528
573
contain-size-baseline-001.html
529
574
</wpt>
530
575
531
- <a>Replaced elements</a> must be treated as having an intrinsic width and height of 0.
576
+ 2.
577
+ The [=intrinsic sizes=] of the [=size containment box=]
578
+ are determined as if the element had no content,
579
+ following the same logic as when [=sizing as if empty=] .
580
+
581
+ Note: This affects explit invocations of the ''min-content'' or ''max-content'' keywords,
582
+ as well as any calculation that depends on these measurement,
583
+ such as sizing <span class=informative> [=grid tracks=] </span> into which a size contained item is placed,
584
+ or if [=fit-content sizing=] the contaiing box's parent.
532
585
533
586
<wpt>
534
587
contain-size-013.html
@@ -544,40 +597,32 @@ Size Containment</h3>
544
597
contain-size-replaced-006.html
545
598
</wpt>
546
599
547
- 2. [=Size containment boxes=] must be treated
548
- as if they had no [=intrinsic aspect ratio=] .
549
-
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.
554
-
555
- <div class=example>
556
- Given the following markup and style, the image would be sized to 100px by 100px,
557
- as the aspect ratio set by the 'aspect-ratio' property takes effect.
558
- <pre><code class=lang-css>
559
- img {
560
- width: 100px;
561
- aspect-ratio: 1/1;
562
- contain: size;
563
- }
564
- </code><code class=lang-html>
565
- <img src="https://www.example.com/300x100.jpg">
566
- </code></pre>
567
-
568
- If the 'aspect-ratio' property had not been declared,
569
- the image would have been 100px by 0px,
570
- as its intrinsic aspect ratio is suppressed,
571
- and its intrinsic height is treated as 0.
572
- </div>
573
-
574
600
3. [=Size containment boxes=] are <a spec=css-break-3>monolithic</a> (See [[CSS-BREAK-3#possible-breaks]] ).
575
601
576
602
<wpt>
577
603
contain-size-breaks-001.html
578
604
contain-size-monolithic-001.html
579
605
</wpt>
580
606
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
+
581
626
By itself, <a>size containment</a> does not offer much optimization opportunity.
582
627
Its primary benefit on its own is that tools which want to lay out the [=size containment box|containment box=] 's contents
583
628
based on the [=size containment box|containment box=] 's size
@@ -598,7 +643,7 @@ Size Containment</h3>
598
643
599
644
2. When laying out the page,
600
645
if the [=size containment box|containment box=] is off-screen or obscured,
601
- 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.
602
647
603
648
<h3 id='containment-layout'>
604
649
Layout Containment</h3>
0 commit comments