You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editor: Florian Rivoal, On behalf of Bloomberg, https://florian.rivoal.net/, w3cid 43241
16
16
Abstract: This CSS module describes the 'contain' property, which indicates that the element's subtree is independent of the rest of the page. This enables heavy optimizations by user agents when used well.
2. If at least one [=fragmentation container=] of a [=fragmentation context=] has [=layout containment=],
264
358
or if at least one [=fragmentation container=] of a [=fragmentation context=] is a descendant of an element with layout containment
265
359
<strong>and</strong> at least one subsequent [=fragmentation container=] of the same [=fragmentation context=]
@@ -326,13 +420,42 @@ Layout Containment</h3>
326
420
either ''overflow/visible'' or ''overflow/clip'' or a combination thereof,
327
421
any overflow must be treated as [=ink overflow=].
328
422
423
+
<wpt>
424
+
contain-layout-ink-overflow-013.html
425
+
contain-layout-ink-overflow-014.html
426
+
contain-layout-ink-overflow-015.html
427
+
contain-layout-ink-overflow-016.html
428
+
contain-layout-ink-overflow-017.html
429
+
contain-layout-ink-overflow-018.html
430
+
contain-layout-ink-overflow-019.html
431
+
contain-layout-ink-overflow-020.html
432
+
</wpt>
433
+
329
434
4. The element acts as a containing block for absolutely positioned and fixed positioned descendants.
330
435
436
+
<wpt>
437
+
contain-layout-006.html
438
+
contain-layout-007.html
439
+
contain-layout-cell-001.html
440
+
contain-layout-cell-002.html
441
+
</wpt>
442
+
331
443
5. The element creates a <a>stacking context</a>.
332
444
445
+
<wpt>
446
+
contain-layout-016.html
447
+
contain-layout-017.html
448
+
contain-layout-018.html
449
+
</wpt>
450
+
333
451
6. [=Forced breaks=] are allowed within elements with [=layout containment=],
334
452
but do not propagate to the parent as otherwise described in [[CSS-BREAK-3#break-between]].
335
453
454
+
<wpt>
455
+
contain-layout-breaks-001.html
456
+
contain-layout-breaks-002.html
457
+
</wpt>
458
+
336
459
Note: This introduces the previously non-existent possibility that [=forced breaks=]
337
460
may occur between a box and its container (See [[CSS-BREAK-3#possible-breaks]]).
338
461
@@ -342,6 +465,13 @@ Layout Containment</h3>
342
465
to something other than its descendants,
343
466
the containing element is treated as having no baseline.
344
467
468
+
<wpt>
469
+
contain-layout-baseline-001.html
470
+
css/css-contain/contain-layout-button-001.html
471
+
css/css-contain/contain-layout-flexbox-001.html
472
+
css/css-contain/contain-layout-grid-001.html
473
+
</wpt>
474
+
345
475
Possible optimizations that can be enabled by <a>layout containment</a> include (but are not limited to):
346
476
347
477
1. When laying out the page,
@@ -368,6 +498,13 @@ Style Containment</h3>
368
498
must be <a for=property>scoped to the element's sub-tree</a>
369
499
and create a new counter.
370
500
501
+
<wpt>
502
+
contain-style-counters-001.html
503
+
contain-style-counters-002.html
504
+
contain-style-counters-003.html
505
+
contain-style-counters-004.html
506
+
</wpt>
507
+
371
508
2. The effects of the 'content' property's
372
509
''content/open-quote'', ''content/close-quote'', ''content/no-open-quote'' and ''content/no-close-quote''
373
510
must be <a for=property>scoped to the element's sub-tree</a>.
@@ -377,6 +514,22 @@ Style Containment</h3>
377
514
but that changes to the depth of quote nesting by these values inside the subtree
378
515
do not affect the depth of quote nesting outside the subtree.
379
516
517
+
<wpt>
518
+
quote-scoping-001.html
519
+
quote-scoping-002.html
520
+
quote-scoping-003.html
521
+
quote-scoping-004.html
522
+
</wpt>
523
+
524
+
<wpt>
525
+
contain-style-baseline-001.html
526
+
contain-style-breaks-001.html
527
+
contain-style-breaks-002.html
528
+
contain-style-breaks-003.html
529
+
contain-style-breaks-004.html
530
+
contain-style-breaks-005.html
531
+
</wpt>
532
+
380
533
Note: [[CSS-REGIONS-1]] has normative requirements on how <a>style containment</a> affects regions.
381
534
382
535
A <dfn export for=property lt="scoped | scoped property | scoped properties">scoped property</dfn> has its effects scoped to a particular element or subtree.
@@ -397,6 +550,12 @@ Style Containment</h3>
397
550
When considering the effects of the scoped property on elements <em>inside</em> the subtree,
398
551
the element at the base of the subtree is treated as if it was the root of the document.
399
552
553
+
<wpt>
554
+
counter-scoping-001.html
555
+
counter-scoping-002.html
556
+
counter-scoping-003.html
557
+
</wpt>
558
+
400
559
<div class=example>
401
560
As 'counter-increment' is scoped to an element's subtree,
402
561
the first use of it within the subtree acts as if the named counter were set to 0 at the scoping element,
@@ -438,6 +597,23 @@ Paint Containment</h3>
438
597
paint containment has no effect.
439
598
Otherwise, giving an element <dfn export>paint containment</dfn> has the following effects:
0 commit comments