10BC0 Re-import css/css-fonts/parsing · WebKit/WebKit@ae00dca · GitHub
[go: up one dir, main page]

Skip to content

Commit ae00dca

Browse files
committed
Re-import css/css-fonts/parsing
https://bugs.webkit.org/show_bug.cgi?id=250324 rdar://problem/104032354 Reviewed by Tim Nguyen. Upstream revision: web-platform-tests/wpt@8c1683d Re-importing css/css-fonts/parsing WPT tests and updating expected values so we can keep track and fix them. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-alternates-invalid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-alternates-invalid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-alternates-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-alternates-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-computed-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-computed.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-invalid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-invalid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-emoji-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-serialization-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-serialization.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-variant-valid.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/w3c-import.log: Canonical link: https://commits.webkit.org/258677@main
1 parent ab6bfa2 commit ae00dca

21 files changed

+354
-24
lines changed

LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ PASS Check that src: url("foo.ttf") format("embedded-opentype"), url("bar.html")
2626
PASS Check that src: url("foo.ttf") format(embedded-opentype), url("bar.html") is valid
2727
PASS Check that src: url("foo.ttf") format("svg"), url("bar.html") is valid
2828
PASS Check that src: url("foo.ttf") format(svg), url("bar.html") is valid
29-
PASS Check that src: url("foo.ttf") format(xyzz 200px), url("bar.html") is invalid
30-
PASS Check that src: url("foo.ttf") format(xyzz), url("bar.html") is invalid
31-
PASS Check that src: url("foo.ttf") dummy(xyzzy), url("bar.html") is invalid
32-
PASS Check that src: url("foo.ttf") format(), url("bar.html") is invalid
33-
PASS Check that src: url("foo.ttf") format(none), url("bar.html") is invalid
29+
FAIL Check that src: url("foo.ttf") format(xyzz 200px), url("bar.html") is valid assert_equals: expected true but got false
30+
FAIL Check that src: url("foo.ttf") format(xyzz), url("bar.html") is valid assert_equals: expected true but got false
31+
FAIL Check that src: url("foo.ttf") dummy(xyzzy), url("bar.html") is valid assert_equals: expected true but got false
32+
FAIL Check that src: url("foo.ttf") format(), url("bar.html") is valid assert_equals: expected true but got false
33+
FAIL Check that src: url("foo.ttf") format(none), url("bar.html") is valid assert_equals: expected true but got false
3434

LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
{ src: 'url("foo.ttf") format(embedded-opentype), url("bar.html")', valid: true },
4747
{ src: 'url("foo.ttf") format("svg"), url("bar.html")', valid: true },
4848
{ src: 'url("foo.ttf") format(svg), url("bar.html")', valid: true },
49-
// Hard parsing errors should make the line invalid.
50-
{ src: 'url("foo.ttf") format(xyzz 200px), url("bar.html")', valid: false },
51-
{ src: 'url("foo.ttf") format(xyzz), url("bar.html")', valid: false },
52-
{ src: 'url("foo.ttf") dummy(xyzzy), url("bar.html")', valid: false },
53-
{ src: 'url("foo.ttf") format(), url("bar.html")', valid: false },
54-
{ src: 'url("foo.ttf") format(none), url("bar.html")', valid: false },
49+
// A parsing error in one component does not make the entire descriptor invalid.
50+
{ src: 'url("foo.ttf") format(xyzz 200px), url("bar.html")', valid: true },
51+
{ src: 'url("foo.ttf") format(xyzz), url("bar.html")', valid: true },
52+
{ src: 'url("foo.ttf") dummy(xyzzy), url("bar.html")', valid: true },
53+
{ src: 'url("foo.ttf") format(), url("bar.html")', valid: true },
54+
{ src: 'url("foo.ttf") format(none), url("bar.html")', valid: true },
5555
];
5656

