diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/tests/css/css-values/calc-size | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/calc-size')
5 files changed, 197 insertions, 11 deletions
diff --git a/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-height-interpolation.tentative.html b/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-height-interpolation.tentative.html new file mode 100644 index 0000000000..04c44d0904 --- /dev/null +++ b/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-height-interpolation.tentative.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>height: calc-size() animations</title> +<link rel="help" href="https://drafts.csswg.org/css-values-5/#calc-size"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../../support/interpolation-testcommon.js"></script> + +<style> +.target { + display: block; +} +.target::before { + display: block; + content: ""; + width: 23px; + height: 100px; +} +</style> + +<body> + +<script> + test_interpolation({ + property: 'height', + from: 'calc-size(auto, size)', + to: 'calc-size(auto, size * 2)', + }, [ + { at: -0.25, expect: '75px' }, + { at: 0, expect: '100px' }, + { at: 0.25, expect: '125px' }, + { at: 0.5, expect: '150px' }, + { at: 0.75, expect: '175px' }, + { at: 1, expect: '200px' }, + { at: 1.25, expect: '225px' }, + ]); + + test_interpolation({ + property: 'height', + from: neutralKeyframe, + to: 'calc-size(auto, size * 2)', + }, [ + { at: -0.25, expect: '75px' }, + { at: 0, expect: '100px' }, + { at: 0.25, expect: '125px' }, + { at: 0.5, expect: '150px' }, + { at: 0.75, expect: '175px' }, + { at: 1, expect: '200px' }, + { at: 1.25, expect: '225px' }, + ]); + + test_interpolation({ + property: 'height', + from: 'calc-size(min-content, 0 * size)', + to: 'calc-size(min-content, size)', + }, [ + { at: -0.25, expect: '0' }, + { at: 0, expect: '0' }, + { at: 0.25, expect: '25px' }, + { at: 0.5, expect: '50px' }, + { at: 0.75, expect: '75px' }, + { at: 1, expect: '100px' }, + { at: 1.25, expect: '125px' }, + ]); + + test_interpolation({ + property: 'height', + from: 'calc-size(min-content, 0px)', + to: 'calc-size(min-content, size)', + }, [ + { at: -0.25, expect: '0' }, + { at: 0, expect: '0' }, + { at: 0.25, expect: '25px' }, + { at: 0.5, expect: '50px' }, + { at: 0.75, expect: '75px' }, + { at: 1, expect: '100px' }, + { at: 1.25, expect: '125px' }, + ]); + + test_interpolation({ + property: 'height', + from: '0', + to: 'calc-size(max-content, size)', + }, [ + { at: -0.25, expect: '0' }, + { at: 0, expect: '0' }, + { at: 0.25, expect: '25px' }, + { at: 0.5, expect: '50px' }, + { at: 0.75, expect: '75px' }, + { at: 1, expect: '100px' }, + { at: 1.25, expect: '125px' }, + ]); + +</script> diff --git a/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-width-interpolation.tentative.html b/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-width-interpolation.tentative.html index 7254951db3..b8b24935c3 100644 --- a/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-width-interpolation.tentative.html +++ b/testing/web-platform/tests/css/css-values/calc-size/animation/calc-size-width-interpolation.tentative.html @@ -1,8 +1,7 @@ <!DOCTYPE html> <meta charset="UTF-8"> <title>width: calc-size() animations</title> -<link rel="help" href="https://drafts.csswg.org/css-values-5/"> -<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1800254442"> +<link rel="help" href="https://drafts.csswg.org/css-values-5/#calc-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -28,16 +27,30 @@ <script> test_interpolation({ property: 'width', + from: 'calc-size(auto, size)', + to: 'calc-size(auto, size * 2)', + }, [ + { at: -0.25, expect: '150px' }, + { at: 0, expect: '200px' }, + { at: 0.25, expect: '250px' }, + { at: 0.5, expect: '300px' }, + { at: 0.75, expect: '350px' }, + { at: 1, expect: '400px' }, + { at: 1.25, expect: '450px' }, + ]); + + test_interpolation({ + property: 'width', from: neutralKeyframe, to: 'calc-size(auto, size * 2)', }, [ { at: -0.25, expect: '150px' }, { at: 0, expect: '200px' }, - { at: 0.25, expect: 'calc-size(auto, size * 1.25)' }, - { at: 0.5, expect: 'calc-size(auto, size * 1.5)' }, - { at: 0.75, expect: 'calc-size(auto, size * 1.75)' }, - { at: 1, expect: 'calc-size(auto, size * 2)' }, - { at: 1.25, expect: 'calc-size(auto, size * 2.25)' }, + { at: 0.25, expect: '250px' }, + { at: 0.5, expect: '300px' }, + { at: 0.75, expect: '350px' }, + { at: 1, expect: '400px' }, + { at: 1.25, expect: '450px' }, ]); test_interpolation({ diff --git a/testing/web-platform/tests/css/css-values/calc-size/calc-size-height.tentative.html b/testing/web-platform/tests/css/css-values/calc-size/calc-size-height.tentative.html new file mode 100644 index 0000000000..61e59f83db --- /dev/null +++ b/testing/web-platform/tests/css/css-values/calc-size/calc-size-height.tentative.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<title>calc-size() on height</title> +<link rel="help" href="https://drafts.csswg.org/css-values-5/#calc-size"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + #container { + font-size: 20px; + } + #child { + width: 123px; + height: 10px; + } +</style> + +<div id="container"> + <div id="target"> + <div id="child"></div> + </div> +</div> + +<script> + +let basic_tests = [ + { value: "calc-size(any, 357px)", expected: "357px" }, + { value: "calc-size(any, 31%)", expected_auto: "0px", expected_definite: "31px" }, + { value: "calc-size(31%, size)", expected_auto: "10px", expected_definite: "31px" }, + { value: "calc-size(max-content, 31%)", expected_auto: "0px", expected_definite: "31px" }, + { value: "calc-size(fit-content, 72px)", expected: "72px" }, + { value: "calc-size(37px, 93px)", expected: "93px" }, + { value: "calc-size(83px, size * 3)", expected: "249px" }, + { value: "calc-size(min-content, size / 2)", expected: "5px" }, + { value: "calc-size(max-content, size * 1.2)", expected: "12px" }, + { value: "calc-size(fit-content, size / 2 + 30px)", expected: "35px" }, + { value: "calc-size(30px, 15em)", expected: "300px" }, + { value: "calc-size(calc-size(any, 30px), 15em)", expected: "300px" }, + { value: "calc-size(calc-size(2in, 30px), 15em)", expected: "300px" }, + { value: "calc-size(calc-size(min-content, 30px), 15em)", expected: "300px" }, + { value: "calc-size(calc-size(min-content, size), size)", expected: "10px" }, + { value: "calc(12% + calc-size(any, 31%))", expected_auto: "10px", expected_definite: "43px" }, + { value: "calc-size(any, 31% + 12px)", expected_auto: "12px", expected_definite: "43px" }, + { value: "calc-size(auto, size * 1.5)", expected: "15px" }, +]; +const container = document.getElementById("container"); +const target = document.getElementById("target"); +const target_cs = getComputedStyle(target); +for (const obj of basic_tests) { + test((t) => { + target.style.removeProperty("height"); + target.style.height = obj.value; + container.style.height = "auto"; + let expected = "expected" in obj ? obj.expected : obj.expected_auto; + assert_equals(target_cs.height, expected); + }, `resolved height for height in auto height container: ${obj.value}`); + test((t) => { + target.style.removeProperty("height"); + target.style.height = obj.value; + container.style.height = "100px"; + let expected = "expected" in obj ? obj.expected : obj.expected_definite; + assert_equals(target_cs.height, expected); + }, `resolved height for height in definite height container: ${obj.value}`); +} + +</script> diff --git a/testing/web-platform/tests/css/css-values/calc-size/calc-size-parsing.tentative.html b/testing/web-platform/tests/css/css-values/calc-size/calc-size-parsing.tentative.html index fec24aaed1..e51247c872 100644 --- a/testing/web-platform/tests/css/css-values/calc-size/calc-size-parsing.tentative.html +++ b/testing/web-platform/tests/css/css-values/calc-size/calc-size-parsing.tentative.html @@ -1,13 +1,26 @@ <!DOCTYPE html> <title>calc-size() expressions</title> -<link rel="help" href="https://drafts.csswg.org/css-values-5/"> -<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1800254442"> +<link rel="help" href="https://drafts.csswg.org/css-values-5/#calc-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="../../support/parsing-testcommon.js"></script> <script> +test_valid_value("width", "calc-size(auto, size)"); +test_valid_value("min-width", "calc-size(auto, size)"); +test_valid_value("height", "calc-size(auto, size)"); +test_valid_value("min-height", "calc-size(auto, size)"); +test_invalid_value("max-height", "calc-size(auto, size)"); +test_invalid_value("max-width", "calc-size(auto, size)"); + +test_invalid_value("height", "calc-size(none, size)"); +test_invalid_value("width", "calc-size(none, size)"); +test_invalid_value("min-height", "calc-size(none, size)"); +test_invalid_value("min-width", "calc-size(none, size)"); +test_invalid_value("max-height", "calc-size(none, size)"); +test_invalid_value("max-width", "calc-size(none, size)"); + test_valid_value("width", "calc-size(fit-content, size)"); test_valid_value("height", "calc-size(min-content, size * 2)"); test_valid_value("max-width", "calc-size(max-content, size / 2)"); diff --git a/testing/web-platform/tests/css/css-values/calc-size/calc-size-width.tentative.html b/testing/web-platform/tests/css/css-values/calc-size/calc-size-width.tentative.html index 228f526752..96b2719c5d 100644 --- a/testing/web-platform/tests/css/css-values/calc-size/calc-size-width.tentative.html +++ b/testing/web-platform/tests/css/css-values/calc-size/calc-size-width.tentative.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <title>calc-size() on width</title> -<link rel="help" href="https://drafts.csswg.org/css-values-5/"> -<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/626#issuecomment-1800254442"> +<link rel="help" href="https://drafts.csswg.org/css-values-5/#calc-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <link rel="stylesheet" href="/fonts/ahem.css"> @@ -44,6 +43,8 @@ document.fonts.ready.then(()=> { { value: "calc-size(calc-size(2in, 30px), 15em)", expected: "300px" }, { value: "calc-size(calc-size(min-content, 30px), 15em)", expected: "300px" }, { value: "calc-size(calc-size(min-content, size), size)", expected: "400px" }, + { value: "calc-size(auto, size)", expected: "500px" }, + { value: "calc-size(auto, size * 0.6 + 23px)", expected: "323px" }, ]; const container = document.getElementById("container"); const target = document.getElementById("target"); |