aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-08.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-14.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-24.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-26.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-37.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-53.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-54.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-55.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-03.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-04.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-15.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-18.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-19.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-20.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-26.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-27.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-36.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-38.htm.ini3
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json18
-rw-r--r--tests/wpt/mozilla/meta/css/test_variable_serialization_computed.html.ini56
-rw-r--r--tests/wpt/mozilla/meta/css/test_variable_serialization_specified.html.ini116
-rw-r--r--tests/wpt/mozilla/tests/css/test_variable_legal_values.html119
-rw-r--r--tests/wpt/mozilla/tests/css/test_variable_serialization_computed.html79
-rw-r--r--tests/wpt/mozilla/tests/css/test_variable_serialization_specified.html121
28 files changed, 509 insertions, 66 deletions
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini
deleted file mode 100644
index 87fee1c5ce8..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/css-vars-custom-property-inheritance.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[css-vars-custom-property-inheritance.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-08.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-08.htm.ini
deleted file mode 100644
index 83e66d3a80e..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-08.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-08.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-14.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-14.htm.ini
deleted file mode 100644
index 1b565847071..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-14.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-14.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini
deleted file mode 100644
index e3de1be4109..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-20.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-20.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-24.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-24.htm.ini
deleted file mode 100644
index ba980233612..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-24.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-24.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-26.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-26.htm.ini
deleted file mode 100644
index 98c918745b5..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-26.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-26.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-37.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-37.htm.ini
deleted file mode 100644
index 6c8b66e14c0..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-37.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-37.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-53.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-53.htm.ini
deleted file mode 100644
index bc25e718bd5..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-53.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-53.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-54.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-54.htm.ini
deleted file mode 100644
index 362a722c3e7..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-54.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-54.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-55.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-55.htm.ini
deleted file mode 100644
index ca63a2f84da..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-declaration-55.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-declaration-55.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-03.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-03.htm.ini
deleted file mode 100644
index d845cc12cd8..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-03.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-03.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-04.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-04.htm.ini
deleted file mode 100644
index fba032c2710..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-04.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-04.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini
deleted file mode 100644
index 7f832f8cdac..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-13.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-13.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini
deleted file mode 100644
index dd849805038..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-14.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-14.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-15.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-15.htm.ini
deleted file mode 100644
index 7dcf1687aab..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-15.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-15.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-18.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-18.htm.ini
deleted file mode 100644
index e09c394fc76..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-18.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-18.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-19.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-19.htm.ini
deleted file mode 100644
index 3847b908e1b..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-19.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-19.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-20.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-20.htm.ini
deleted file mode 100644
index 4ab2b3816af..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-20.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-20.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-26.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-26.htm.ini
deleted file mode 100644
index ebd0652279f..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-26.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-26.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-27.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-27.htm.ini
deleted file mode 100644
index 8a36f19f2e7..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-27.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-27.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-36.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-36.htm.ini
deleted file mode 100644
index d052a96d261..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-36.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-36.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-38.htm.ini b/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-38.htm.ini
deleted file mode 100644
index ae8c7dd94be..00000000000
--- a/tests/wpt/metadata-css/css-variables-1_dev/html/variable-reference-38.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[variable-reference-38.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index 9f187275bd7..3cd5550686c 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -281,6 +281,24 @@
]
},
"testharness": {
+ "css/test_variable_legal_values.html": [
+ {
+ "path": "css/test_variable_legal_values.html",
+ "url": "/_mozilla/css/test_variable_legal_values.html"
+ }
+ ],
+ "css/test_variable_serialization_computed.html": [
+ {
+ "path": "css/test_variable_serialization_computed.html",
+ "url": "/_mozilla/css/test_variable_serialization_computed.html"
+ }
+ ],
+ "css/test_variable_serialization_specified.html": [
+ {
+ "path": "css/test_variable_serialization_specified.html",
+ "url": "/_mozilla/css/test_variable_serialization_specified.html"
+ }
+ ],
"mozilla/DOMParser.html": [
{
"path": "mozilla/DOMParser.html",
diff --git a/tests/wpt/mozilla/meta/css/test_variable_serialization_computed.html.ini b/tests/wpt/mozilla/meta/css/test_variable_serialization_computed.html.ini
new file mode 100644
index 00000000000..1e88bbd62e9
--- /dev/null
+++ b/tests/wpt/mozilla/meta/css/test_variable_serialization_computed.html.ini
@@ -0,0 +1,56 @@
+[test_variable_serialization_computed.html]
+ type: testharness
+ [subtest #20 with `--a: var(--b)var(--c); --b:orange; --c:red;`]
+ expected: FAIL
+
+ [subtest #21 with `--a: var(--b)var(--c,red); --b:orange;`]
+ expected: FAIL
+
+ [subtest #22 with `--a: var(--b,orange)var(--c); --c:red;`]
+ expected: FAIL
+
+ [subtest #23 with `counter-reset: var(--a)red; --a:orange;`]
+ expected: FAIL
+
+ [subtest #24 with `--a: var(--b)var(--c); --c:[c\]; --b:('ab`]
+ expected: FAIL
+
+ [subtest #25 with `--a: '`]
+ expected: FAIL
+
+ [subtest #26 with `--a: '\\`]
+ expected: FAIL
+
+ [subtest #27 with `--a: \\`]
+ expected: FAIL
+
+ [subtest #28 with `--a: "`]
+ expected: FAIL
+
+ [subtest #29 with `--a: "\\`]
+ expected: FAIL
+
+ [subtest #30 with `--a: /* abc `]
+ expected: FAIL
+
+ [subtest #31 with `--a: /* abc *`]
+ expected: FAIL
+
+ [subtest #32 with `--a: url(http://example.org/`]
+ expected: FAIL
+
+ [subtest #33 with `--a: url(http://example.org/\\`]
+ expected: FAIL
+
+ [subtest #34 with `--a: url('http://example.org/`]
+ expected: FAIL
+
+ [subtest #35 with `--a: url('http://example.org/\\`]
+ expected: FAIL
+
+ [subtest #36 with `--a: url("http://example.org/`]
+ expected: FAIL
+
+ [subtest #37 with `--a: url("http://example.org/\\`]
+ expected: FAIL
+
diff --git a/tests/wpt/mozilla/meta/css/test_variable_serialization_specified.html.ini b/tests/wpt/mozilla/meta/css/test_variable_serialization_specified.html.ini
new file mode 100644
index 00000000000..b4b7a38b3f5
--- /dev/null
+++ b/tests/wpt/mozilla/meta/css/test_variable_serialization_specified.html.ini
@@ -0,0 +1,116 @@
+[test_variable_serialization_specified.html]
+ type: testharness
+ [`var(--a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a) ` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var( --a ) ` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a, )` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a,/**/a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`1px var(--a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a) 1px` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`something 3px url(whereever) calc(var(--a) + 1px)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a)var(--b)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a, var(--b, var(--c, black)))` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a) <!--` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`--> var(--a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`{ [ var(--a) \] }` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`[;\] var(--a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a,(;))` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`VAR(--a)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--0)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--\\30)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--\\d800)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--\\ffffff)` is unchanged by specified value serialization]
+ expected: FAIL
+
+ [`var(--a` becomes `var(--a)` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a , ` becomes `var(--a , )` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a, ` becomes `var(--a, )` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a, var(--b` becomes `var(--a, var(--b))` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a /* unclosed comment` becomes `var(--a /* unclosed comment*/)` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a /* unclosed comment *` becomes `var(--a /* unclosed comment */)` in specified value serialization]
+ expected: FAIL
+
+ [`[{(((var(--a` becomes `[{(((var(--a))))}\]` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a, "unclosed string` becomes `var(--a, "unclosed string")` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a, 'unclosed string` becomes `var(--a, 'unclosed string')` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) "unclosed string\\` becomes `var(--a) "unclosed string"` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) 'unclosed string\\` becomes `var(--a) 'unclosed string'` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) \\` becomes `var(--a) \\�` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url(unclosedurl` becomes `var(--a) url(unclosedurl)` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url('unclosedurl` becomes `var(--a) url('unclosedurl')` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url("unclosedurl` becomes `var(--a) url("unclosedurl")` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url(unclosedurl\\` becomes `var(--a) url(unclosedurl\\�)` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url('unclosedurl\\` becomes `var(--a) url('unclosedurl')` in specified value serialization]
+ expected: FAIL
+
+ [`var(--a) url("unclosedurl\\` becomes `var(--a) url("unclosedurl")` in specified value serialization]
+ expected: FAIL
+
diff --git a/tests/wpt/mozilla/tests/css/test_variable_legal_values.html b/tests/wpt/mozilla/tests/css/test_variable_legal_values.html
new file mode 100644
index 00000000000..22826c4d29c
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/test_variable_legal_values.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html><head>
+ <title>CSS Variables Allowed Syntax</title>
+ <link href="http://dbaron.org/" rel="author" title="L. David Baron">
+ <link href="http://mozilla.com/" rel="author" title="Mozilla Corporation">
+ <link href="http://www.w3.org/TR/css-variables-1/#defining-variables" rel="help">
+ <meta content='The <value> type used in the syntax above is defined as anything matching the "value" production in CSS 2.1 Chapter 4.1 [CSS21].' name="assert">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+<script id="metadata_cache">/*
+{
+ "percentage": { "assert": "Value allowed within variable: percentage" },
+ "number": { "assert": "Value allowed within variable: number" },
+ "length": { "assert": "Value allowed within variable: length" },
+ "time": { "assert": "Value allowed within variable: time" },
+ "function": { "assert": "Value allowed within variable: function" },
+ "nested_function": { "assert": "Value allowed within variable: nested function" },
+ "parentheses": { "assert": "Value allowed within variable: parentheses" },
+ "braces": { "assert": "Value allowed within variable: braces" },
+ "brackets": { "assert": "Value allowed within variable: brackets" },
+ "at_keyword_unknown": { "assert": "Value allowed within variable: at-keyword (unknown)" },
+ "at_keyword_known": { "assert": "Value allowed within variable: at-keyword (known)" },
+ "at_keyword_unknown_and_block": { "assert": "Value allowed within variable: at-keyword (unknown) and block" },
+ "at_keyword_known_and_block": { "assert": "Value allowed within variable: at-keyword (known) and block" },
+ "unbalanced_close_bracket_at_toplevel": { "assert": "Value not allowed within variable: unbalanced close bracket at toplevel" },
+ "unbalanced_close_paren_at_toplevel": { "assert": "Value not allowed within variable: unbalanced close paren at toplevel" },
+ "unbalanced_close_bracket_in_something_balanced": { "assert": "Value not allowed within variable: unbalanced close bracket in something balanced" },
+ "unbalanced_close_paren_in_something_balanced": { "assert": "Value not allowed within variable: unbalanced close paren in something balanced" },
+ "unbalanced_close_brace_in_something_balanced": { "assert": "Value not allowed within variable: unbalanced close brace in something balanced" },
+ "CDO_at_top_level": { "assert": "Value allowed within variable: CDO at top level" },
+ "CDC_at_top_level": { "assert": "Value allowed within variable: CDC at top level" },
+ "semicolon_not_at_top_level_value_unused": { "assert": "Value allowed within variable: semicolon not at top level (value -> unused)" },
+ "CDO_not_at_top_level_value_unused": { "assert": "Value allowed within variable: CDO not at top level (value -> unused)" },
+ "CDC_not_at_top_level_value_unused": { "assert": "Value allowed within variable: CDC not at top level (value -> unused)" }
+}
+*/</script>
+</head>
+<body onload="run()">
+<div id="log"></div>
+<div id="test"></div>
+<script>
+setup({ "explicit_done": true });
+
+function run() {
+ // Setup the iframe
+ var div = document.getElementById("test");
+ var test_cs = window.getComputedStyle(div, "");
+
+ var initial_cs = test_cs.backgroundColor;
+ div.setAttribute("style", "background-color: green");
+ var green_cs = test_cs.backgroundColor;
+ div.setAttribute("style", "background-color: red");
+ var red_cs = test_cs.backgroundColor;
+
+ function description_to_name(description) {
+ return description.replace(/\W+/g, "_").replace(/^_/, "").replace(/_$/, "");
+ }
+
+ function assert_allowed_variable_value(value, description) {
+ test(function() {
+ div.setAttribute("style",
+ " --test: red;\n" +
+ " --test: " + value + ";\n" +
+ " background-color: red;\n" +
+ " background-color: var(--test);\n" +
+ "");
+ assert_not_equals(initial_cs, red_cs);
+ assert_equals(initial_cs, test_cs.backgroundColor);
+ },
+ description_to_name(description),
+ { assert: "Value allowed within variable: " + description });
+ }
+
+ function assert_disallowed_balanced_variable_value(value, description) {
+ test(function() {
+ div.setAttribute("style",
+ " --test: green;\n" +
+ " --test: " + value + ";\n" +
+ " background-color: red;\n" +
+ " background-color: var(--test);\n" +
+ "");
+ assert_not_equals(green_cs, red_cs);
+ assert_equals(green_cs, test_cs.backgroundColor);
+ },
+ description_to_name(description),
+ { assert: "Value not allowed within variable: " + description });
+ }
+
+ assert_allowed_variable_value("25%", "percentage");
+ assert_allowed_variable_value("37", "number");
+ assert_allowed_variable_value("12em", "length");
+ assert_allowed_variable_value("75ms", "time");
+ assert_allowed_variable_value("foo()", "function");
+ assert_allowed_variable_value("foo(bar())", "nested function");
+ assert_allowed_variable_value("( )", "parentheses");
+ assert_allowed_variable_value("{ }", "braces");
+ assert_allowed_variable_value("[ ]", "brackets");
+ assert_allowed_variable_value("@foobar", "at-keyword (unknown)");
+ assert_allowed_variable_value("@media", "at-keyword (known)");
+ assert_allowed_variable_value("@foobar {}", "at-keyword (unknown) and block");
+ assert_allowed_variable_value("@media {}", "at-keyword (known) and block");
+ assert_disallowed_balanced_variable_value("]", "unbalanced close bracket at toplevel");
+ assert_disallowed_balanced_variable_value(")", "unbalanced close paren at toplevel");
+ assert_disallowed_balanced_variable_value("(])", "unbalanced close bracket in something balanced");
+ assert_disallowed_balanced_variable_value("[)]", "unbalanced close paren in something balanced");
+ assert_disallowed_balanced_variable_value("(})", "unbalanced close brace in something balanced");
+ assert_allowed_variable_value("<!--", "CDO at top level");
+ assert_allowed_variable_value("-->", "CDC at top level");
+ assert_allowed_variable_value("(;)", "semicolon not at top level (value -> unused)");
+ assert_allowed_variable_value("(<!--)", "CDO not at top level (value -> unused)");
+ assert_allowed_variable_value("(-->)", "CDC not at top level (value -> unused)");
+
+ done();
+}
+
+</script>
+
+
+</body></html>
diff --git a/tests/wpt/mozilla/tests/css/test_variable_serialization_computed.html b/tests/wpt/mozilla/tests/css/test_variable_serialization_computed.html
new file mode 100644
index 00000000000..a7f0b63d1c4
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/test_variable_serialization_computed.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<title>Test serialization of computed CSS variable values</title>
+<!--
+
+Adapted from https://dxr.mozilla.org/mozilla-central/source/layout/style/test/test_variable_serialization_computed.html
+
+NOTE: CSS does not define the exact serialization of whitespace and comments
+(see https://drafts.csswg.org/css-syntax/#serialization)
+so an implementation could fail this test but still be conforming.
+
+-->
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div>
+ <span></span>
+</div>
+
+<script>
+// Each entry is an entire declaration followed by the property to check and
+// its expected computed value.
+var values = [
+ ["", "--z", "an-inherited-value"],
+ ["--a: ", "--a", " "],
+ ["--a: initial", "--a", ""],
+ ["--z: initial", "--z", ""],
+ ["--a: inherit", "--a", ""],
+ ["--z: inherit", "--z", "an-inherited-value"],
+ ["--a: unset", "--a", ""],
+ ["--z: unset", "--z", "an-inherited-value"],
+ ["--a: 1px", "--a", " 1px"],
+ ["--a: var(--a)", "--a", ""],
+ ["--a: var(--b)", "--a", ""],
+ ["--a: var(--b); --b: 1px", "--a", " 1px"],
+ ["--a: var(--b, 1px)", "--a", " 1px"],
+ ["--a: var(--a, 1px)", "--a", ""],
+ ["--a: something 3px url(whereever) calc(var(--a) + 1px)", "--a", ""],
+ ["--a: something 3px url(whereever) calc(var(--b,1em) + 1px)", "--a", " something 3px url(whereever) calc(1em + 1px)"],
+ ["--a: var(--b, var(--c, var(--d, Black)))", "--a", " Black"],
+ ["--a: a var(--b) c; --b:b", "--a", " a b c"],
+ ["--a: a var(--b,b var(--c) d) e; --c:c", "--a", " a b c d e"],
+ ["--a: var(--b)red; --b:orange;", "--a", " orange/**/red"],
+ ["--a: var(--b)var(--c); --b:orange; --c:red;", "--a", " orange/**/red"],
+ ["--a: var(--b)var(--c,red); --b:orange;", "--a", " orange/**/red"],
+ ["--a: var(--b,orange)var(--c); --c:red;", "--a", " orange/**/red"],
+ ["counter-reset: var(--a)red; --a:orange;", "counter-reset", "orange 0 red 0"],
+ ["--a: var(--b)var(--c); --c:[c]; --b:('ab", "--a", " ('ab')[c]"],
+ ["--a: '", "--a", " ''"],
+ ["--a: '\\", "--a", " ''"],
+ ["--a: \\", "--a", " \\\ufffd"],
+ ["--a: \"", "--a", " \"\""],
+ ["--a: \"\\", "--a", " \"\""],
+ ["--a: /* abc ", "--a", " /* abc */"],
+ ["--a: /* abc *", "--a", " /* abc */"],
+ ["--a: url(http://example.org/", "--a", " url(http://example.org/)"],
+ ["--a: url(http://example.org/\\", "--a", " url(http://example.org/\\\ufffd)"],
+ ["--a: url('http://example.org/", "--a", " url('http://example.org/')"],
+ ["--a: url('http://example.org/\\", "--a", " url('http://example.org/')"],
+ ["--a: url(\"http://example.org/", "--a", " url(\"http://example.org/\")"],
+ ["--a: url(\"http://example.org/\\", "--a", " url(\"http://example.org/\")"]
+];
+
+var div = document.querySelector("div");
+var span = document.querySelector("span");
+
+div.setAttribute("style", "--z:an-inherited-value");
+
+values.forEach(function(entry, i) {
+ var declaration = entry[0];
+ var property = entry[1];
+ var expected = entry[2];
+ test(function() {
+ span.setAttribute("style", declaration);
+ var cs = getComputedStyle(span, "");
+ assert_equals(cs.getPropertyValue(property), expected);
+ }, "subtest #" + i + " with `" + declaration + "`");
+});
+</script>
diff --git a/tests/wpt/mozilla/tests/css/test_variable_serialization_specified.html b/tests/wpt/mozilla/tests/css/test_variable_serialization_specified.html
new file mode 100644
index 00000000000..cbb9e01e3fb
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/test_variable_serialization_specified.html
@@ -0,0 +1,121 @@
+<!DOCTYPE html>
+<title>Test serialization of specified CSS variable values</title>
+<!--
+
+Adapted from https://dxr.mozilla.org/mozilla-central/source/layout/style/test/test_variable_serialization_specified.html
+
+NOTE: CSS does not define the exact serialization of whitespace and comments
+(see https://drafts.csswg.org/css-syntax/#serialization)
+so an implementation could fail this test but still be conforming.
+
+-->
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div id=div1></div>
+
+<script>
+// Values that should be serialized back to the same string.
+var values_with_unchanged_specified_value_serialization = [
+ "var(--a)",
+ "var(--a)",
+ "var(--a) ",
+ "var( --a ) ",
+ "var(--a, )",
+ "var(--a,/**/a)",
+ "1px var(--a)",
+ "var(--a) 1px",
+ "something 3px url(whereever) calc(var(--a) + 1px)",
+ "var(--a)",
+ "var(--a)var(--b)",
+ "var(--a, var(--b, var(--c, black)))",
+ "var(--a) <!--",
+ "--> var(--a)",
+ "{ [ var(--a) ] }",
+ "[;] var(--a)",
+ "var(--a,(;))",
+ "VAR(--a)",
+ "var(--0)",
+ "var(--\\30)",
+ "var(--\\d800)",
+ "var(--\\ffffff)",
+];
+
+// Values that serialize differently, due to additional implied closing
+// characters at EOF.
+var values_with_changed_specified_value_serialization = [
+ ["var(--a", "var(--a)"],
+ ["var(--a , ", "var(--a , )"],
+ ["var(--a, ", "var(--a, )"],
+ ["var(--a, var(--b", "var(--a, var(--b))"],
+ ["var(--a /* unclosed comment", "var(--a /* unclosed comment*/)"],
+ ["var(--a /* unclosed comment *", "var(--a /* unclosed comment */)"],
+ ["[{(((var(--a", "[{(((var(--a))))}]"],
+ ["var(--a, \"unclosed string", "var(--a, \"unclosed string\")"],
+ ["var(--a, 'unclosed string", "var(--a, 'unclosed string')"],
+ ["var(--a) \"unclosed string\\", "var(--a) \"unclosed string\""],
+ ["var(--a) 'unclosed string\\", "var(--a) 'unclosed string'"],
+ ["var(--a) \\", "var(--a) \\\ufffd"],
+ ["var(--a) url(unclosedurl", "var(--a) url(unclosedurl)"],
+ ["var(--a) url('unclosedurl", "var(--a) url('unclosedurl')"],
+ ["var(--a) url(\"unclosedurl", "var(--a) url(\"unclosedurl\")"],
+ ["var(--a) url(unclosedurl\\", "var(--a) url(unclosedurl\\\ufffd)"],
+ ["var(--a) url('unclosedurl\\", "var(--a) url('unclosedurl')"],
+ ["var(--a) url(\"unclosedurl\\", "var(--a) url(\"unclosedurl\")"],
+];
+
+var div1 = document.getElementById("div1");
+
+function test_specified_value_serialization(value, expected) {
+ // Test setting value on a custom property with setProperty.
+ div1.style.setProperty("--test", value, "");
+ assert_equals(div1.style.getPropertyValue("--test"), expected,
+ "value with identical serialization set on custom property with setProperty");
+
+ // Test setting value on a custom property via style sheet parsing.
+ div1.setAttribute("style", "--test:" + value);
+ assert_equals(div1.style.getPropertyValue("--test"), expected,
+ "value with identical serialization set on custom property via parsing");
+
+ // Test setting value on a non-custom longhand property with setProperty.
+ div1.style.setProperty("color", value, "");
+ assert_equals(div1.style.getPropertyValue("color"), expected,
+ "value with identical serialization set on non-custom longhand property with setProperty");
+
+ // Test setting value on a non-custom longhand property via style sheet parsing.
+ div1.setAttribute("style", "color:" + value);
+ assert_equals(div1.style.getPropertyValue("color"), expected,
+ "value with identical serialization set on non-custom longhand property via parsing");
+
+ // Test setting value on a non-custom shorthand property with setProperty.
+ div1.style.setProperty("margin", value, "");
+ assert_equals(div1.style.getPropertyValue("margin"), expected,
+ "value with identical serialization set on non-custom shorthand property with setProperty");
+
+ // Test setting value on a non-custom shorthand property via style sheet parsing.
+ div1.setAttribute("style", "margin:" + value);
+ assert_equals(div1.style.getPropertyValue("margin"), expected,
+ "value with identical serialization set on non-custom shorthand property via parsing");
+
+ // Clean up.
+ div1.style.removeProperty("--test");
+ div1.style.removeProperty("color");
+ div1.style.removeProperty("margin");
+}
+
+/*
+function test(f) { f() }
+function assert_equals(a, b, m) { if (a == b) { console.log("`"+a+"`", "`"+b+"`", m) } }
+*/
+
+values_with_unchanged_specified_value_serialization.forEach(function(value) {
+ test(function() { test_specified_value_serialization(value, value) },
+ "`" + value + "` is unchanged by specified value serialization");
+});
+
+values_with_changed_specified_value_serialization.forEach(function(pair) {
+ test(function() { test_specified_value_serialization(pair[0], pair[1]) },
+ "`" + pair[0] + "` becomes `" + pair[1] + "` in specified value serialization");
+});
+</script>