5757
for (let t of tests) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
PASS Check that src: local(inherit), url(foo.ttf) is valid
3+
PASS Check that src: local("myfont"), local(unset) is valid
4+
FAIL Check that src: local(), url(foo.ttf) is valid assert_equals: expected true but got false
5+
FAIL Check that src: local(12px monospace), url(foo.ttf) is valid assert_equals: expected true but got false
6+
FAIL Check that src: local("myfont") format(opentype), url(foo.ttf) is valid assert_equals: expected true but got false
7+
FAIL Check that src: url(not a valid url/bar.ttf), url(foo.ttf) is valid assert_equals: expected true but got false
8+
FAIL Check that src: url(foo.ttf) format(bad), url(foo.ttf) is valid assert_equals: expected true but got false
9+
FAIL Check that src: url(foo.ttf) tech(unknown), url(foo.ttf) is valid assert_equals: expected true but got false
10+
FAIL Check that src: url(foo.ttf), url(something.ttf) format(broken) is valid assert_equals: expected true but got false
11+
FAIL Check that src: /* an empty component */, url(foo.ttf) is valid assert_equals: expected true but got false
12+
FAIL Check that src: local(""), url(foo.ttf), unparseable-garbage, local("another font name") is valid assert_equals: expected true but got false
13+
PASS Check that src: local(), local(initial) is invalid
14+
PASS Check that src: local("textfont") format(opentype), local("emoji") tech(color-COLRv0) is invalid
15+
PASS Check that src: local(), /*empty*/, url(should be quoted.ttf), junk is invalid
16+
PASS Check that src: url(foo.ttf) format(unknown), url(bar.ttf) tech(broken) is invalid
17+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<title>CSS Fonts 4 test: parsing the src descriptor list</title>
3+
<meta name="assert" content="A parse error in one component of the source list does not invalidate the entire descriptor">
4+
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-face-src-parsing">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<style id="testStyle">
8+
</style>
9+
<script>
10+
const sheet = testStyle.sheet;
11+
tests = [
12+
// A component with a parse error does not invalidate the entire descriptor
13+
// if there's some other valid component present.
14+
{ src: 'local(inherit), url(foo.ttf)', valid: true },
15+
{ src: 'local("myfont"), local(unset)', valid: true },
16+
{ src: 'local(), url(foo.ttf)', valid: true },
17+
{ src: 'local(12px monospace), url(foo.ttf)', valid: true },
18+
{ src: 'local("myfont") format(opentype), url(foo.ttf)', valid: true },
19+
{ src: 'url(not a valid url/bar.ttf), url(foo.ttf)', valid: true },
20+
{ src: 'url(foo.ttf) format(bad), url(foo.ttf)', valid: true },
21+
{ src: 'url(foo.ttf) tech(unknown), url(foo.ttf)', valid: true },
22+
{ src: 'url(foo.ttf), url(something.ttf) format(broken)', valid: true },
23+
{ src: '/* an empty component */, url(foo.ttf)', valid: true },
24+
{ src: 'local(""), url(foo.ttf), unparseable-garbage, local("another font name")', valid: true },
25+
// But if all components are bad, the descriptor is invalid.
26+
{ src: 'local(), local(initial)', valid: false },
27+
{ src: 'local("textfont") format(opentype), local("emoji") tech(color-COLRv0)', valid: false },
28+
{ src: 'local(), /*empty*/, url(should be quoted.ttf), junk', valid: false },
29+
{ src: 'url(foo.ttf) format(unknown), url(bar.ttf) tech(broken)', valid: false },
30+
];
31+
32+
for (let t of tests) {
33+
test(() => {
34+
assert_equals(sheet.cssRules.length, 0, "testSheet should initially be empty");
35+
sheet.insertRule("@font-face { src: " + t.src + "}");
36+
try {
37+
assert_equals(sheet.cssRules[0].style.getPropertyValue("src") != "", t.valid);
38+
} finally {
39+
sheet.deleteRule(0);
40+
}
41+
}, "Check that src: " + t.src + " is " + (t.valid ? "valid" : "invalid"));
42+
}
43+
</script>

LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ FAIL Check that src: url("foo.ttf") tech(features-graphite), url("bar.html") is
3434
PASS Check that src: url("foo.ttf") dummy("opentype") tech(variations) is invalid
3535
PASS Check that src: url("foo.ttf") dummy("opentype") dummy(variations) is invalid
3636
PASS Check that src: url("foo.ttf") format(opentype) tech(features-opentype) dummy(something) is invalid
37-
PASS Check that src: url("foo.ttf") format(dummy), url("foo.ttf") tech(variations) is invalid
38-
PASS Check that src: url("foo.ttf") tech(color, url("bar.html") is invalid
37+
FAIL Check that src: url("foo.ttf") format(dummy), url("foo.ttf") tech(variations) is valid assert_equals: expected true but got false
38+
FAIL Check that src: url("foo.ttf") tech(color), url("bar.html") is valid assert_equals: expected true but got false
3939

LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@
5353
{ src: 'url("foo.ttf") dummy("opentype") tech(variations)', valid: false },
5454
{ src: 'url("foo.ttf") dummy("opentype") dummy(variations)', valid: false },
5555
{ src: 775E 'url("foo.ttf") format(opentype) tech(features-opentype) dummy(something)', valid: false },
56-
// Valid value after unparseable value must be ignored.
57-
{ src: 'url("foo.ttf") format(dummy), url("foo.ttf") tech(variations)', valid: false },
58-
{ src: 'url("foo.ttf") tech(color, url("bar.html")', valid: false },
56+
// A parsing error in one component does not make the entire descriptor invalid.
57+
{ src: 'url("foo.ttf") format(dummy), url("foo.ttf") tech(variations)', valid: true },
58+
// check_same_tech isn't currently smart enough to handle this.
59+
{ src: 'url("foo.ttf") tech(color), url("bar.html")', dontcomparetech: true, valid: true },
5960
];
6061

6162
// Assert that the two arguments have the same set of keywords in the tech() function,
@@ -69,7 +70,9 @@
6970
const tech = /tech\((.+)\)/;
7071
var specified_techs = tech.exec(specified)[1].split(/,\s*/).sort().join(", ");
7172
var serialized_techs = tech.exec(serialized)[1].split(/,\s*/).sort().join(", ");
72-
assert_equals(serialized_techs, specified_techs, "expected matching tech() lists");
73+
// Per CSSOM spec, keywords are serialized in ASCII-lowercase form:
74+
// https://drafts.csswg.org/cssom/#serialize-a-css-component-value
75+
assert_equals(serialized_techs, specified_techs.toLowerCase(), "expected matching tech() lists");
7376
}
7477

7578
for (let t of tests) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
PASS e.style['font-variant-alternates'] = "swash(several,different,aliases)" should not set the property value
3+
PASS e.style['font-variant-alternates'] = "stylistic(more,than,one)" should not set the property value
4+
PASS e.style['font-variant-alternates'] = "ornaments(more,than,one)" should not set the property value
5+
PASS e.style['font-variant-alternates'] = "swash(more,than,one)" should not set the property value
6+
PASS e.style['font-variant-alternates'] = "annotation(more,than,one)" should not set the property value
7+
PASS e.style['font-variant-alternates'] = "historical-forms(argument)" should not set the property value
8+
PASS e.style['font-variant-alternates'] = "annotation()" should not set the property value
9+
PASS e.style['font-variant-alternates'] = "annotation" should not set the property value
10+
PASS e.style['font-variant-alternates'] = "swash" should not set the property value
11+
PASS e.style['font-variant-alternates'] = "ornaments stylistic" should not set the property value
12+
PASS e.style['font-variant-alternates'] = "swash(one) swash(two)" should not set the property value
13+
PASS e.style['font-variant-alternates'] = "unkown(one) myfunction(two)" should not set the property value
14+
PASS e.style['font-variant-alternates'] = "styleset(thisone) styleset(something,else)" should not set the property value
15+
PASS e.style['font-variant-alternates'] = "swash(foo) swash(bar)" should not set the property value
16+
PASS e.style['font-variant-alternates'] = "ornaments(one historical-forms" should not set the property value
17+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>
6+
CSS Fonts Module Level 4: parsing font-variant-alternates with invalid values
7+
</title>
8+
<link
9+
rel="help"
10+
href="https://drafts.csswg.org/css-fonts-4/#propdef-font-variant-alternates"
11+
/>
12+
<meta
13+
name="assert"
14+
content="font-variant-alternates supports only the grammar normal | [ stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) ]"
15+
/>
16+
<script src="/resources/testharness.js"></script>
17+
<script src="/resources/testharnessreport.js"></script>
18+
<script src="/css/support/parsing-testcommon.js"></script>
19+
</head>
20+
<body>
21+
<script>
22+
test_invalid_value(
23+
"font-variant-alternates",
24+
"swash(several,different,aliases)"
25+
);
26+
test_invalid_value("font-variant-alternates", "stylistic(more,than,one)");
27+
test_invalid_value("font-variant-alternates", "ornaments(more,than,one)");
28+
test_invalid_value("font-variant-alternates", "swash(more,than,one)");
29+
test_invalid_value(
30+
"font-variant-alternates",
31+
"annotation(more,than,one)"
32+
);
33+
test_invalid_value(
34+
"font-variant-alternates",
35+
"historical-forms(argument)"
36+
);
37+
test_invalid_value("font-variant-alternates", "annotation()");
38+
test_invalid_value("font-variant-alternates", "annotation");
39+
test_invalid_value("font-variant-alternates", "swash");
40+
test_invalid_value("font-variant-alternates", "ornaments stylistic");
41+
test_invalid_value("font-variant-alternates", "swash(one) swash(two)");
42+
test_invalid_value(
43+
"font-variant-alternates",
44+
"unkown(one) myfunction(two)"
45+
);
46+
test_invalid_value(
47+
"font-variant-alternates",
48+
"styleset(thisone) styleset(something,else)"
49+
);
50+
test_invalid_value(
51+
"font-variant-alternates",
52+
"swash(foo) swash(bar)"
53+
);
54+
test_invalid_value("font-variant-alternates", "ornaments(one historical-forms");
55+
</script>
56+
</body>
57+
</html>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
PASS e.style['font-variant-alternates'] = "character-variant(more, than, one)" should set the property value
3+
PASS e.style['font-variant-alternates'] = "styleset(more, than, one)" should set the property value
4+
PASS e.style['font-variant-alternates'] = "styleset(more, than, one) character-variant(more, than, one)" should set the property value
5+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>
6+
CSS Fonts Module Level 4: parsing font-variant-alternates with valid
7+
values
8+
</title>
9+
<link
10+
rel="help"
11+
href="https://drafts.csswg.org/css-fonts-4/#propdef-font-variant-alternates"
12+
/>
13+
<meta
14+
name="assert"
15+
content="font-variant-alternates supports only the grammar normal | [ stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) ]"
16+
/>
17+
<script src="/resources/testharness.js"></script>
18+
<script src="/resources/testharnessreport.js"></script>
19+
<script src="/css/support/parsing-testcommon.js"></script>
20+
</head>
21+
<body>
22+
<script>
23+
test_valid_value(
24+
"font-variant-alternates",
25+
"character-variant(more, than, one)"
26+
);
27+
test_valid_value("font-variant-alternates", "styleset(more, than, one)");
28+
test_valid_value(
29+
"font-variant-alternates",
30+
"styleset(more, than, one) character-variant(more, than, one)"
31+
);
32+
</script>
33+
</body>
34+
</html>

0 commit comments

Comments
 (0)
0