-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Labels
Description
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.
}
});