fune/testing/web-platform/tests/css/css-layout-api/layout-child-float.https.html
Ian Kilpatrick a791fb970c 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 <haraken@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563235}

--

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

43 lines
900 B
HTML

<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#layout-children">
<link rel="match" href="green-square-ref.html">
<meta name="assert" content="This test checks that float children appear in the children array." />
<style>
.test {
--child-expected: ["1", "2"];
background: red;
width: 100px;
}
.float {
float: right;
visibility: hidden;
--child: 1;
}
.inflow {
visibility: hidden;
--child: 2;
}
@supports (display: layout(test)) {
.test {
background: green;
display: layout(test);
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<div class="test">
<div class="float"></div>
<div class="inflow"></div>
</div>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-worklet.js'});
</script>