Skip to content

[css-shapes] Allow new formatting contexts to be sized based on *bounding* float-area. #1970

@bfgeek

Description

@bfgeek

With css-shapes, floats are positioned based on their margin-box. See example-5 in:
https://drafts.csswg.org/css-shapes-1/#relation-to-box-model-and-float-behavior

They will not try and place themselves based on the "float-area", instead the bounding margin-box.

New formatting contexts however, (overflow: hidden, etc) are a different story. It's not exactly clear what the spec intended here.

Currently today in Blinks implementation we will try and size new formatting contexts based on the "float-area". Our implementation uses a previous frame's data, which is completely broken.

In order to do this "correctly" you would have to iterate through every available inline-size, (stepping probably at each pixel?), perform a layout, and check if the block-size of the new FC will fit in the given area.

We (blink) have added a UseCounter for the broken behaviour, are probably going to move to our default sizing/positioning algorithm for new-FCs in the near future.

Given the "correct" behaviour is expensive (requires potentially N layouts - where N is a large number), it might be worth changing the spec to size & position new-FCs similar to how floats currently behave.

This would leave only line-boxes being sized and positioned based on the "float-area".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions