Skip to content

Commit

Permalink
Treat component failures leniently in @font-face src: parsing
Browse files Browse the repository at this point in the history
Adapt font-face src: parsing behavior to more leniently accept a src:
line that has parse errors in an individual component. Part of Interop
2023 in the font feature detection and palettes category [1].

Also return serialized values in lowercase to match CSSOM spec.

After CSS WG resolution [1] and updated spec text [2] individually
failing src: line components for incorrect format() or tech(), or other
parse failures per component should not lead to dropping the whole src:
line, but only reject the individual component.

Implement checks for component sanity and on failure, skip to next comma
or end.

[1] https://wpt.fyi/results/css/css-fonts/parsing?q=label%3Ainterop-2023-fonts
[1] w3c/csswg-drafts#6340
[2] https://drafts.csswg.org/css-fonts-4/#font-face-src-parsing

Fixed: 1398933, 857226
Change-Id: Ib94f745fb8b453e21fd981973c29dccb4b722439
  • Loading branch information
drott authored and chromium-wpt-export-bot committed Jun 19, 2023
1 parent ff04c09 commit 729e221
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions css/css-fonts/parsing/font-face-src-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{ src: 'url(not a valid url/bar.ttf), url(foo.ttf)', valid: true },
{ src: 'url(foo.ttf) format(bad), url(foo.ttf)', valid: true },
{ src: 'url(foo.ttf) tech(unknown), url(foo.ttf)', valid: true },
{ src: 'url(foo.ttf) tech(color-COLRv0) otherfunc(othervalue), url(foo.ttf)', valid: true },
{ src: 'url(foo.ttf), url(something.ttf) format(broken)', valid: true },
{ src: '/* an empty component */, url(foo.ttf)', valid: true },
{ src: 'local(""), url(foo.ttf), unparseable-garbage, local("another font name")', valid: true },
Expand All @@ -27,6 +28,7 @@
{ src: 'local("textfont") format(opentype), local("emoji") tech(color-COLRv0)', valid: false },
{ src: 'local(), /*empty*/, url(should be quoted.ttf), junk', valid: false },
{ src: 'url(foo.ttf) format(unknown), url(bar.ttf) tech(broken)', valid: false },
{ src: 'url(foo.ttf) tech(color-COLRv0) otherfunc(othervalue), junk', valid: false },
];

for (let t of tests) {
Expand Down

0 comments on commit 729e221

Please sign in to comment.