Skip to content

[css-containment] Layout containment should block percentage resolution sizing #4255

@chrishtr

Description

@chrishtr

Percentage sizes resolve against the containing block for auto sized children. In quirks mode this can follow a whole chain of containing blocks, and in non-quirks mode it stops at the first containing block.

https://drafts.csswg.org/css-sizing-3/#percentage-sizing

This is a problem for layout containment, because it weakens the isolation between layout below contain:layout and outside. The behavior is also problematic in general because, especially in quirks mode, there is "action at a distance" happening in layout.

The containment spec should be amended to specify that percentage size resolution stops at a contain:layout element.

<div style="height: 100px;">
  <div>
    <div style="height: 50%;"> </div>
  </div>
</div>

In this example, the height of the inner div resolves to 50% of the outer div, i.e. 50px.

If the intermediate div had contain:layout, then the resolved height of the inner div should be 0px.

@tabatkins @bfgeek

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions