Skip to content

[css-layout-api] LayoutClass should probably have a measure callback #123

@upsuper

Description

@upsuper

In the current draft, there is a layout callback function in LayoutClass, which returns LayoutResult includes minContent and maxContent as well as width and height.

I don't think this setting makes much sense. I believe the minContent and maxContent are values used by parent to decide a proper inline-axis length of its child. If the width and height has been decided by the child, having minContent and maxContent doesn't give the parent something really useful.

I'd suggest we have an additional measure callback, which takes the same parameters as the current layout, and returns a struct only includes minContent and maxContent. Then its parent decides geometry for the the box and calls layout with something like "suggested size". The Box interface would need to be adjusted accordingly as well.

I believe this is basically how Android's layout process work.

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