mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb: Parse widows CSS property
This commit is contained in:
Notes:
github-actions[bot]
2025-09-26 15:36:06 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/c4d6deb5c75 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6313 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -0,0 +1,112 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="UTF-8">
|
||||
<title>widows interpolation</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break-3/#widows-orphans">
|
||||
<meta name="assert" content="widows supports animation by computed value type">
|
||||
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/interpolation-testcommon.js"></script>
|
||||
|
||||
<style>
|
||||
.parent {
|
||||
widows: 30;
|
||||
}
|
||||
.target {
|
||||
widows: 10;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body></body>
|
||||
|
||||
<script>
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: neutralKeyframe,
|
||||
to: '20',
|
||||
}, [
|
||||
{at: -3, expect: '1'},
|
||||
{at: -2.5, expect: '1'},
|
||||
{at: -0.5, expect: '5'},
|
||||
{at: 0, expect: '10'},
|
||||
{at: 0.3, expect: '13'},
|
||||
{at: 0.6, expect: '16'},
|
||||
{at: 1, expect: '20'},
|
||||
{at: 1.5, expect: '25'},
|
||||
]);
|
||||
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: 'initial',
|
||||
to: '20',
|
||||
}, [
|
||||
{at: -3, expect: '1'},
|
||||
{at: -2.5, expect: '1'},
|
||||
{at: -0.5, expect: '1'},
|
||||
{at: 0, expect: '2'},
|
||||
{at: 0.3, expect: '7'},
|
||||
{at: 0.6, expect: '13'},
|
||||
{at: 1, expect: '20'},
|
||||
{at: 1.5, expect: '29'},
|
||||
]);
|
||||
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: 'inherit',
|
||||
to: '20',
|
||||
}, [
|
||||
{at: -3, expect: '60'},
|
||||
{at: -2.5, expect: '55'},
|
||||
{at: -0.5, expect: '35'},
|
||||
{at: 0, expect: '30'},
|
||||
{at: 0.3, expect: '27'},
|
||||
{at: 0.6, expect: '24'},
|
||||
{at: 1, expect: '20'},
|
||||
{at: 1.5, expect: '15'},
|
||||
]);
|
||||
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: 'unset',
|
||||
to: '20',
|
||||
}, [
|
||||
{at: -3, expect: '60'},
|
||||
{at: -2.5, expect: '55'},
|
||||
{at: -0.5, expect: '35'},
|
||||
{at: 0, expect: '30'},
|
||||
{at: 0.3, expect: '27'},
|
||||
{at: 0.6, expect: '24'},
|
||||
{at: 1, expect: '20'},
|
||||
{at: 1.5, expect: '15'},
|
||||
]);
|
||||
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: '10',
|
||||
to: '20'
|
||||
}, [
|
||||
{at: -3.0, expect: '1'},
|
||||
{at: -2.5, expect: '1'},
|
||||
{at: -0.5, expect: '5'},
|
||||
{at: 0, expect: '10'},
|
||||
{at: 0.3, expect: '13'},
|
||||
{at: 0.6, expect: '16'},
|
||||
{at: 1, expect: '20'},
|
||||
{at: 1.5, expect: '25'}
|
||||
]);
|
||||
|
||||
test_interpolation({
|
||||
property: 'widows',
|
||||
from: '2',
|
||||
to: '4'
|
||||
}, [
|
||||
{at: -3.0, expect: '1'},
|
||||
{at: -2.5, expect: '1'},
|
||||
{at: -0.5, expect: '1'},
|
||||
{at: 0, expect: '2'},
|
||||
{at: 0.3, expect: '3'},
|
||||
{at: 0.6, expect: '3'},
|
||||
{at: 1, expect: '4'},
|
||||
{at: 1.5, expect: '5'}
|
||||
]);
|
||||
</script>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fragmentation Module Level 3: getComputedStyle().widows</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break/#propdef-widows">
|
||||
<meta name="assert" content="widows computed value is specified integer.">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("widows", "1");
|
||||
test_computed_value("widows", "234");
|
||||
test_computed_value("widows", "calc(1 + 234)", "235");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fragmentation Module Level 3: parsing widows with invalid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break/#propdef-widows">
|
||||
<meta name="assert" content="widows supports only the grammar '<integer>'.">
|
||||
<meta name="assert" content="Negative values and zero are invalid.">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_invalid_value("widows", "auto");
|
||||
test_invalid_value("widows", "1 234");
|
||||
test_invalid_value("widows", "-234");
|
||||
test_invalid_value("widows", "-1");
|
||||
test_invalid_value("widows", "0");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fragmentation Module Level 3: parsing widows with valid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break/#propdef-widows">
|
||||
<meta name="assert" content="widows supports the full grammar '<integer>'.">
|
||||
<meta name="assert" content="Negative values and zero are invalid.">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_valid_value("widows", "1");
|
||||
test_valid_value("widows", "234");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user