[csswg-drafts] [css-fonts] Drop bracket matching step from `@font-face` src: line parsing (#6340)

drott has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] Drop bracket matching step from `@font-face` src: line parsing ==
For context, the original resolution from which the spec text for parsing the `src:` line of the `@font-face` descriptor was tracked in issue #633. This issue is related to #6328.

The current [spec text says](https://github.com/w3c/csswg-drafts/blob/main/css-fonts-4/Overview.bs#L1880):

> The value of the 'src!!descriptor' descriptor is parsed piecewise.  First, opening and closing parentheses are matched. If these parentheses cannot be matched, the value is a parse error. Matching the parentheses has the effect of partitioning the value into multiple regions, each of which is either inside outermost parentheses or outside outermost parentheses.  Once the value is partitioned, all the commas outside outermost parentheses are located. The value is then split at these comma locations.

Why do we need the bracket matching? In my quick analysis, at least WebKit and Blink do not do that but the top level step for parsing the `src:` descriptors value is to split this into a comma separated list of values, then parse these individually. I am not so familiar with reading Rust code, but [it roughly looks like](https://searchfox.org/mozilla-central/source/servo/components/style/font_face.rs#380) Gecko parses this as a comma separated list at the top level as well? (@jfkthame, could you comment?).

I suggest to drop this text and explain that the first segmentation step is separating by commas, then parsing each individual value separately, unless I am missing something on why this might be needed. To me it seems this would not conflict with any of the second level parsing of individual source values. (It does not look to me as commas would have any other meaning in this descriptor except separating sources, do they?)

This would also address the TODO issue in the text and explain that after comma separation, values that are not parsed correctly are dropped from the list and not considered as downloadable resources.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6340 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 2 June 2021 16:09:57 UTC