WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 246570
font shorthand should not reject values that happen to have CSS-wide keywords as non-first identifiers in a font family name
https://bugs.webkit.org/show_bug.cgi?id=246570
Summary
font shorthand should not reject values that happen to have CSS-wide keywords...
Tim Nguyen (:ntim)
Reported
2022-10-15 07:06:33 PDT
WPT: css/css-fonts/test_font_family_parsing.html The code in CSSPropertyParser::consumeFont seems to assume a certain order for font-size.
Attachments
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2022-10-16 00:48:25 PDT
The failure I see in this test has nothing to do with order of font size. It's about whether the CSS-wide keywords are allowed as words in family names. The concatenateFamilyName function checks isValidCustomIdentifier, but probably should not be doing that.
Darin Adler
Comment 2
2022-10-16 00:53:01 PDT
Reading CSS Fonts Module Level 4, it seems that the web platform test expectations are wrong, and do not match the specification. The specification says that family names that are not quoted are series of <custom-ident> and says that CSS-wide keywords are not valid <custom-ident>s. The default keyword is reserved and is also not a valid <custom-ident>.
Tim Nguyen (:ntim)
Comment 3
2022-10-16 09:15:40 PDT
(In reply to Darin Adler from
comment #1
)
> The failure I see in this test has nothing to do with order of font size. > It's about whether the CSS-wide keywords are allowed as words in family > names. The concatenateFamilyName function checks isValidCustomIdentifier, > but probably should not be doing that.
Ah, the `font-family` subtests threw me off.
> Reading CSS Fonts Module Level 4, it seems that the web platform test expectations are wrong, and do not match the specification. The specification says that family names that are not quoted are series of <custom-ident> and says that CSS-wide keywords are not valid <custom-ident>s. The default keyword is reserved and is also not a valid <custom-ident>.
The level 3 spec is more relaxed about the definition of <family-name>:
https://www.w3.org/TR/css-fonts-3/#family-name-value
Either way, it does seem like our handling is inconsistent and needs to be fixed, because we accept CSS-wide keywords in font-family as words in family names, but not as part of the `font` shorthand, only in the `font-family` longhand. See consumeFamilyNameRaw in CSSPropertyParserHelpers.
Radar WebKit Bug Importer
Comment 4
2022-10-22 07:07:18 PDT
<
rdar://problem/101459948
>
Darin Adler
Comment 5
2022-10-22 16:19:15 PDT
for now, I suggest we ignore the CSS Fonts Module Level 4 use of <custom-ident>. We should probably file an issue to get the specification revised. Use of an identifier as a family name should always be safe even if it is not a valid custom identifier. If it’s a context where a CSS-wide identifier is allowed then it will be caught as such before trying to parse the identifier. If it’s serialization we are concerned about, it will be quoted, and the fact that it was originally specified as an identifier will have no effect.
Darin Adler
Comment 6
2022-10-22 19:41:36 PDT
Hmm, that’s not going to work. The css/css-fonts/test_font_family_parsing.html test in WPT requires that we continue to forbid some of these identifiers; I need to look more closely at what is going on.
Darin Adler
Comment 7
2022-10-22 19:50:42 PDT
I figured out the real problem. It *is* specific to font, not font-family. There’s logic at the beginning of consumeFont that does an incorrect check for inherit and initial.
Darin Adler
Comment 8
2022-10-22 21:45:16 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/5681
EWS
Comment 9
2022-10-23 01:00:19 PDT
Committed
255894@main
(3dde8827051a): <
https://commits.webkit.org/255894@main
> Reviewed commits have been landed. Closing PR #5681 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug