LibWeb: Add generic functionality for logical alias computed values

This commit is contained in:
Callum Law
2025-06-18 18:53:33 +12:00
committed by Sam Atkins
parent cfc8d3031b
commit 34a52baeed
Notes: github-actions[bot] 2025-06-23 14:20:34 +00:00
8 changed files with 339 additions and 144 deletions

View File

@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inheritance of CSS Logical Properties and Values properties</title>
<link rel="help" href="https://www.w3.org/TR/css-logical-1/#property-index">
<meta name="assert" content="Properties do not inherit.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../css/support/inheritance-testcommon.js"></script>
</head>
<body>
<div id="reference-container">
<div id="reference"></div>
</div>
<div id="container">
<div id="target"></div>
</div>
<style>
#reference-container {
width: 300px;
}
#reference-container, #reference {
border-style: solid; /* Avoid border-top-width computed style 0 */
border-top-width: medium;
}
#container, #target {
border-block-end-style: solid; /* Avoid border-block-end-width computed style 0 */
border-block-start-style: solid;
border-inline-end-style: solid;
border-inline-start-style: solid;
}
#container {
color: blue;
width: 300px;
}
</style>
<script>
'use strict';
const blue = "rgb(0, 0, 255)";
const green = "rgb(0, 128, 0)";
const mediumWidth = getComputedStyle(reference).borderTopWidth; // e.g. 3px
const referenceWidth = getComputedStyle(reference).width; // e.g. 294px
assert_not_inherited('block-size', '0px', '10px');
assert_not_inherited('border-block-end-color', blue, green);
assert_not_inherited('border-block-end-style', 'none', 'dotted');
assert_not_inherited('border-block-end-width', mediumWidth, '10px');
assert_not_inherited('border-block-start-color', blue, green);
assert_not_inherited('border-block-start-style', 'none', 'dotted');
assert_not_inherited('border-block-start-width', mediumWidth, '10px');
assert_not_inherited('border-end-end-radius', '0px', '10px 20px');
assert_not_inherited('border-end-start-radius', '0px', '10px 20px');
assert_not_inherited('border-inline-end-color', blue, green);
assert_not_inherited('border-inline-end-style', 'none', 'dotted');
assert_not_inherited('border-inline-end-width', mediumWidth, '10px');
assert_not_inherited('border-inline-start-color', blue, green);
assert_not_inherited('border-inline-start-style', 'none', 'dotted');
assert_not_inherited('border-inline-start-width', mediumWidth, '10px');
assert_not_inherited('border-start-end-radius', '0px', '10px 20px');
assert_not_inherited('border-start-start-radius', '0px', '10px 20px');
assert_not_inherited('inline-size', referenceWidth, '10px');
assert_not_inherited('inset-block-end', 'auto', '10px');
assert_not_inherited('inset-block-start', 'auto', '10px');
assert_not_inherited('inset-inline-end', 'auto', '10px');
assert_not_inherited('inset-inline-start', 'auto', '10px');
assert_not_inherited('margin-block-end', '0px', '10px');
assert_not_inherited('margin-block-start', '0px', '10px');
assert_not_inherited('margin-inline-end', '0px', '10px');
assert_not_inherited('margin-inline-start', '0px', '10px');
assert_not_inherited('max-block-size', 'none', '10px');
assert_not_inherited('max-inline-size', 'none', '10px');
assert_not_inherited('min-block-size', '0px', '10px');
assert_not_inherited('min-inline-size', '0px', '10px');
assert_not_inherited('padding-block-end', '0px', '10px');
assert_not_inherited('padding-block-start', '0px', '10px');
assert_not_inherited('padding-inline-end', '0px', '10px');
assert_not_inherited('padding-inline-start', '0px', '10px');
</script>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Logical Properties: Flow-Relative Sizing</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-logical/#dimension-properties">
<meta name="assert" content="This test checks the interaction of the flow-relative sizing properties with the physical ones in different writing modes." />
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="log"></div>
<script type="module">
import {runTests, createSizingPropertyGroup} from "./resources/test-box-properties.js";
runTests(createSizingPropertyGroup(""));
runTests(createSizingPropertyGroup("max-"));
runTests(createSizingPropertyGroup("min-"));
</script>