mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
LibWeb: Coordinate border-* longhands at compute time
Updates the `position-serialization.html` test to be 2-valued so that all cases are covered.
This commit is contained in:
Notes:
github-actions[bot]
2025-12-08 11:48:04 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/68d07355ed1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7050 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Backgrounds and Borders: getComputedStyle().background with multiple layers</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#background">
|
||||
<meta name="assert" content="The number of layers is determined by the number of comma-separated values in the background-image property. .">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/computed-testcommon.js"></script>
|
||||
<style>
|
||||
#target {
|
||||
background-image: none, none, none;
|
||||
font-size: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("background-attachment", "local", "local, local, local");
|
||||
test_computed_value("background-attachment", "scroll, fixed", "scroll, fixed, scroll");
|
||||
test_computed_value("background-attachment", "local, fixed, scroll");
|
||||
test_computed_value("background-attachment", "local, fixed, scroll, fixed", "local, fixed, scroll");
|
||||
|
||||
test_computed_value("background-clip", "border-box", "border-box, border-box, border-box");
|
||||
test_computed_value("background-clip", "content-box, border-box", "content-box, border-box, content-box");
|
||||
test_computed_value("background-clip", "border-box, padding-box, content-box");
|
||||
test_computed_value("background-clip", "content-box, border-box, padding-box, content-box", "content-box, border-box, padding-box");
|
||||
test_computed_value("background-clip", "content-box, border-box, padding-box", "content-box, border-box, padding-box");
|
||||
test_computed_value("background-clip", "content-box, border-box, border-area", "content-box, border-box, border-area");
|
||||
|
||||
// background-color always computes as a single color.
|
||||
test_computed_value("background-color", "rgb(255, 0, 0)");
|
||||
|
||||
test_computed_value("background-origin", "border-box", "border-box, border-box, border-box");
|
||||
test_computed_value("background-origin", "content-box, border-box", "content-box, border-box, content-box");
|
||||
test_computed_value("background-origin", "border-box, padding-box, content-box");
|
||||
test_computed_value("background-origin", "content-box, border-box, padding-box, content-box", "content-box, border-box, padding-box");
|
||||
|
||||
test_computed_value("background-position", "50% 6px", "50% 6px, 50% 6px, 50% 6px");
|
||||
test_computed_value("background-position", "12px 13px, 50% 6px", "12px 13px, 50% 6px, 12px 13px");
|
||||
test_computed_value("background-position", "12px 13px, 50% 6px, 30px -10px");
|
||||
test_computed_value("background-position", "12px 13px, 50% 6px, 30px -10px, -7px 8px", "12px 13px, 50% 6px, 30px -10px");
|
||||
|
||||
test_computed_value("background-position-x", "0.5em", "20px, 20px, 20px");
|
||||
test_computed_value("background-position-x", "-20%, 10px", "-20%, 10px, -20%");
|
||||
|
||||
test_computed_value("background-position-x", "center, left, right", "50%, 0%, 100%");
|
||||
test_computed_value("background-position-x", "calc(10px - 0.5em), -20%, right, 15%", "-10px, -20%, 100%");
|
||||
|
||||
test_computed_value("background-position-y", "0.5em", "20px, 20px, 20px");
|
||||
test_computed_value("background-position-y", "-20%, 10px", "-20%, 10px, -20%");
|
||||
test_computed_value("background-position-y", "center, top, bottom", "50%, 0%, 100%");
|
||||
test_computed_value("background-position-y", "calc(10px - 0.5em), -20%, bottom, 15%", "-10px, -20%, 100%");
|
||||
|
||||
test_computed_value("background-repeat", "round", "round, round, round");
|
||||
test_computed_value("background-repeat", "repeat-x, repeat", "repeat-x, repeat, repeat-x");
|
||||
test_computed_value("background-repeat", "repeat space, round no-repeat, repeat-x");
|
||||
test_computed_value("background-repeat", "repeat-y, round no-repeat, repeat-x, repeat", "repeat-y, round no-repeat, repeat-x");
|
||||
|
||||
test_computed_value("background-size", "contain", "contain, contain, contain");
|
||||
test_computed_value("background-size", "auto 1px, 2% 3%", "auto 1px, 2% 3%, auto 1px");
|
||||
test_computed_value("background-size", "auto 1px, 2% 3%, contain");
|
||||
test_computed_value("background-size", "auto 1px, 2% 3%, contain, 7px 8px", "auto 1px, 2% 3%, contain");
|
||||
|
||||
// Open issue: Define serialization for background shorthand
|
||||
// https://github.com/w3c/csswg-drafts/issues/418
|
||||
// test_computed_value("background", "rgb(1, 2, 3) none 4px 5px / 6px 7px repeat space scroll border-box padding-box");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user