From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../css-properties-values-api/resources/utils.js | 241 +++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 testing/web-platform/tests/css/css-properties-values-api/resources/utils.js (limited to 'testing/web-platform/tests/css/css-properties-values-api/resources/utils.js') diff --git a/testing/web-platform/tests/css/css-properties-values-api/resources/utils.js b/testing/web-platform/tests/css/css-properties-values-api/resources/utils.js new file mode 100644 index 0000000000..8cf16e367f --- /dev/null +++ b/testing/web-platform/tests/css/css-properties-values-api/resources/utils.js @@ -0,0 +1,241 @@ +let next_property_id = 1; + +// Generate a unique property name on the form --prop-N. +function generate_name() { + return `--prop-${next_property_id++}`; +} + +// Produce a compatible initial value for the specified syntax. +function any_initial_value(syntax) { + let components = syntax.split('|').map(x => x.trim()) + let first_component = components[0]; + + if (first_component.endsWith('+') || first_component.endsWith('#')) + first_component = first_component.slice(0, -1); + + switch (first_component) { + case '*': + case '': + return 'NULL'; + case '': + return '0deg'; + case '': + return 'rgb(0, 0, 0)'; + case '': + case '': + return 'url(0)'; + case '': + case '': + case '': + case '': + return '0'; + case '': + return '0%'; + case '': + return '0dpi'; + case '