-
Notifications
You must be signed in to change notification settings - Fork 661
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] should supported tech() be validated during parsing or loading? #8793
Comments
I think I am asking a similar question in #8795. A browser not supporting a property will fail a WPT subtest that uses this property in a container or feature query, if edit: actually the WPT will succeed with a match against |
I think it's wrong for unsupported font formats or technologies in the src descriptor to potentially result in a parse error (if there's no alternative, supported source in the list). In Selecting items in the src, we're told to
which implies that resources with unsupported formats/technologies are nevertheless parsed successfully and become part of the list; they just won't get selected for download and use. See also #9054 (comment). |
Yeah, that does make sense, but it seems to be conflicting with the other part of the spec at https://www.w3.org/TR/css-fonts-4/#font-face-src-parsing that says:
This should be probably discussed by the CSSWG. |
I agree it conflicts with the text about parsing. Tagged this for the CSSWG agenda in the hope we can get it clarified. |
Does it though? It seems like a queue of operations:
So it is easily possible to have something that does parse and is not supported. Which means you don't try to fetch it. I must be missing something here, this seems straightforward. |
That seems straightforward enough, yes. But the issue is that the current spec text:
says (as I read it) that if the entries in the src descriptor are parsed successfully, but not supported by the UA, this results in a parse error. It shouldn't; the descriptor was parsed fine, it just resulted in a value that is not supported and therefore should not be fetched. |
So ISTM that the quoted spec fragment should be more like
(with no reference to whether the format or tech are supported, which is irrelevant to parsing; these are considered during the selecting items in the src process.) |
OK so we are going from building a list of supported sources, to building a list of parsed sources (some of which may be unsupported).
and we want
and the supported part is already covered
|
although we could usefully linkify formats and technologies |
https://bugs.webkit.org/show_bug.cgi?id=259145 rdar://112135896 Reviewed by Myles C. Maxfield. A valid tech() keyword argument should be parsed even if the represented techonology is not supported by the engine. The engine should reject loading the font for unsupported techonologies but this should happen only at loading time and not at parsing time. The reason why we were rejecting it before at parsing time it is for some inconsistency in different parts of the spec which suggested that. That will be fixed soon by the CWWG, see: w3c/csswg-drafts#8793 * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt: * Source/WebCore/css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcResourceValue::fontLoadRequest): * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeFontTech): * Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp: (WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI): * Source/WebCore/css/parser/CSSSupportsParser.cpp: (WebCore::CSSSupportsParser::consumeSupportsFontTechFunction): Canonical link: https://commits.webkit.org/265999@main
https://bugs.webkit.org/show_bug.cgi?id=259144 rdar://112135869 Reviewed by Tim Nguyen. A valid format() keyword (ident) argument should be parsed even if the represented format is not supported by the engine. The engine should reject loading the font for unsupported formats but this should happen only at loading time and not at parsing time. The reason why we were rejecting it before, at parsing time, is for some inconsistency in different parts of the spec. That will be fixed soon by the CSSWG, see: w3c/csswg-drafts#8793 * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt: * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::isFontFormatKeywordValid): (WebCore::CSSPropertyParserHelpers::consumeFontFormat): * Source/WebCore/css/parser/CSSSupportsParser.cpp: (WebCore::CSSSupportsParser::consumeSupportsFontFormatFunction): Canonical link: https://commits.webkit.org/266043@main
https://bugs.webkit.org/show_bug.cgi?id=259145 rdar://112135896 Reviewed by Myles C. Maxfield. A valid tech() keyword argument should be parsed even if the represented techonology is not supported by the engine. The engine should reject loading the font for unsupported techonologies but this should happen only at loading time and not at parsing time. The reason why we were rejecting it before at parsing time it is for some inconsistency in different parts of the spec which suggested that. That will be fixed soon by the CWWG, see: w3c/csswg-drafts#8793 * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt: * Source/WebCore/css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcResourceValue::fontLoadRequest): * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeFontTech): * Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp: (WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI): * Source/WebCore/css/parser/CSSSupportsParser.cpp: (WebCore::CSSSupportsParser::consumeSupportsFontTechFunction): Canonical link: https://commits.webkit.org/265999@main
https://bugs.webkit.org/show_bug.cgi?id=259144 rdar://112135869 Reviewed by Tim Nguyen. A valid format() keyword (ident) argument should be parsed even if the represented format is not supported by the engine. The engine should reject loading the font for unsupported formats but this should happen only at loading time and not at parsing time. The reason why we were rejecting it before, at parsing time, is for some inconsistency in different parts of the spec. That will be fixed soon by the CSSWG, see: w3c/csswg-drafts#8793 * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt: * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::isFontFormatKeywordValid): (WebCore::CSSPropertyParserHelpers::consumeFontFormat): * Source/WebCore/css/parser/CSSSupportsParser.cpp: (WebCore::CSSSupportsParser::consumeSupportsFontFormatFunction): Canonical link: https://commits.webkit.org/266043@main
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: tech() validation<fantasai> github: https://github.com//issues/8793 <fantasai> jfkthame: Current spec text is a bit confusing <fantasai> jfkthame: question is, if the font technology or font format that is declared for a font resource is not supported, how does this get processed <fantasai> jfkthame: one part says if not supported, then that source is dropped from list of available sources <fantasai> jfkthame: if no sources left, that's a parse error <fantasai> jfkthame: another part of spec says that the format and tech are evaluated at the time of deciding what resources to load <fantasai> jfkthame: so skip if don't support them <fantasai> jfkthame: but it's not a CSS parse error <fantasai> jfkthame: general agreement among those in discussion <fantasai> jfkthame: is that unsupported tech or formats shouldn't be a parse error, it's still valid, you just don't fetch that resource <fantasai> jfkthame: currently that's not what a strict reading of the spec says <fantasai> jfkthame: if we agree it's not a parse error, then we need to fix the spec <TabAtkins> +1, spec is simply written a little wrong, easy fix <fantasai> +1 <vitorroriz> (I'm not on the call due to a meeting but +1) <fantasai> astearns: proposed resolution is to remove bit about it being a parse error? <fantasai> jfkthame: yes, looking at Chris's comment from July 11th <fantasai> https://github.com//issues/8793#issuecomment-1631228711 <fantasai> jfkthame: Proposed edits in that comment makes sense to me <fantasai> RESOLVED: Make edits outlined by Chris |
The way I interpreted
@font-face src tech()
from WPT tests, we should parse all valid keywords fortech()
and then, at loading, check if the parsed tech is supported or not. That’s what WPT expects, for example, here, otherwise a browser not supportingcolor-colrv1
, for example, would fail some subtests.However, spec says:
For unsupported tech to be a parsing error, we would need to validate for supported tech already during parsing, but then a browser not supporting, for example, color-colrv1 would fail the mentioned WPT subtest.
The text was updated successfully, but these errors were encountered: