Skip to content

[css-layout-api] Review the LayoutOptions.sizing parameter #747

@bfgeek

Description

@bfgeek

I've introduced a new option for the layout, which should help out a little for servo, and easier for implementations to implement initially.

registerLayout('foo', class {
  static layoutOptions = {sizing: 'block-like'}; // or {sizing: 'manual'}
  *layout(children, edges, constraints, styleMap, breakToken) {
    constraints.fixedInlineSize; // For 'block-like' sizing this *always* fixed, its never null.

    return {autoBlockSize: 100}; // Now autoBlockSize is the size if 'block-size' was 'auto'.
                                 // The actual block-size might get affected by max-height, height, etc..
  }
});

For the 'manual' sizing mode:

registerLayout('foo', class {
  static layoutOptions = {sizing: 'manual'};
  *layout(children, edges, constraints, styleMap, breakToken) {
    constraints.fixedInlineSize; // This may exist, e.g. abs-pos'd, layout, auto within block container (see sizing interactions).

    return {inlineSize: 100, blockSize: 100}; // These do something in this mode
                               // they get ignored if constraints.fixedInlineSize, fixedBlockSize exist still,
                               // but otherwise they are the size of the fragment.
  }
});

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