@@ -487,7 +487,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
487
487
488
488
<pre class=propdef>
489
489
Name : contain-intrinsic-width, contain-intrinsic-height, contain-intrinsic-block-size, contain-intrinsic-inline-size
490
- Value : none | <<length>>
490
+ Value : none | <<length>> | auto <<length>>
491
491
Initial : none
492
492
Inherited : no
493
493
Applies to : elements with [=size containment=]
@@ -517,6 +517,12 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
517
517
518
518
: <dfn><<length>></dfn>
519
519
:: The corresponding axis has an [=explicit intrinsic inner size=] of the specified <<length>> .
520
+
521
+ : <dfn>auto <<length>></dfn>
522
+ :: The corresponding axis has an [=explicit intrinsic inner size=]
523
+ of its [=last remembered size=] .
524
+ If a [=last remembered size=] does not yet exist,
525
+ instead use the specified <<length>> .
520
526
</dl>
521
527
522
528
If an element has an [=explicit intrinsic inner size=] in an axis,
@@ -544,7 +550,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
544
550
545
551
<pre class="propdef shorthand">
546
552
Name : contain-intrinsic-size
547
- Value : [ none | <<length>> ]{1,2}
553
+ Value : [ none | <<length>> | auto <<length>> ]{1,2}
548
554
</pre>
549
555
550
556
'contain-intrinsic-size' is a shorthand property
@@ -555,6 +561,53 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
555
561
If only one value is given,
556
562
it applies to both properties.
557
563
564
+ <h4 id='last-remembered' dfn lt="last remembered size" export>
565
+ Last Remembered Size</h4>
566
+
567
+ [=Size containment=] is very valuable for ensuring a page can render efficiently,
568
+ restricting the scope of layout work that can happen
569
+ as a result of an element changing its rendering.
570
+ However, it's also very restrictive for the author,
571
+ requiring them to correctly predict what the size of the element will be;
572
+ if this guess is incorrect,
573
+ even slightly,
574
+ it can cause unsightly scrollbars or accidentally-hidden content.
575
+
576
+ The ''contain-intrinsic-size: auto'' value allows a middle-ground:
577
+ it lays out the element and records its sizes
578
+ <em> just before [=size containment=] begins to apply</em> ,
579
+ then remembers this value
580
+ and uses it from then on,
581
+ offering a <em> probably accurate</em> size based on an actual layout of the contents
582
+ while still offering the performance benefits of [=size containment=]
583
+ from then onward.
584
+
585
+ <div algorithm="last remembered size">
586
+ The [=last remembered size=] of an element is determined by:
587
+
588
+ * At the time that ResizeObserver events are determined and delivered,
589
+ if an element has ''contain-intrinsic-size: auto''
590
+ but does not have [=size containment=] ,
591
+ record its current inner dimensions
592
+ as its [=last remembered size=] .
593
+
594
+ * If the element is being rendered for the first time,
595
+ or has just switched from not being rendered to being rendered
596
+ (for example, it was previously [=skipped contents|skipped=] due to being off-screen),
597
+ then, even if it has [=size containment=] ,
598
+ it must be laid out as if it does <em> not</em> have [=size containment=] ,
599
+ and the resulting inner dimensions
600
+ must be recorded as its [=last remembered size=] .
601
+
602
+ (It is then rendered as usual,
603
+ applying [=size containment=] ,
604
+ but also using this [=last remembered size=]
605
+ due to ''contain-intrinsic-size: auto'' .)
606
+
607
+ An element might not have a [=last remembered size=] ,
608
+ if it has not yet been rendered.
609
+ </div>
610
+
558
611
<h4 id='cis-scrollbars'>
559
612
Interaction With ''overflow: auto''</h4>
560
613
0 commit comments