fune/testing/web-platform/tests/css/css-layout-api/baseline/flex-baseline.https.html
Ian Kilpatrick e2b9cbccfe Bug 1793064 [wpt PR 36146] - [last-baseline] Propagate last baslines from flexbox., a=testonly
Automatic update from web-platform-tests
[last-baseline] Propagate last baslines from flexbox.

This modifies flex's baseline accumulator to support three(!) potential
baselines for the first & last baseline.

Firstly we prefer the major/minor baseline for the first/last baseline
of the first/last line.

Then we prefer the minor/major baseline for the first/last baseline of
the first/last line.

Finally fallback baseline is the first/last item in the first/last line.

Bug: 885175
Change-Id: I8113c48e3f6861895f89585f39fd9268e5d70f65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3914072
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1053037}

--

wpt-commits: 1d9f9d7a867d22623a00574a4767a718eb9a77a9
wpt-pr: 36146
2022-10-12 11:09:05 +00:00

51 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#interaction-alignment">
<link rel="match" href="../green-square-ref.html">
<meta name="assert" content="This test checks that a baseline aligned element uses the baseline set in layout()."/>
<style>
.parent {
background: red;
display: flex;
padding: 0 10px;
width: 80px;
height: 100px;
align-items: baseline;
}
.child {
color: red;
}
@supports (display: layout(parent)) {
.parent {
background: green;
}
.child {
display: layout(child);
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<div class="parent">
<div style="position: absolute; top: 50px; width: 50px; height: 25px; background: green;"></div>
<div></div>
<div class="child">text</div>
</div>
<script id="code" type="text/worklet">
registerLayout('child', class {
async intrinsicSizes() {}
async layout(children) {
const childFragments = await Promise.all(children.map(child => child.layoutNextFragment({})));
return {childFragments, baseline: -50};
}
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>