summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-layout-api/constraints/support/constraints-fixed-block-size.js
blob: 25d73ef61568477784a002dfeb591b7f5c8d0b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
registerLayout('test', class {
  static get inputProperties() {
    return ['--expected-block-size'];
  }

  async intrinsicSizes() {}
  async layout([child], edges, constraints, styleMap) {
    let childFixedInlineSize = 0;
    let childFixedBlockSize = 0;
    if (constraints.fixedBlockSize === JSON.parse(styleMap.get('--expected-block-size'))) {
      childFixedInlineSize = 100;
      childFixedBlockSize = 100;
    }

    const childFragments = [await child.layoutNextFragment({
      fixedInlineSize: childFixedInlineSize,
      fixedBlockSize: childFixedBlockSize,
    })];

    return {childFragments};
  }
});