-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-fonts-4] Unclear serialisation of calc expressions in @font-face
font-stretch/style/weight descriptors
#7964
Comments
@font-face
font-stretch/style/weight descriptors@font-face
font-stretch/style/weight descriptors
…ue for font-style https://bugs.webkit.org/show_bug.cgi?id=246960 rdar://101517323 Reviewed by Darin Adler. css/css-fonts/variations/at-font-face-descriptors.html assumes `font-style: oblique calc(91deg)` gets serialized to `font-style: oblique 90deg` in the specified style, which should not be the case according to the spec: https://drafts.csswg.org/css-values-3/#calc-range > (Clamping is not performed on specified values.) * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html: Canonical link: https://commits.webkit.org/258633@main
"Simplification" as described there doesn't include clamping, though, does it? In 8.1.4. Range Checking, we read:
So I guess the answer depends whether the serialized values of these descriptors are treated like specified or computed (or used) values. I'm not sure what that means in relation to |
The test we're pointing out is setting and reading |
"Serialized" vs "computed" concepts don't actually apply to at-rule descriptors, as they're related to the cascade. So yeah, this is indeed underspecified. I don't have a strong opinion on whether we clamp or not here, but I lean weakly towards "don't clamp" for the same reasons @nt1m gave. |
It seems to me "unclamped" would still leave it undefined whether FWIW, leaving things unclamped or having to return csstext as specified literally would prevent the implementation from storing specified values in a more pre-computed, more efficient or canonical way. Instead the implementation would need to keep a backup of the original css text which may not be identical to what it's using internally. The as-specified text/values do not need to be stored, as there is no need to re-compute values after cascading. I tend to think, keeping only a evaluated and simplified form seems to be the better choice:
|
For consistency's sake I would prefer the serialization of the descriptors to be the same as the CSS properties, makes it easier (on the WebKit side at least) to implement serialization/parsing without duplicating code or extra code-paths. |
How much of a benefit is that, really? The values of the descriptors don't entirely correspond to properties: e.g. the |
I agree with @jfkthame that the grammar of properties and descriptors is related but not identical. And agree with @drott that consensus seems to be forming on simplifying zero-ranged descriptors; but descriptors with a non-zero range have values that the corresponding property does not allow. So a general rule of simplifying to a canonical form seems clearer. |
I added some more to 13.2. Serializing font-related at-rules , explicitly noting the principle of last-defined values and also coalescing blocks. I made the serialized form be sorted alphabetically, but I am not sure if or where that is specified for descriptor values. I haven't added anything about simplifying calc expressions, and would like to see a good example. |
The CSS Working Group just discussed
The full IRC log of that discussion<emeyer> TabAtkins: Fundamental issue is that simplification rules for math functions refer to resolution stages<emeyer> …Those don’t apply in descriptors <emeyer> …So what are the rules for serialization, and do they match? <emeyer> …Apple wants serialization to be the same as CSS properties, which makes sense <emeyer> …Not sure if we’re compat-constrained or not <emeyer> dbaron: The one thought I have is that descriptors seem a lot like specified values <emeyer> TabAtkins: Agreed <emeyer> emilio: Agreed <emeyer> TabAtkins: I think it’s reasonable to say we treat things the same <emeyer> astearns: We could resolve on that and see if anyone complains <emeyer> TabAtkins: proposed resolution: math function simplifcation for descriptors as if they were specified properties, and descriptors with math functions use the same serialization rules as properties <emeyer> RESOLVED: math function simplifcation for descriptors is as if they were specified properties, and descriptors with math functions use the specified-value serialization rules |
css/css-fonts/variations/at-font-face-descriptors.html
defines various expectations for what should happen withcalc()
expressions, but does not consistently do that, some are evaluated, some are not.This issue is spun off of recent WebKit WPT test merge where expectations were changed from evaluated and clamped calc() results to unevaluated calc() results when reading back the descriptor.
WebKit/WebKit@c3e9369
Generally, the css-values specification suggest simplification:
https://w3c.github.io/csswg-drafts/css-values-4/#calc-simplification
We need to define what the serialized value of the font property-descriptors
font-weight
,font-stretch
,font-style
inhttps://drafts.csswg.org/css-fonts-4/#font-prop-desc should be.
The text was updated successfully, but these errors were encountered: