mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 06f77f6bfaa86f3643a79f1ec2c49c6b6955cf18
This commit is contained in:
parent
1981efcc35
commit
c6c4fb2f7a
108 changed files with 2090 additions and 138 deletions
|
@ -0,0 +1,52 @@
|
|||
import {areArraysEqual} from '/common/arrays.js';
|
||||
|
||||
function parseNumber(value) {
|
||||
const num = parseInt(value.toString());
|
||||
if (isNaN(num)) return undefined;
|
||||
return num;
|
||||
}
|
||||
|
||||
registerLayout('test', class {
|
||||
static get childInputProperties() {
|
||||
return [
|
||||
'--fixed-inline-size',
|
||||
'--fixed-block-size',
|
||||
'--inline-size-expected',
|
||||
'--block-size-expected'
|
||||
];
|
||||
}
|
||||
|
||||
*intrinsicSizes() {}
|
||||
*layout(children, edges, constraints, styleMap) {
|
||||
const childFragments = yield children.map((child) => {
|
||||
const childConstraints = {};
|
||||
const fixedInlineSize = parseNumber(child.styleMap.get('--fixed-inline-size'));
|
||||
const fixedBlockSize = parseNumber(child.styleMap.get('--fixed-block-size'));
|
||||
return child.layoutNextFragment({fixedInlineSize, fixedBlockSize});
|
||||
});
|
||||
|
||||
const actual = childFragments.map((childFragment) => {
|
||||
return {
|
||||
inlineSize: childFragment.inlineSize,
|
||||
blockSize: childFragment.blockSize,
|
||||
};
|
||||
});
|
||||
|
||||
const expected = children.map((child) => {
|
||||
return {
|
||||
inlineSize: parseInt(child.styleMap.get('--inline-size-expected').toString()),
|
||||
blockSize: parseInt(child.styleMap.get('--block-size-expected').toString()),
|
||||
};
|
||||
});
|
||||
|
||||
const equalityFunc = (a, b) => {
|
||||
return a.inlineSize == b.inlineSize && a.blockSize == b.blockSize;
|
||||
};
|
||||
|
||||
if (!areArraysEqual(expected, actual, equalityFunc)) {
|
||||
return {autoBlockSize: 0, childFragments};
|
||||
}
|
||||
|
||||
return {autoBlockSize: 100, childFragments};
|
||||
}
|
||||
});
|
|
@ -16,9 +16,11 @@ registerLayout('test', class {
|
|||
return child.styleMap.get('--child').toString().trim();
|
||||
});
|
||||
|
||||
if (!areArraysEqual(expected, actual))
|
||||
return {autoBlockSize: 0};
|
||||
const childFragments = yield children.map((child) => { return child.layoutNextFragment({}); });
|
||||
|
||||
return {autoBlockSize: 100};
|
||||
if (!areArraysEqual(expected, actual))
|
||||
return {autoBlockSize: 0, childFragments};
|
||||
|
||||
return {autoBlockSize: 100, childFragments};
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue