diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-box | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-box')
51 files changed, 2084 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-box/META.yml b/testing/web-platform/tests/css/css-box/META.yml new file mode 100644 index 0000000000..dde409360f --- /dev/null +++ b/testing/web-platform/tests/css/css-box/META.yml @@ -0,0 +1,5 @@ +spec: https://drafts.csswg.org/css-box/ +suggested_reviewers: + - dbaron + - dholbert + - mstensho diff --git a/testing/web-platform/tests/css/css-box/animation/margin-bottom-composition.html b/testing/web-platform/tests/css/css-box/animation/margin-bottom-composition.html new file mode 100644 index 0000000000..c95f8de23e --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/margin-bottom-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>margin-bottom composition</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/box.html#margin-properties"> +<meta name="assert" content="margin-bottom supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'margin-bottom', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'margin-bottom', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, +]); + +test_composition({ + property: 'margin-bottom', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'margin-bottom', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'margin-bottom', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/margin-interpolation.html b/testing/web-platform/tests/css/css-box/animation/margin-interpolation.html new file mode 100644 index 0000000000..088836cbbd --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/margin-interpolation.html @@ -0,0 +1,118 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>margin interpolation</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/box.html#margin-properties"> +<meta name="assert" content="margin supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + margin: 10px; + border: solid; + display: inline-block; +} + +.target { + width: 40px; + height: 40px; + background-color: black; + display: inline-block; + margin: 30px; + opacity: 0.5; +} + +.expected { + background-color: green; +} +</style> + +<body> +<template id="target-template"> + <div> + <div class="target"></div> + </div> +</template> + +<script> +test_interpolation({ + property: 'margin', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'margin', + from: 'initial', + to: '20px', +}, [ + {at: -0.3, expect: '-6px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'margin', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_interpolation({ + property: 'margin', + from: 'unset', + to: '20px', +}, [ + {at: -0.3, expect: '-6px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'margin', + from: '0px', + to: '10px' +}, [ + {at: -0.3, expect: '-3px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '3px'}, + {at: 0.6, expect: '6px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '15px'} +]); + +test_interpolation({ + property: 'margin', + from: '20px 40px 60px 80px', + to: '30px 50px 70px 90px' +}, [ + {at: -0.3, expect: '17px 37px 57px 77px'}, + {at: 0, expect: '20px 40px 60px 80px'}, + {at: 0.3, expect: '23px 43px 63px 83px'}, + {at: 0.6, expect: '26px 46px 66px 86px'}, + {at: 1, expect: '30px 50px 70px 90px'}, + {at: 1.5, expect: '35px 55px 75px 95px'} +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/margin-left-composition.html b/testing/web-platform/tests/css/css-box/animation/margin-left-composition.html new file mode 100644 index 0000000000..8f3c646dfe --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/margin-left-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>margin-left composition</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/box.html#margin-properties"> +<meta name="assert" content="margin-left supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'margin-left', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'margin-left', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, +]); + +test_composition({ + property: 'margin-left', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'margin-left', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'margin-left', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/margin-right-composition.html b/testing/web-platform/tests/css/css-box/animation/margin-right-composition.html new file mode 100644 index 0000000000..c903303313 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/margin-right-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>margin-right composition</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/box.html#margin-properties"> +<meta name="assert" content="margin-right supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'margin-right', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'margin-right', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, +]); + +test_composition({ + property: 'margin-right', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'margin-right', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'margin-right', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/margin-top-composition.html b/testing/web-platform/tests/css/css-box/animation/margin-top-composition.html new file mode 100644 index 0000000000..5f050bd6c7 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/margin-top-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>margin-top composition</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/box.html#margin-properties"> +<meta name="assert" content="margin-top supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'margin-top', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'margin-top', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, +]); + +test_composition({ + property: 'margin-top', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'margin-top', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'margin-top', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/padding-bottom-composition.html b/testing/web-platform/tests/css/css-box/animation/padding-bottom-composition.html new file mode 100644 index 0000000000..855b5d3dc2 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/padding-bottom-composition.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>padding-bottom composition</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#padding-shorthand"> +<meta name="assert" content="padding-bottom supports animation as a list of lengths"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'padding-bottom', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'padding-bottom', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'padding-bottom', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'padding-bottom', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/padding-interpolation.html b/testing/web-platform/tests/css/css-box/animation/padding-interpolation.html new file mode 100644 index 0000000000..3bf2841179 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/padding-interpolation.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>padding interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#padding-shorthand"> +<meta name="assert" content="padding supports animation as a list of lengths"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + padding: 30px; +} +.target { + width: 1px; + height: 1px; + background-color: black; + display: inline-block; + padding: 10px; +} +.expected { + background-color: green; + margin-right: 10px; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'padding', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_interpolation({ + property: 'padding', + from: 'initial', + to: '20px', +}, [ + {at: -0.3, expect: '0px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'padding', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_interpolation({ + property: 'padding', + from: 'unset', + to: '20px', +}, [ + {at: -0.3, expect: '0px'}, + {at: 0, expect: '0px'}, + {at: 0.3, expect: '6px'}, + {at: 0.6, expect: '12px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '30px'}, +]); + +test_interpolation({ + property: 'padding', + from: '0px', + to: '10px' +}, [ + {at: -0.3, expect: '0px'}, // CSS padding can't be negative. + {at: 0, expect: '0px'}, + {at: 0.3, expect: '3px'}, + {at: 0.6, expect: '6px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '15px'} +]); + +test_interpolation({ + property: 'padding', + from: '20px 40px 60px 80px', + to: '30px 50px 70px 90px' +}, [ + {at: -0.3, expect: '17px 37px 57px 77px'}, + {at: 0, expect: '20px 40px 60px 80px'}, + {at: 0.3, expect: '23px 43px 63px 83px'}, + {at: 0.6, expect: '26px 46px 66px 86px'}, + {at: 1, expect: '30px 50px 70px 90px'}, + {at: 1.5, expect: '35px 55px 75px 95px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-box/animation/padding-left-composition.html b/testing/web-platform/tests/css/css-box/animation/padding-left-composition.html new file mode 100644 index 0000000000..417777ae25 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/padding-left-composition.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>padding-left composition</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#padding-shorthand"> +<meta name="assert" content="padding-left supports animation as a list of lengths"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'padding-left', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'padding-left', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'padding-left', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'padding-left', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/padding-right-composition.html b/testing/web-platform/tests/css/css-box/animation/padding-right-composition.html new file mode 100644 index 0000000000..3c80849bb2 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/padding-right-composition.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>padding-right composition</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#padding-shorthand"> +<meta name="assert" content="padding-right supports animation as a list of lengths"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'padding-right', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'padding-right', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'padding-right', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'padding-right', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/animation/padding-top-composition.html b/testing/web-platform/tests/css/css-box/animation/padding-top-composition.html new file mode 100644 index 0000000000..b5083ae79b --- /dev/null +++ b/testing/web-platform/tests/css/css-box/animation/padding-top-composition.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>padding-top composition</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#padding-shorthand"> +<meta name="assert" content="padding-top supports animation as a list of lengths"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'padding-top', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'padding-top', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'padding-top', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'padding-top', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-box/box-chrome-crash-001.html b/testing/web-platform/tests/css/css-box/box-chrome-crash-001.html new file mode 100644 index 0000000000..351df37f15 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/box-chrome-crash-001.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<title>CSS Box: chrome crash</title> +<link rel="author" href="mailto:atotic@google.com"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://crbug.com/967361"> +<meta name="assert" content="Chrome does not crash on narrow div with scrollbars."> +<style> +body { + writing-mode: vertical-lr; +} +#target { + overflow-y: scroll; + max-height: 5px; + background: gray; +} +</style> +<!-- --> +<div> + <span> + <div id="container"> + <div id="target">anon</div> + </div> + </span> +</div> + +<script> +test(() => { +}, 'test passes if it does not crash'); +</script> diff --git a/testing/web-platform/tests/css/css-box/inheritance.html b/testing/web-platform/tests/css/css-box/inheritance.html new file mode 100644 index 0000000000..bf10aeeb8e --- /dev/null +++ b/testing/web-platform/tests/css/css-box/inheritance.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of CSS Box Model properties</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#property-index"> +<link rel="help" href="https://www.w3.org/TR/CSS2/"> +<meta name="assert" content="Properties do not inherit."> +<meta name="assert" content="length-percentage properties have initial value 0."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> + <div id="target"></div> +</div> +<script> +assert_not_inherited('clear', 'none', 'right'); +assert_not_inherited('float', 'none', 'right'); + +assert_not_inherited('margin-bottom', '0px', '10px'); +assert_not_inherited('margin-left', '0px', '10px'); +assert_not_inherited('margin-right', '0px', '10px'); +assert_not_inherited('margin-top', '0px', '10px'); +assert_not_inherited('margin-trim', 'none', 'block'); +assert_not_inherited('padding-bottom', '0px', '10px'); +assert_not_inherited('padding-left', '0px', '10px'); +assert_not_inherited('padding-right', '0px', '10px'); +assert_not_inherited('padding-top', '0px', '10px'); + +assert_inherited('visibility', 'visible', 'collapse'); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-001.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-001.html new file mode 100644 index 0000000000..516a90cf65 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-001.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block trim 001</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block should trim block start and end margins for block-level first child"> +<style> +.container { + background-color: green; + width: 100px; + margin-trim: block; +} +.outer { + background-color: green; + width: 100px; + height: 50px; +} +.child { + margin-top: 50px; + margin-bottom: 50px; + height: 50px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <div class="child"></div> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-002.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-002.html new file mode 100644 index 0000000000..1f86d555bf --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-002.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block trim 002</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block should trim block start and end margins for ONLY block-level first/last children"> +<style> +.container { + background-color: green; + width: 100px; + margin-trim: block; +} +.first { + margin-top: 50px; + height: 25px; +} +.second { + width: 100px; + height: 10px; + margin-bottom: 15px; +} +.third { + width: 100px; + height: 25px; + margin-bottom: 50px; +} +.outer { + width: 100px; + height: 25px; + background-color: green; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <div class="first"></div> + <div class="second"></div> + <div class="third"></div> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-001.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-001.html new file mode 100644 index 0000000000..e36a207fb6 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-001.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block end trim 001</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block-end should trim block end margin for block-level first child"> +<style> +.container { + background-color: green; + width: 100px; + margin-trim: block-end; +} +.outer { + background-color: green; + width: 100px; + height: 50px; +} +.child { + margin-bottom: 50px; + height: 50px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <div class="child"></div> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-002.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-002.html new file mode 100644 index 0000000000..2859e10468 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-end-002.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block end trim 002</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block-end should trim block end margin for ONLY block-level first child"> +<style> +.container { + width: 100px; + margin-trim: block-end; + background-color: green; +} +.outer { + width: 100px; + height: 40px; + background-color: green; +} +.first { + width: 100%; + margin-bottom: 25px; + height: 25px; +} +.second { + margin-bottom: 100px; + width: 100%; + height: 10px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <div class="first"></div> + <div class="second"></div> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-001.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-001.html new file mode 100644 index 0000000000..2fecf07e64 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-001.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block start trim 001</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block-start should trim block start margin for block-level first child"> +<style> +.container { + background-color: green; + width: 100px; + margin-trim: block-start; +} +.outer { + background-color: green; + width: 100px; + height: 50px; +} +.child { + margin-top: 50px; + height: 50px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="outer"></div> + <div class="container"> + <div class="child"></div> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-002.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-002.html new file mode 100644 index 0000000000..6edbb54e94 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-block-start-002.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block start trim 002</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block-start should trim block start margin for ONLY block-level first child"> +<style> +.container { + background-color: green; + width: 100px; + margin-trim: block-start; +} +.outer { + background-color: green; + width: 100px; + height: 10px; +} +.first { + margin-top: 50px; + width: 100%; + height: 40px; +} +.second { + margin-top: 10px; + width: 100%; + height: 40px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="outer"></div> + <div class="container"> + <div class="first"></div> + <div class="second"></div> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-end.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-end.html new file mode 100644 index 0000000000..6011d10de5 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-end.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block container replaced block-end trim</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block level replaced element should have block-end trimmed"> +<style> +.container { + width: 100px; + margin-trim: block-end; +} +.outer { + background-color: green; + width: 100px; + height: 40px; +} +.child { + display: block; + margin-bottom: 50px; + background-color: green; + padding-right: 40px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <img class="child" src="/css/support/60x60-green.png"/> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-start.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-start.html new file mode 100644 index 0000000000..c943fb16bb --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block-start.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block container replaced block-start trim</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block level replaced element should have block-start trimmed"> +<style> +.container { + width: 100px; + margin-trim: block-start; +} +.outer { + background-color: green; + width: 100px; + height: 40px; +} +.child { + display: block; + margin-top: 50px; + background-color: green; + padding-right: 40px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="outer"></div> + <div class="container"> + <img class="child" src="/css/support/60x60-green.png"/> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block.html b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block.html new file mode 100644 index 0000000000..54d701176c --- /dev/null +++ b/testing/web-platform/tests/css/css-box/margin-trim/block-container-replaced-block.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> +<title>CSS margin-trim: block container replaced block trim</title> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<link rel="help" href="https://drafts.csswg.org/css-box-4/#margin-trim-block"> +<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="block level replaced element should have both block-start and block-end trimmed when block is specified"> +<style> +.container { + width: 100px; + margin-trim: block; +} +.outer { + background-color: green; + width: 100px; + height: 40px; +} +.child { + display: block; + margin-top: 50px; + margin-bottom: 50px; + background-color: green; + padding-right: 40px; +} +</style> +</head> +<body> + <p>Test passes if there is a filled green square.</p> + <div class="container"> + <img class="child" src="/css/support/60x60-green.png"/> + </div> + <div class="outer"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/clear-computed.html b/testing/web-platform/tests/css/css-box/parsing/clear-computed.html new file mode 100644 index 0000000000..9571cb7e40 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/clear-computed.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: getComputedStyle().clear</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-clear"> +<link rel="help" href="https://drafts.csswg.org/css-logical/#float-clear"> +<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("clear", "none"); +test_computed_value("clear", "left"); +test_computed_value("clear", "right"); +test_computed_value("clear", "both"); + +test_computed_value("clear", "inline-start"); +test_computed_value("clear", "inline-end"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/clear-invalid.html b/testing/web-platform/tests/css/css-box/parsing/clear-invalid.html new file mode 100644 index 0000000000..38d1821bc8 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/clear-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing clear with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-clear"> +<meta name="assert" content="clear supports only the grammar 'none | left | right | both'."> +<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("clear", "auto"); +test_invalid_value("clear", "left right"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/clear-valid.html b/testing/web-platform/tests/css/css-box/parsing/clear-valid.html new file mode 100644 index 0000000000..fc1947f71d --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/clear-valid.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing clear with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-clear"> +<link rel="help" href="https://drafts.csswg.org/css-logical/#float-clear"> +<meta name="assert" content="clear supports the full grammar 'none | left | right | both'."> +<meta name="assert" content="clear also supports inline-start and inline-end."> +<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("clear", "none"); +test_valid_value("clear", "left"); +test_valid_value("clear", "right"); +test_valid_value("clear", "both"); + +test_valid_value("clear", "inline-start"); +test_valid_value("clear", "inline-end"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/float-computed.html b/testing/web-platform/tests/css/css-box/parsing/float-computed.html new file mode 100644 index 0000000000..9d680e16c6 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/float-computed.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: getComputedStyle().float</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float"> +<link rel="help" href="https://drafts.csswg.org/css-logical/#float-clear"> +<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("float", "none"); +test_computed_value("float", "left"); +test_computed_value("float", "right"); + +test_computed_value("float", "inline-start"); +test_computed_value("float", "inline-end"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/float-invalid.html b/testing/web-platform/tests/css/css-box/parsing/float-invalid.html new file mode 100644 index 0000000000..c11f4e2e66 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/float-invalid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing float with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float"> +<meta name="assert" content="float supports only the grammar 'left | right | top | bottom | start | end | none | <page-floats>'."> +<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("float", "auto"); +test_invalid_value("float", "right bottom"); +test_invalid_value("float", "top, left"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/float-valid.html b/testing/web-platform/tests/css/css-box/parsing/float-valid.html new file mode 100644 index 0000000000..32cf7edefd --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/float-valid.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing float with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-float"> +<link rel="help" href="https://drafts.csswg.org/css-logical/#float-clear"> +<meta name="assert" content="float supports the full grammar 'left | right | top | bottom | start | end | none | <page-floats>'."> +<meta name="assert" content="float supports 'inline-start | inline-end'."> +<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("float", "left"); +test_valid_value("float", "right"); +test_valid_value("float", "none"); + +test_valid_value("float", "inline-start"); +test_valid_value("float", "inline-end"); + +// The following are not yet supported by browsers: +// test_valid_value("float", "top"); +// test_valid_value("float", "bottom"); +// test_valid_value("float", "start"); // not permitted in https://drafts.csswg.org/css-page-floats/#float-property +// test_valid_value("float", "end"); // not permitted in https://drafts.csswg.org/css-page-floats/#float-property + +// Page floats are now defined in +// https://drafts.csswg.org/css-page-floats/#float-property +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/height-invalid.html b/testing/web-platform/tests/css/css-box/parsing/height-invalid.html new file mode 100644 index 0000000000..dcd4d1afbe --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/height-invalid.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing height with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-height"> +<meta name="assert" content="height supports only the grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | complex | auto'."> +<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("height", "none"); + +test_invalid_value("height", "min-content available"); +test_invalid_value("height", "max-content 10px"); +test_invalid_value("height", "20% available"); + +test_invalid_value("height", "-10px"); +test_invalid_value("height", "-20%"); +test_invalid_value("height", "60"); +test_invalid_value("height", "10px 20%"); + +test_invalid_value("height", "10px border-box"); +test_invalid_value("height", "content-box 20%"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/height-valid.html b/testing/web-platform/tests/css/css-box/parsing/height-valid.html new file mode 100644 index 0000000000..7cc09a594e --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/height-valid.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing height with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-height"> +<meta name="assert" content="height supports the full grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | complex | auto'."> +<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("height", "auto"); + +test_valid_value("height", "10px"); +test_valid_value("height", "20%"); +test_valid_value("height", "calc(2em + 3ex)"); + +test_valid_value("height", "min-content"); +test_valid_value("height", "max-content"); +test_valid_value("height", "fit-content"); + +// The following are not yet supported by browsers: +// test_valid_value("height", "available"); +// test_valid_value("height", "complex"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-computed.html b/testing/web-platform/tests/css/css-box/parsing/margin-computed.html new file mode 100644 index 0000000000..6c3b321c72 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-computed.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: getComputedStyle().margin</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin"> +<meta name="assert" content="margin computed value has absolute lengths."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +<style> + #parent { + width: 200px; + } + #target { + width: 0px; + font-size: 40px; + } +</style> +</head> +<body> +<div id="parent"> + <div id="target"></div> +</div> +<script> +const target = document.getElementById("target"); + +test_computed_value("margin", "10px"); +test_computed_value("margin", "10px 20px 30px 40px"); +test_computed_value("margin", "calc(0.5em + 10px)", "30px"); +test_computed_value("margin", "30%", "60px"); + +// Since what should the margin be in presence of other margins is a bit +// unclear (https://github.com/w3c/csswg-drafts/issues/2328), reset the margin +// before testing. +target.style.margin = "0"; +test_computed_value("margin-top", "10px"); +target.style.margin = "0"; +test_computed_value("margin-right", "20px"); +target.style.margin = "0"; +test_computed_value("margin-bottom", "30px"); +target.style.margin = "0"; +test_computed_value("margin-left", "40px"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-invalid.html b/testing/web-platform/tests/css/css-box/parsing/margin-invalid.html new file mode 100644 index 0000000000..7700917093 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-invalid.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing margin with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin"> +<meta name="assert" content="margin supports only the grammar '[ <length> | <percentage> | auto]{1,4}'."> +<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("margin", "available"); +test_invalid_value("margin", "10px border-box"); +test_invalid_value("margin", "1% 2% 3% 4% 5%"); + +test_invalid_value("margin-top", "calc(2em + 3ex) auto"); +test_invalid_value("margin-right", "auto calc(2em + 3ex) 20%"); +test_invalid_value("margin-bottom", "10px 20% calc(2em + 3ex) auto"); +test_invalid_value("margin-bottom-left", "none"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-shorthand.html b/testing/web-platform/tests/css/css-box/parsing/margin-shorthand.html new file mode 100644 index 0000000000..293927983e --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-shorthand.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: margin sets longhands</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin"> +<meta name="assert" content="margin supports the full grammar '<length-percentage>{1,4}'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/shorthand-testcommon.js"></script> +</head> +<body> +<script> +test_shorthand_value('margin', '1px 2px 3px 4px', { + 'margin-top': '1px', + 'margin-right': '2px', + 'margin-bottom': '3px', + 'margin-left': '4px' +}); + +test_shorthand_value('margin', '1px 2px 3px', { + 'margin-top': '1px', + 'margin-right': '2px', + 'margin-bottom': '3px', + 'margin-left': '2px' +}); + +test_shorthand_value('margin', '1px 2px', { + 'margin-top': '1px', + 'margin-right': '2px', + 'margin-bottom': '1px', + 'margin-left': '2px' +}); + +test_shorthand_value('margin', '1px', { + 'margin-top': '1px', + 'margin-right': '1px', + 'margin-bottom': '1px', + 'margin-left': '1px' +}); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-trim-computed.html b/testing/web-platform/tests/css/css-box/parsing/margin-trim-computed.html new file mode 100644 index 0000000000..ad2d17f2ef --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-trim-computed.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS margin-trim computed style</title> +<link rel="help" href="https://www.w3.org/TR/css-box-4/#margin-trim"> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<meta name="assert" content="Test the computed values for margin-trim"> +<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("margin-trim", "none"); +test_computed_value("margin-trim", "block"); +test_computed_value("margin-trim", "inline"); +test_computed_value("margin-trim", "block-start block-end", "block"); +test_computed_value("margin-trim", "inline-start inline-end", "inline"); +test_computed_value("margin-trim", "block-start"); +test_computed_value("margin-trim", "block-end"); +test_computed_value("margin-trim", "inline-start"); +test_computed_value("margin-trim", "inline-end"); +test_computed_value("margin-trim", "block-start inline-start"); +test_computed_value("margin-trim", "inline-start block-start", "block-start inline-start"); +test_computed_value("margin-trim", "inline-end block-start", "block-start inline-end"); +test_computed_value("margin-trim", "inline-end block-end", "block-end inline-end"); +test_computed_value("margin-trim", "block-start block-end inline-start", "block-start inline-start block-end"); +test_computed_value("margin-trim", "inline-start block-start inline-end block-end", "block-start inline-start block-end inline-end"); +test_computed_value("margin-trim", "inline-start inline-end block-start", "block-start inline-start inline-end"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-trim.html b/testing/web-platform/tests/css/css-box/parsing/margin-trim.html new file mode 100644 index 0000000000..0d92f80b9b --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-trim.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS margin-trim: property parsing</title> +<link rel="help" href="https://www.w3.org/TR/css-box-4/#margin-trim"> +<link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> +<meta name="assert" content="Test parsing for the margin-trim property"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +// Individual values should get set +test_valid_value("margin-trim", "none"); +test_valid_value("margin-trim", "block"); +test_valid_value("margin-trim", "inline"); +test_valid_value("margin-trim", "block-start"); +test_valid_value("margin-trim", "block-end"); +test_valid_value("margin-trim", "inline-start"); +test_valid_value("margin-trim", "inline-end"); + +// Serialize values into either block or inline +test_valid_value("margin-trim", "block-start block-end", "block"); +test_valid_value("margin-trim", "inline-start inline-end", "inline"); +test_valid_value("margin-trim", "block-end block-start", "block"); +test_valid_value("margin-trim", "inline-end inline-start", "inline"); +test_valid_value("margin-trim", "inline-start block-start"); + +test_valid_value("margin-trim", "inline-end block-start block-end"); +test_valid_value("margin-trim", "block-start inline-start block-end inline-end"); +test_valid_value("margin-trim", "inline-end block-end inline-start block-start"); + +test_invalid_value("margin-trim", "block inline"); +test_invalid_value("margin-trim", "block block"); +test_invalid_value("margin-trim", "inline inline"); +test_invalid_value("margin-trim", "block inline-start inline-end"); +test_invalid_value("margin-trim", "block block-start block-end"); +test_invalid_value("margin-trim", "block-start block-end block"); +test_invalid_value("margin-trim", "block 10px"); +test_invalid_value("margin-trim", "auto"); +test_invalid_value("margin-trim", "left"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-valid.html b/testing/web-platform/tests/css/css-box/parsing/margin-valid.html new file mode 100644 index 0000000000..154aa2de7c --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/margin-valid.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing margin with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin"> +<meta name="assert" content="margin supports the full grammar '[ <length> | <percentage> | auto]{1,4}'."> +<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("margin", "10px"); +test_valid_value("margin", "20%"); +test_valid_value("margin", "calc(2em + 3ex)"); +test_valid_value("margin", "auto"); +test_valid_value("margin", "-10px"); +test_valid_value("margin", "-20%"); + +test_valid_value("margin", "calc(2em + 3ex) auto"); +test_valid_value("margin", "auto calc(2em + 3ex) 20%"); +test_valid_value("margin", "10px 20% calc(2em + 3ex) auto"); + +test_valid_value("margin-top", "10px"); +test_valid_value("margin-right", "20%"); +test_valid_value("margin-bottom", "calc(2em + 3ex)"); +test_valid_value("margin-left", "auto"); +test_valid_value("margin-top", "-10px"); +test_valid_value("margin-right", "-20%"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/max-height-invalid.html b/testing/web-platform/tests/css/css-box/parsing/max-height-invalid.html new file mode 100644 index 0000000000..aeb6e64808 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/max-height-invalid.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing max-height with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-height"> +<meta name="assert" content="max-height supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'."> +<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("max-height", "complex"); +test_invalid_value("max-height", "auto"); +test_invalid_value("max-height", "none available"); +test_invalid_value("max-height", "max-content 10px"); +test_invalid_value("max-height", "20% available"); + +test_invalid_value("max-height", "-10px"); +test_invalid_value("max-height", "-20%"); +test_invalid_value("max-height", "60"); +test_invalid_value("max-height", "10px 20%"); +test_invalid_value("max-height", "content-box border-box"); +test_invalid_value("max-height", "10px border-box 20%"); +test_invalid_value("max-height", "content-box 20% border-box"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/max-height-valid.html b/testing/web-platform/tests/css/css-box/parsing/max-height-valid.html new file mode 100644 index 0000000000..04880c4903 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/max-height-valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing max-height with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-height"> +<meta name="assert" content="max-height supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'."> +<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("max-height", "none"); + +test_valid_value("max-height", "10px"); +test_valid_value("max-height", "20%"); +test_valid_value("max-height", "calc(2em + 3ex)"); + +test_valid_value("max-height", "min-content"); +test_valid_value("max-height", "max-content"); +test_valid_value("max-height", "fit-content"); + +// The following are not yet supported by browsers: +// test_valid_value("max-height", "available"); +// test_valid_value("max-height", "10px border-box"); +// test_valid_value("max-height", "content-box 20%", "20% content-box"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/max-width-invalid.html b/testing/web-platform/tests/css/css-box/parsing/max-width-invalid.html new file mode 100644 index 0000000000..03db7e2657 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/max-width-invalid.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing max-width with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-width"> +<meta name="assert" content="max-width supports only the grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'."> +<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("max-width", "complex"); +test_invalid_value("max-width", "auto"); +test_invalid_value("max-width", "none available"); +test_invalid_value("max-width", "max-content 10px"); +test_invalid_value("max-width", "20% available"); + +test_invalid_value("max-width", "-10px"); +test_invalid_value("max-width", "-20%"); +test_invalid_value("max-width", "60"); +test_invalid_value("max-width", "10px 20%"); +test_invalid_value("max-width", "content-box border-box"); +test_invalid_value("max-width", "10px border-box 20%"); +test_invalid_value("max-width", "content-box 20% border-box"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/max-width-valid.html b/testing/web-platform/tests/css/css-box/parsing/max-width-valid.html new file mode 100644 index 0000000000..1e08a820d9 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/max-width-valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing max-width with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-max-width"> +<meta name="assert" content="max-width supports the full grammar '[ [<length> | <percentage>] && [border-box | content-box]? ] | available | min-content | max-content | fit-content | none'."> +<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("max-width", "none"); + +test_valid_value("max-width", "10px"); +test_valid_value("max-width", "20%"); +test_valid_value("max-width", "calc(2em + 3ex)"); + +test_valid_value("max-width", "min-content"); +test_valid_value("max-width", "max-content"); +test_valid_value("max-width", "fit-content"); + +// The following are not yet supported by browsers: +// test_valid_value("max-width", "available"); +// test_valid_value("max-width", "10px border-box"); +// test_valid_value("max-width", "content-box 20%", "20% content-box"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/overflow-invalid.html b/testing/web-platform/tests/css/css-box/parsing/overflow-invalid.html new file mode 100644 index 0000000000..4747764fb6 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/overflow-invalid.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing overflow with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-overflow"> +<meta name="assert" content="overflow supports only the grammar '[ visible | hidden | scroll | auto | no-display | no-content ]{1,2}'."> +<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("overflow", "none"); +test_invalid_value("overflow", "visible hidden scroll"); +test_invalid_value("overflow", "no-display, no-content"); + +test_invalid_value("overflow-x", "none"); +test_invalid_value("overflow-y", "visible hidden"); +test_invalid_value("overflow-y", "no-display, no-content"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/overflow-valid.html b/testing/web-platform/tests/css/css-box/parsing/overflow-valid.html new file mode 100644 index 0000000000..1bfeec2364 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/overflow-valid.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing overflow with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-overflow"> +<meta name="assert" content="overflow supports the full grammar '[ visible | hidden | scroll | auto | no-display | no-content ]{1,2}'."> +<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("overflow", "visible"); +test_valid_value("overflow", "hidden"); +test_valid_value("overflow", "scroll"); +test_valid_value("overflow", "auto"); + +test_valid_value("overflow-x", "visible"); +test_valid_value("overflow-x", "hidden"); +test_valid_value("overflow-x", "scroll"); +test_valid_value("overflow-y", "auto"); + +// The following are not yet supported by browsers: +// test_valid_value("overflow", "no-display"); +// test_valid_value("overflow", "no-content"); +// test_valid_value("overflow", "visible hidden"); +// test_valid_value("overflow", "auto scroll"); +// test_valid_value("overflow", "no-display no-content"); +// test_valid_value("overflow-y", "no-display"); +// test_valid_value("overflow-y", "no-content"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/padding-computed.html b/testing/web-platform/tests/css/css-box/parsing/padding-computed.html new file mode 100644 index 0000000000..f1186c4530 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/padding-computed.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: getComputedStyle().padding</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding"> +<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values"> +<meta name="assert" content="padding resolved value is an absolute length."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +<style> + #container { + will-change: transform; /* containing block for #target */ + width: 200px; + } + #parent { + width: 0px; + } + #target { + position: absolute; + font-size: 40px; + } +</style> +</head> +<body> +<div id="container"> + <div id="parent"> + <div id="target"></div> + </div> +</div> +<script> +test_computed_value("padding", "10px"); +test_computed_value("padding", "10px 20px 30px 40px"); + +test_computed_value("padding-top", "10px"); +test_computed_value("padding-right", "20px"); +test_computed_value("padding-bottom", "30px"); +test_computed_value("padding-left", "40px"); + +test_computed_value("padding", "20%", "40px"); +test_computed_value("padding", "10px 20% 30% 40px", "10px 40px 60px"); +test_computed_value("padding-right", "20%", "40px"); + +test_computed_value('padding-top', 'calc(10% - 40px)', '0px'); +test_computed_value('padding-right', 'calc(10% + 40px)', '60px'); +test_computed_value('padding-bottom', 'calc(10px - 0.5em)', '0px'); +test_computed_value('padding-left', 'calc(10px + 0.5em)', '30px'); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/padding-invalid.html b/testing/web-platform/tests/css/css-box/parsing/padding-invalid.html new file mode 100644 index 0000000000..3e3a560c2f --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/padding-invalid.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing padding with invalid values</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding"> +<meta name="assert" content="padding supports only the grammar '<length-percentage>{1,4}'."> +<meta name="assert" content="Negative values 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("padding", "auto"); +test_invalid_value("padding", "available"); +test_invalid_value("padding", "10px border-box"); +test_invalid_value("padding", "calc(2em + 3ex) auto"); +test_invalid_value("padding", "10px 20px 30px 40px 50px"); + +test_invalid_value("padding-top", "auto"); +test_invalid_value("padding-bottom", "10px 20px calc(2em + 3ex) auto"); +test_invalid_value("padding-bottom-left", "10px 20px"); + +test_invalid_value("padding-top", "-10px"); +test_invalid_value("padding-right", "-20%"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/padding-shorthand.html b/testing/web-platform/tests/css/css-box/parsing/padding-shorthand.html new file mode 100644 index 0000000000..dc0139dc47 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/padding-shorthand.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: padding sets longhands</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding"> +<meta name="assert" content="padding supports the full grammar '<length-percentage>{1,4}'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/shorthand-testcommon.js"></script> +</head> +<body> +<script> +test_shorthand_value('padding', '1px 2px 3px 4px', { + 'padding-top': '1px', + 'padding-right': '2px', + 'padding-bottom': '3px', + 'padding-left': '4px' +}); + +test_shorthand_value('padding', '1px 2px 3px', { + 'padding-top': '1px', + 'padding-right': '2px', + 'padding-bottom': '3px', + 'padding-left': '2px' +}); + +test_shorthand_value('padding', '1px 2px', { + 'padding-top': '1px', + 'padding-right': '2px', + 'padding-bottom': '1px', + 'padding-left': '2px' +}); + +test_shorthand_value('padding', '1px', { + 'padding-top': '1px', + 'padding-right': '1px', + 'padding-bottom': '1px', + 'padding-left': '1px' +}); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/padding-valid.html b/testing/web-platform/tests/css/css-box/parsing/padding-valid.html new file mode 100644 index 0000000000..36d158b4d0 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/padding-valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing padding with valid values</title> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-padding"> +<meta name="assert" content="padding supports the full grammar '<length-percentage>{1,4}'."> +<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("padding", "10px"); +test_valid_value("padding", "10px 20px 30px 40px"); +test_valid_value("padding", "calc(2em + 3ex)"); + +test_valid_value("padding-top", "10px"); +test_valid_value("padding-right", "20px"); +test_valid_value("padding-bottom", "30px"); +test_valid_value("padding-left", "40px"); + +test_valid_value("padding", "20%"); +test_valid_value("padding", "10px 20% 30% 40px"); +test_valid_value("padding-right", "20%"); + +// https://drafts.csswg.org/css-values-4/#sort-a-calculations-children +test_valid_value("padding-right", "calc(2em + 3%)", "calc(3% + 2em)"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/visibility-computed.html b/testing/web-platform/tests/css/css-box/parsing/visibility-computed.html new file mode 100644 index 0000000000..f6d4c3f8e5 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/visibility-computed.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: getComputedStyle().visibility</title> +<link rel="help" href="https://www.w3.org/TR/CSS2/visufx.html#visibility"> +<meta name="assert" content="visibility computed value is as specified."> +<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("visibility", "visible"); +test_computed_value("visibility", "hidden"); +test_computed_value("visibility", "collapse"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/visibility-invalid.html b/testing/web-platform/tests/css/css-box/parsing/visibility-invalid.html new file mode 100644 index 0000000000..73e611b2b8 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/visibility-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing visibility with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-visibility"> +<meta name="assert" content="visibility supports only the grammar 'visible | hidden | collapse'."> +<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("visibility", "auto"); +test_invalid_value("visibility", "hidden collapse"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/visibility-valid.html b/testing/web-platform/tests/css/css-box/parsing/visibility-valid.html new file mode 100644 index 0000000000..2ab2f49660 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/visibility-valid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing visibility with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-visibility"> +<meta name="assert" content="visibility supports the full grammar 'visible | hidden | collapse'."> +<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("visibility", "visible"); +test_valid_value("visibility", "hidden"); +test_valid_value("visibility", "collapse"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/width-invalid.html b/testing/web-platform/tests/css/css-box/parsing/width-invalid.html new file mode 100644 index 0000000000..5a0145fe1d --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/width-invalid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing width with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-width"> +<meta name="assert" content="width supports only the grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | auto'."> +<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("width", "complex"); +test_invalid_value("width", "none"); + +test_invalid_value("width", "min-content available"); +test_invalid_value("width", "max-content 10px"); +test_invalid_value("width", "20% available"); + +test_invalid_value("width", "-10px"); +test_invalid_value("width", "-20%"); +test_invalid_value("width", "60"); +test_invalid_value("width", "10px 20%"); + +test_invalid_value("width", "10px border-box"); +test_invalid_value("width", "content-box 20%"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/css-box/parsing/width-valid.html b/testing/web-platform/tests/css/css-box/parsing/width-valid.html new file mode 100644 index 0000000000..93059bd2d3 --- /dev/null +++ b/testing/web-platform/tests/css/css-box/parsing/width-valid.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS basic box model: parsing width with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-width"> +<meta name="assert" content="width supports the full grammar '[<length> | <percentage>] | available | min-content | max-content | fit-content | auto'."> +<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("width", "auto"); + +test_valid_value("width", "10px"); +test_valid_value("width", "20%"); +test_valid_value("width", "calc(2em + 3ex)"); + +test_valid_value("width", "min-content"); +test_valid_value("width", "max-content"); +test_valid_value("width", "fit-content"); + +// The following is not yet supported by browsers: +// test_valid_value("width", "available"); +</script> +</body> +</html> |