New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-layout-api] Decide on how to do min/max Content Sizes. #343

Closed
bfgeek opened this Issue Jan 10, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@bfgeek
Contributor

bfgeek commented Jan 10, 2017

There are two possible ways that we can do min/max content contributions.

  1. Use the existing layout functions. E.g.
class {
  *layout(constraintSpace, children, styleMap, opt_breakToken) {
    const minSize = (yield* this.layout(new ConstraintSpace({
      inlineSize: 0,
      blockSize: 0,
      percentageInlineSize: 0,
      percentageBlockSize: 0,
    }), children, styleMap)).inlineSize;

    const maxSize = (yield* this.layout(new ConstraintSpace({
      inlineSize: Infinity,
      blockSize: Infinity,
      percentageInlineSize: 0,
      percentageBlockSize: 0,
    }), children, styleMap)).inlineSize;

    const inlineSize = resolveInlineSize(space, styleMap, {minSize: minSize, maxSize: maxSize});
}
  1. Introduce a new function. E.g.
class {
  *minMaxSizes(constraintSpace, children, styleMap) {

  }
  
  needsMinMaxSizes(styleMap) {
    return super();
  }

  *layout(constraintSpace, children, styleMap, opt_breakToken, opt_minMaxSizes) {
    // If needsMinMaxSizes returns true, opt_minMaxSizes will be provided.
  }
}

The engine may call minMaxSizes separately from layout, if a parents needs to know this.

@bfgeek

This comment has been minimized.

Contributor

bfgeek commented Jan 11, 2017

class {
  minMaxSizes(children, styleMap) {
    return {
      minSize: children.reduce((a, b) => Math.max(a.minSize, b), 0);
      maxSize: children.reduce((a, b) => Math.max(a.maxSize, b), 0);
    }
  }

  *layout(constraintSpace, children, styleMap) {
    const inlineSize = resolveInlineSize(constraintSpace, children, minMaxSizes(children, styleMap));
    return {
    
    };
  }
}
@bfgeek

This comment has been minimized.

Contributor

bfgeek commented Jun 28, 2018

Closing this issue as ended up with the intrinsicSizes callback.

@bfgeek bfgeek closed this Jun 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment