mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Automatic update from web-platform-tests [css-layout-api] Move tests into various sub-directories. Tests-only. Moves tests into logically grouped sub-directories. This speeds up (local) test runs as parallelization happens on a per directory basis. Bug: 726125 Change-Id: I963184ea74675a4c662ec4779afafa085c33ea0e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757890 Commit-Queue: Ian Kilpatrick <[email protected]> Auto-Submit: Ian Kilpatrick <[email protected]> Reviewed-by: Koji Ishii <[email protected]> Cr-Commit-Position: refs/heads/master@{#687807} -- wpt-commits: f10378fa073caba1a793c28801a5231aeab95279 wpt-pr: 18503
83 lines
2.0 KiB
HTML
83 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html class=reftest-wait>
|
|
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#invoke-a-layout-callback">
|
|
<link rel="match" href="fallback-ref.html">
|
|
<meta name="assert" content="This test checks that a layout() class returning an invalid fragment will fallback to block layout." />
|
|
<style>
|
|
.test {
|
|
background: red;
|
|
border: solid 2px;
|
|
width: 100px;
|
|
}
|
|
|
|
.test > div {
|
|
height: 100px;
|
|
}
|
|
|
|
@supports (display: layout(bad-request)) {
|
|
.test {
|
|
display: layout(bad-request);
|
|
background: green;
|
|
}
|
|
}
|
|
</style>
|
|
<script src="/common/reftest-wait.js"></script>
|
|
<script src="/common/worklet-reftest.js"></script>
|
|
|
|
<div class="test">
|
|
<div></div>
|
|
</div>
|
|
|
|
<script id="code" type="text/worklet">
|
|
registerLayout('bad-request', class {
|
|
static get inputProperties() { return ['--fail']; }
|
|
|
|
async intrinsicSizes() {}
|
|
async layout(children, _, __, styleMap) {
|
|
if (styleMap.get('--fail').toString() !== 'true') {
|
|
this.fragment = await children[0].layoutNextFragment({});
|
|
}
|
|
|
|
// Return, if the fragment is invalid (we skipped the if statement above)
|
|
// we should fallback to block layout.
|
|
return {autoBlockSize: 0, childFragments: [this.fragment]};
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
function raf() {
|
|
return new Promise((resolve) => {
|
|
requestAnimationFrame(() => {
|
|
resolve();
|
|
});
|
|
});
|
|
}
|
|
|
|
(async function() {
|
|
if (typeof CSS.layoutWorklet === 'undefined') {
|
|
takeScreenshot();
|
|
return;
|
|
}
|
|
|
|
await importWorklet(CSS.layoutWorklet, document.getElementById('code').textContent);
|
|
|
|
// Ensure that all instances have a child to perform an invalid layout upon.
|
|
const test = document.getElementsByClassName('test')[0];
|
|
for (let i = 0; i < 100; i++) {
|
|
test.innerHTML = '<div><div>';
|
|
await raf();
|
|
}
|
|
|
|
// The next layout should mean that we will fallback to block.
|
|
test.innerHTML = '<div></div>';
|
|
test.style.setProperty('--fail', 'true');
|
|
|
|
// Finish up the test.
|
|
await raf();
|
|
await raf();
|
|
takeScreenshot();
|
|
})();
|
|
</script>
|
|
</html>
|