Update web-platform-tests to revision 82b73b315ce7ed1554e7a9b7bced66a5831e4ee5

This commit is contained in:
WPT Sync Bot 2019-08-19 10:23:52 +00:00
parent 00a9f30773
commit 76712d7d25
353 changed files with 6528 additions and 1307 deletions

View file

@ -0,0 +1,50 @@
<!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 with the layout function returning a bad value will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.float {
float: left;
width: 50%;
height: 100px;
}
.fc {
display: flow-root;
height: 100px;
}
@supports (display: layout(bad-return)) {
.test {
display: layout(bad-return);
background: green;
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<!-- This tests that when the "layout()" layout function returns a bad value, it will fallback to block layout. -->
<div class="test">
<div class="float"></div>
<div class="fc"></div>
</div>
<script id="code" type="text/worklet">
registerLayout('bad-return', class {
async intrinsicSizes() {}
async layout() { return 42; }
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#get-a-layout-class-instance">
<link rel="match" href="fallback-ref.html">
<meta name="assert" content="This test checks that a layout() class with a throwing constructor will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.float {
float: left;
width: 50%;
height: 100px;
}
.fc {
display: flow-root;
height: 100px;
}
@supports (display: layout(throwing-ctor)) {
.test {
display: layout(throwing-ctor);
background: green;
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<!-- This tests that when the "layout()" constructor fails, it will fallback to block layout. -->
<div class="test">
<div class="float"></div>
<div class="fc"></div>
</div>
<script id="code" type="text/worklet">
registerLayout('throwing-ctor', class {
constructor() { throw Error('fail!'); }
async intrinsicSizes() {}
async layout() {}
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>

View file

@ -0,0 +1,50 @@
<!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 with a throwing layout function will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.float {
float: left;
width: 50%;
height: 100px;
}
.fc {
display: flow-root;
height: 100px;
}
@supports (display: layout(throwing-layout)) {
.test {
display: layout(throwing-layout);
background: green;
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<!-- This tests that when the "layout()" layout function fails, it will fallback to block layout. -->
<div class="test">
<div class="float"></div>
<div class="fc"></div>
</div>
<script id="code" type="text/worklet">
registerLayout('throwing-layout', class {
async intrinsicSizes() {}
async layout() { throw Error('fail!'); }
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<style>
.result {
background: green;
border: solid 2px;
height: 100px;
width: 100px;
}
</style>
<div class="result"></div>

View file

@ -0,0 +1,84 @@
<!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 performing layout on an invalid child will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.test > div {
height: 100px;
}
@supports (display: layout(bad-child-layout)) {
.test {
display: layout(bad-child-layout);
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-child-layout', class {
static get inputProperties() { return ['--fail']; }
async intrinsicSizes() {}
async layout(children, _, __, styleMap) {
if (styleMap.get('--fail').toString() !== 'true') {
this.child = children[0];
}
// Try to perform layout on the child. If its invalid (we skipped the if
// statement above) we should fallback to block layout.
const fragment = await this.child.layoutNextFragment({});
return {autoBlockSize: 0, childFragments: [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>

View file

@ -0,0 +1,82 @@
<!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>

View file

@ -0,0 +1,41 @@
<!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 with a layout function that doesn't return a promise will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.child {
height: 100px;
}
@supports (display: layout(no-promise)) {
.test {
display: layout(no-promise);
background: green;
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<div class="test">
<div class="child"></div>
</div>
<script id="code" type="text/worklet">
registerLayout('no-promise', class {
async intrinsicSizes() {}
layout() { return {autoBlockSize: 50}; }
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>

View file

@ -0,0 +1,41 @@
<!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 with a layout function that doesn't return a promise will fallback to block layout." />
<style>
.test {
background: red;
border: solid 2px;
width: 100px;
}
.child {
height: 100px;
}
@supports (display: layout(unresolved-promise)) {
.test {
display: layout(unresolved-promise);
background: green;
}
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<div class="test">
<div class="child"></div>
</div>
<script id="code" type="text/worklet">
registerLayout('unresolved-promise', class {
async intrinsicSizes() {}
layout() { return new Promise(() => { /* never resolves */ }); }
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>