diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/css/css-layout-api')
22 files changed, 747 insertions, 24 deletions
diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-htb-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-htb-vrl.https.html index 602536c5814..0da20ee8371 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-htb-vrl.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-htb-vrl.https.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <html class=reftest-wait> -<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> -<link rel="match" href="green-square-ref.html"> -<meta name="assert" content="This test checks that setting the available inline size of children works as expected." /> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the available block-size of children works as expected." /> <style> .test { @@ -61,5 +61,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-invalid.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-invalid.https.html new file mode 100644 index 00000000000..dfbc812556f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-invalid.https.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting an invalid available block-size works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: vertical-rl; + visibility: hidden; + line-height: 0; + + --available-block-size: -20; +} + +.inline { + display: inline-block; + width: 8px; +} + +.inline-size-10 { height: 10px; } + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- The invalid available block-size should be clamped to zero. --> + <div class="child" style="--block-size-expected: 10; --inline-size-expected: 16;"> + <span class="inline inline-size-10"></span> + <span class="inline inline-size-10"></span> + </div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-vrl-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-vrl-htb.https.html index 4759c1b69d0..c8e84ae5170 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-vrl-htb.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-block-size-vrl-htb.https.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <html class=reftest-wait> -<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> -<link rel="match" href="green-square-ref.html"> -<meta name="assert" content="This test checks that setting the available inline size of children works as expected." /> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the available block-size of children works as expected." /> <style> .test { @@ -61,5 +61,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-htb-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-htb-htb.https.html index bfe8a99e7fe..94cf75fc93f 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-htb-htb.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-htb-htb.https.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <html class=reftest-wait> <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> -<link rel="match" href="green-square-ref.html"> -<meta name="assert" content="This test checks that setting the available inline size of children works as expected." /> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the available inline-size of children works as expected." /> <style> .test { @@ -61,5 +61,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-invalid.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-invalid.https.html new file mode 100644 index 00000000000..136d13fa703 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-invalid.https.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting an invalid available inline-size works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: horizontal-tb; + visibility: hidden; + line-height: 0; + + --available-inline-size: -20; +} + +.inline { + display: inline-block; + height: 8px; +} + +.inline-size-10 { width: 10px; } + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- The invalid available inline-size should be clamped to zero. --> + <div class="child" style="--inline-size-expected: 10; --block-size-expected: 16;"> + <span class="inline inline-size-10"></span> + <span class="inline inline-size-10"></span> + </div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-vrl-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-vrl-vrl.https.html index 7bfa44db67b..392a6b51422 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-available-inline-size-vrl-vrl.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-inline-size-vrl-vrl.https.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <html class=reftest-wait> <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> -<link rel="match" href="green-square-ref.html"> -<meta name="assert" content="This test checks that setting the available inline size of children works as expected." /> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the available inline-size of children works as expected." /> <style> .test { @@ -61,5 +61,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-htb.https.html new file mode 100644 index 00000000000..960fb7d7dcf --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-htb.https.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that resolving percentages against the available size works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: horizontal-tb; + visibility: hidden; + + --available-inline-size: 50; + --available-block-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width/height shouldn't be affected by the available size. --> + <div class="child" style="width: 10px; height: 10px;"></div> + + <!-- A percentage width/height should resolve itself against the available size. --> + <div class="child" style="width: 20%; height: 50%;"></div> + + <!-- A percentage max-width/max-height should resolve itself against the available size. --> + <div class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-width/min-height should resolve itself against the available size. --> + <div class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage width/height should resolve itself against the available size. --> + <img class="child" style="width: 20%; height: 50%;" /> + + <!-- A replaced percentage max-width/max-height should resolve itself against the available size. --> + <img class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-width/min-height should resolve itself against the available size. --> + <img class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-vrl.https.html new file mode 100644 index 00000000000..0e9b5570abe --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-htb-vrl.https.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that resolving percentages against the available size works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: vertical-rl; + visibility: hidden; + + --available-inline-size: 50; + --available-block-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width/height shouldn't be affected by the available size. --> + <div class="child" style="width: 10px; height: 10px;"></div> + + <!-- A percentage width/height should resolve itself against the available size. --> + <div class="child" style="width: 20%; height: 50%;"></div> + + <!-- A percentage max-width/max-height should resolve itself against the available size. --> + <div class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-width/min-height should resolve itself against the available size. --> + <div class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage width/height should resolve itself against the available size. --> + <img class="child" style="width: 20%; height: 50%;" /> + + <!-- A replaced percentage max-width/max-height should resolve itself against the available size. --> + <img class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-width/min-height should resolve itself against the available size. --> + <img class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-invalid.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-invalid.https.html new file mode 100644 index 00000000000..62efe992fb3 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-invalid.https.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that resolving percentages against an invalid available size works as expected." /> + +<style> +.test { + background: red; + width: 100px; +} + +.child { + visibility: hidden; + width: 10px; + line-height: 0; + + --available-inline-size: -20; + --available-block-size: -10; +} + +.inline { + display: inline-block; + width: 10px; + height: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- The available inline-size gets clamped to zero, and the available block-size gets treated as indefinite. --> + <div class="child" style="--inline-size-expected: 0px; --block-size-expected: 10px; width: 100%; height: 100%;"> + <div class="inline"></div> + </div> + + <!-- For replaced elements, both axis should be resolved to 0px. --> + <img class="child" style="--inline-size-expected: 0px; --block-size-expected: 0px; width: 100%; height: 100%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-htb.https.html new file mode 100644 index 00000000000..1352ea91783 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-htb.https.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that resolving percentages against the available size works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + height: 100px; +} + +.child { + writing-mode: horizontal-tb; + visibility: hidden; + + --available-inline-size: 20; + --available-block-size: 50; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width/height shouldn't be affected by the available size. --> + <div class="child" style="width: 10px; height: 10px;"></div> + + <!-- A percentage width/height should resolve itself against the available size. --> + <div class="child" style="width: 20%; height: 50%;"></div> + + <!-- A percentage max-width/max-height should resolve itself against the available size. --> + <div class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-width/min-height should resolve itself against the available size. --> + <div class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage width/height should resolve itself against the available size. --> + <img class="child" style="width: 20%; height: 50%;" /> + + <!-- A replaced percentage max-width/max-height should resolve itself against the available size. --> + <img class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-width/min-height should resolve itself against the available size. --> + <img class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-vrl.https.html new file mode 100644 index 00000000000..9c30c212fae --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/available-size-for-percentages-vrl-vrl.https.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that resolving percentages against the available size works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + height: 100px; +} + +.child { + writing-mode: vertical-rl; + visibility: hidden; + + --available-inline-size: 20; + --available-block-size: 50; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width/height shouldn't be affected by the available size. --> + <div class="child" style="width: 10px; height: 10px;"></div> + + <!-- A percentage width/height should resolve itself against the available size. --> + <div class="child" style="width: 20%; height: 50%;"></div> + + <!-- A percentage max-width/max-height should resolve itself against the available size. --> + <div class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-width/min-height should resolve itself against the available size. --> + <div class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage width/height should resolve itself against the available size. --> + <img class="child" style="width: 20%; height: 50%;" /> + + <!-- A replaced percentage max-width/max-height should resolve itself against the available size. --> + <img class="child" style="width: 15px; max-width: 20%; height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-width/min-height should resolve itself against the available size. --> + <img class="child" style="width: 5px; min-width: 20%; height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-block-size-vrl.https.html index 43dd483b3f9..dedcaa0ee83 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size-vrl.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-block-size-vrl.https.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html class=reftest-wait> -<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> -<link rel="match" href="green-square-ref.html"> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedblocksize"> +<link rel="match" href="../green-square-ref.html"> <meta name="assert" content="This test checks that fixing the block size of children works as expected." /> <style> @@ -56,5 +56,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-block-size.https.html index c714e1ff975..eea540ca59f 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-block-size.https.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html class=reftest-wait> <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedblocksize"> -<link rel="match" href="green-square-ref.html"> +<link rel="match" href="../green-square-ref.html"> <meta name="assert" content="This test checks that fixing the block size of children works as expected." /> <style> @@ -55,5 +55,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-inline-size-vrl.https.html index ba86d2c184d..22bd3e7c125 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size-vrl.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-inline-size-vrl.https.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html class=reftest-wait> <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> -<link rel="match" href="green-square-ref.html"> +<link rel="match" href="../green-square-ref.html"> <meta name="assert" content="This test checks that fixing the inline size of children works as expected." /> <style> @@ -56,5 +56,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-inline-size.https.html index a2a422bd611..0a05a46fe69 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size.https.html +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/fixed-inline-size.https.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html class=reftest-wait> <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> -<link rel="match" href="green-square-ref.html"> +<link rel="match" href="../green-square-ref.html"> <meta name="assert" content="This test checks that fixing the inline size of children works as expected." /> <style> @@ -55,5 +55,5 @@ </div> <script> -importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'}); +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); </script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-htb.https.html new file mode 100644 index 00000000000..99224c73f5b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-htb.https.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the percentage block-size of children works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: horizontal-tb; + visibility: hidden; + width: 10px; + + --percentage-block-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed height shouldn't be affected by the percentage size. --> + <div class="child" style="height: 10px;"></div> + + <!-- A percentage height should resolve itself against the percentageBlockSize. --> + <div class="child" style="height: 50%;"></div> + + <!-- A percentage max-height should resolve itself against the percentageBlockSize. --> + <div class="child" style="height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-height should resolve itself against the percentageBlockSize. --> + <div class="child" style="height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage height should resolve itself against the percentageBlockSize. --> + <img class="child" style="height: 50%;" /> + + <!-- A replaced percentage max-height should resolve itself against the percentageBlockSize. --> + <img class="child" style="height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-height should resolve itself against the percentageBlockSize. --> + <img class="child" style="height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-vrl.https.html new file mode 100644 index 00000000000..8116d5a9b08 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-htb-vrl.https.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageinlinesize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the percentage inline-size of children works as expected." /> + +<style> +.test { + writing-mode: horizontal-tb; + background: red; + width: 100px; +} + +.child { + writing-mode: vertical-rl; + visibility: hidden; + height: 10px; + + --percentage-inline-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width shouldn't be affected by the percentage size. --> + <div class="child" style="width: 10px;"></div> + + <!-- A percentage width should resolve itself against the percentageInlineSize. --> + <div class="child" style="width: 50%;"></div> + + <!-- A percentage max-width should resolve itself against the percentageInlineSize. --> + <div class="child" style="width: 15px; max-width: 50%;"></div> + + <!-- A percentage min-width should resolve itself against the percentageInlineSize. --> + <div class="child" style="width: 5px; min-width: 50%;"></div> + + <!-- A replaced percentage width should resolve itself against the percentageInlineSize. --> + <img class="child" style="width: 50%;" /> + + <!-- A replaced percentage max-width should resolve itself against the percentageInlineSize. --> + <img class="child" style="width: 15px; max-width: 50%;" /> + + <!-- A replaced percentage min-width should resolve itself against the percentageInlineSize. --> + <img class="child" style="width: 5px; min-width: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-invalid.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-invalid.https.html new file mode 100644 index 00000000000..932380a6163 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-invalid.https.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting an invalid percentage block-size of children works as expected." /> + +<style> +.test { + background: red; + width: 100px; +} + +.child { + visibility: hidden; + width: 10px; + line-height: 0; + + --percentage-block-size: -10; +} + +.inline { + display: inline-block; + width: 10px; + height: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A percentage shouldn't be resolved against an invalid percentageBlockSize. --> + <div class="child" style="--inline-size-expected: 10px; --block-size-expected: 10px; height: 100%;"> + <div class="inline"></div> + </div> + + <!-- A percentage shouldn't be resolved against an invalid percentageBlockSize. --> + <img class="child" style="--inline-size-expected: 10px; --block-size-expected: 0px; height: 100%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-quirks-mode.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-quirks-mode.https.html new file mode 100644 index 00000000000..39a360d079d --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-quirks-mode.https.html @@ -0,0 +1,55 @@ +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting a percentage block-size works correctly in quirks mode." /> + +<style> +.container { + height: 200px; +} + +.test { + background: red; + width: 100px; +} + +.child { + visibility: hidden; + width: 10px; + line-height: 0; +} + +.inline { + display: inline-block; + width: 10px; + height: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="container"> + <div class="test"> + <!-- TODO explain. --> + <div class="child" style="--percentage-block-size: 50px; --inline-size-expected: 10px; --block-size-expected: 10px;"> + <div style="height: 20%"></div> + </div> + + <!-- TODO explain. --> + <div class="child" style="--inline-size-expected: 10px; --block-size-expected: 10px;"> + <div style="height: 100%"> + <div class="inline"></div> + </div> + </div> + </div> +</div> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-htb.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-htb.https.html new file mode 100644 index 00000000000..70640ef0b29 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-htb.https.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageinlinesize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the percentage inline-size of children works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + height: 100px; +} + +.child { + writing-mode: horizontal-tb; + visibility: hidden; + width: 10px; + + --percentage-inline-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed height shouldn't be affected by the percentage size. --> + <div class="child" style="height: 10px;"></div> + + <!-- A percentage height should resolve itself against the percentageInlineSize. --> + <div class="child" style="height: 50%;"></div> + + <!-- A percentage max-height should resolve itself against the percentageInlineSize. --> + <div class="child" style="height: 15px; max-height: 50%;"></div> + + <!-- A percentage min-height should resolve itself against the percentageInlineSize. --> + <div class="child" style="height: 5px; min-height: 50%;"></div> + + <!-- A replaced percentage height should resolve itself against the percentageInlineSize. --> + <img class="child" style="height: 50%;" /> + + <!-- A replaced percentage max-height should resolve itself against the percentageInlineSize. --> + <img class="child" style="height: 15px; max-height: 50%;" /> + + <!-- A replaced percentage min-height should resolve itself against the percentageInlineSize. --> + <img class="child" style="height: 5px; min-height: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-vrl.https.html new file mode 100644 index 00000000000..07132579621 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/child-constraints/percentage-size-vrl-vrl.https.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageblocksize"> +<link rel="match" href="../green-square-ref.html"> +<meta name="assert" content="This test checks that setting the percentage block-size of children works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + height: 100px; +} + +.child { + writing-mode: vertical-rl; + visibility: hidden; + height: 10px; + + --percentage-block-size: 20; + + --inline-size-expected: 10px; + --block-size-expected: 10px; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <!-- A fixed width shouldn't be affected by the percentage size. --> + <div class="child" style="width: 10px;"></div> + + <!-- A percentage width should resolve itself against the percentageBlockSize. --> + <div class="child" style="width: 50%;"></div> + + <!-- A percentage max-width should resolve itself against the percentageBlockSize. --> + <div class="child" style="width: 15px; max-width: 50%;"></div> + + <!-- A percentage min-width should resolve itself against the percentageBlockSize. --> + <div class="child" style="width: 5px; min-width: 50%;"></div> + + <!-- A replaced percentage width should resolve itself against the percentageBlockSize. --> + <img class="child" style="width: 50%;" /> + + <!-- A replaced percentage max-width should resolve itself against the percentageBlockSize. --> + <img class="child" style="width: 15px; max-width: 50%;" /> + + <!-- A replaced percentage min-width should resolve itself against the percentageBlockSize. --> + <img class="child" style="width: 5px; min-width: 50%;" /> +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: '../support/layout-child-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-sizes-worklet.js b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-sizes-worklet.js index 7531f69b1b6..28546d6e422 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-sizes-worklet.js +++ b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-sizes-worklet.js @@ -13,6 +13,8 @@ registerLayout('test', class { '--available-block-size', '--fixed-inline-size', '--fixed-block-size', + '--percentage-inline-size', + '--percentage-block-size', '--inline-size-expected', '--block-size-expected' ]; @@ -26,11 +28,15 @@ registerLayout('test', class { const availableBlockSize = parseNumber(child.styleMap.get('--available-block-size')); const fixedInlineSize = parseNumber(child.styleMap.get('--fixed-inline-size')); const fixedBlockSize = parseNumber(child.styleMap.get('--fixed-block-size')); + const percentageInlineSize = parseNumber(child.styleMap.get('--percentage-inline-size')); + const percentageBlockSize = parseNumber(child.styleMap.get('--percentage-block-size')); return child.layoutNextFragment({ availableInlineSize, availableBlockSize, fixedInlineSize, - fixedBlockSize + fixedBlockSize, + percentageInlineSize, + percentageBlockSize, }); }); |