[css-houdini-drafts] [css-layout-api] Lifetime policy for passed in objects, e.g. LayoutChild

bfgeek has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-layout-api] Lifetime policy for passed in objects, e.g. LayoutChild ==
When the web developer gets arguments from the UA, e.g.

```js
    *intrinsicSizes(children, edges, styleMap) { }
    *layout(children, edges, constraints, styleMap) { }
```

What is the lifetime of each of the objects (the children in particular).

For the `LayoutChild` if we make it have the lifetime the same as the `box` which it belongs to the web developer can do useful things like:

```
  *layout(children) {
    const child = children[0];
    const result = this.someComplexPreCalculation(child);
  }

  someComplexPreCalculation(child) {
    if (!child.result) {
      /* something */
      child.result = someResult;
    }
    return result; 
  }
```

Is there any value for doing this for the other params? (paint doesn't do this currently).

Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/745 using your GitHub account

Received on Saturday, 7 April 2018 17:58:28 UTC