Commit Graph
2 Commits
Author SHA1 Message Date
Ian Kilpatrick e8ecac8f5e Bug 1571788 [wpt PR 18297] - [css-layout-api] Convert to promise based API., a=testonly
Automatic update from web-platform-tests
[css-layout-api] Convert to promise based API.

As above! This switches the API from being generator based, to promise
based.

This introduces the specification's work queue, which is run until
exhaustion. After the work queue has been run the given promise should
be resolved, (if not we fallback to block layout).

This also introduces the CustomLayoutScope, and CustomLayoutToken
which are used together.

The CustomLayoutToken is a heap allocated class held onto objects which
should only be used within a certain layout pass. E.g. you cannot
hold onto a fragment from a previous layout pass, and use it within
the current layout pass.

This is managed by a stack allocated CustomLayoutScope, which once
destroyed marks the CustomLayoutToken as "detached". Any object which
has a "detached" token shouldn't be used.

The CustomLayoutScope is also used to hold onto the work queue.

Bug: 726125
Change-Id: Ic435c8c50fe3d3779f068b41eada815253d0b78b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1716035
Commit-Queue: Ian Kilpatrick <[email protected]>
Reviewed-by: Koji Ishii <[email protected]>
Cr-Commit-Position: refs/heads/master@{#684927}

--

wpt-commits: dd38623d0edc9005cf87397feb2e011eb0679c52
wpt-pr: 18297
2019-08-09 20:31:41 +00:00
Ian Kilpatrick b074d7b4f4 Bug 1464483 [wpt PR 11166] - [css-layout-api] Allow passing of serialized data between parent<->child., a=testonly
Automatic update from web-platform-tests[css-layout-api] Allow passing of serialized data between parent<->child.

This allow arbitary parent<->child communation during layout. A parent
can send data to a child via:

// parent
const fragment = yield child.layoutNextFragment({data});

// child
*layout(children, edges, constraints, style) {
  const data = constraints.data; // receive data.
}

And child to parent via:

// child
*layout() {
  return {data};
}

// parent
const fragment = yield child.layoutNextFragment();
const data = fragment.data; // receive data.

As the parent and child layouts may be invoked in different worklet
global scopes, and don't allow data shared, the serialization of data
uses "kForStorage" which means that SharedArrayBuffers aren't allowed
in the serialization.

Serialization also occurs so that we are able to cache results.

Bug: 726125
Change-Id: Ib7e81b5778cef3af2c2f8a1ccef749f1d2ba4dfa
Reviewed-on: https://chromium-review.googlesource.com/1072150
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Morten Stenshorne <[email protected]>
Commit-Queue: Ian Kilpatrick <[email protected]>
Cr-Commit-Position: refs/heads/master@{#563235}

--

wpt-commits: 8c8238ca96f913c1b90f838def7f9cf0253c0113
wpt-pr: 11166
2018-06-10 09:31:44 +01:00