Skip to content

[css-contain-1] layout containment should make an element containing block for absolute/fixed positioned elements #404

@dbaron

Description

@dbaron

Layout containment does not currently specify that an element must be a containing block for absolute and fixed positioned descendants. (Paint containment does specify this.)

I believe failing to specify this makes some of the optimizations intended to be possible with layout containment not be possible. In particular, if you have:

<div id="A" style="position:relative"> <!-- containing block for abs pos elements -->
    <div id="B" style="contain: layout">
        <div id="C" style="position: absolute; top: auto; left: auto">
        </div>
    </div>
</div>

then changes inside of B require relayout of A, since they can move the position of C, which is (box-wise) a child of A. Note that C could also be positioned partly relative to the contents of B, and partly relative to the size of A (e.g., bottom: 20px; left: auto).

I think layout containment should also specify the line that paint containment currently does:

The element must act as a containing block for absolutely positioned and fixed positioned descendants.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions