-
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] Empty quoted font family name should not parse as valid #4510
Comments
Why can't we just handle the empty string the same way we handle a non-empty string that does not map to a known font? I think "font-family: ,,,;" is already covered by the current syntax in the spec? There is no such thing as a null identifier? |
I find it inefficient to let an empty string "" travel up to font matching if it can be rejected at the parsing stage. Also, fulfilling a promise |
I don't see that
is any more "misleading" than
which also resolves to a |
When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1
When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/master@{#715261}
When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/master@{#715261}
@jfkthame is right. |
…FaceCache, a=testonly Automatic update from web-platform-tests Avoid looking up empty font name in FontFaceCache When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/master@{#715261} -- wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b wpt-pr: 20237
…FaceCache, a=testonly Automatic update from web-platform-tests Avoid looking up empty font name in FontFaceCache When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/master@{#715261} -- wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b wpt-pr: 20237
…FaceCache, a=testonly Automatic update from web-platform-tests Avoid looking up empty font name in FontFaceCache When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futharkchromium.org> Reviewed-by: Koji Ishii <kojiichromium.org> Commit-Queue: Dominik Röttsches <drottchromium.org> Cr-Commit-Position: refs/heads/master{#715261} -- wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b wpt-pr: 20237 UltraBlame original commit: 1abac1b710f443dc4c8f8e009288629e34a3db91
…FaceCache, a=testonly Automatic update from web-platform-tests Avoid looking up empty font name in FontFaceCache When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futharkchromium.org> Reviewed-by: Koji Ishii <kojiichromium.org> Commit-Queue: Dominik Röttsches <drottchromium.org> Cr-Commit-Position: refs/heads/master{#715261} -- wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b wpt-pr: 20237 UltraBlame original commit: 1abac1b710f443dc4c8f8e009288629e34a3db91
…FaceCache, a=testonly Automatic update from web-platform-tests Avoid looking up empty font name in FontFaceCache When document.fonts.load() is called with font specification such as '1px ""' (containing two quotes) as the argument, CSS font property parsing parses this successfully as the empty string. FontFaceCache was not prepared to handle that correctly. Fix FontFaceCache to guard against that. Add test to actually ensure that this font specification's load promise resolves successfully. In parallel, raised w3c/csswg-drafts#4510 in CSS WG to discuss whether it would make sense to reject such a font specification at the parsing stage already. Bug: 1023206 Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392 Reviewed-by: Rune Lillesveen <futharkchromium.org> Reviewed-by: Koji Ishii <kojiichromium.org> Commit-Queue: Dominik Röttsches <drottchromium.org> Cr-Commit-Position: refs/heads/master{#715261} -- wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b wpt-pr: 20237 UltraBlame original commit: 1abac1b710f443dc4c8f8e009288629e34a3db91
So, discussion on this issue seemed to conclude that a promise returning does not mean the font was successfully loaded; and thus, that no changes are needed. Is that the consensus? |
This makes interop 2023 listed css/css-fonts/font-palette-empty-font-family.html pass because we no longer ignore the @font-face with the empty font family name. The previous test css/css-font-loading/empty-family-load.html from issue 1023206 where we blocked accessing empty-named @font-face families still passes. Which means that using the font loading API with empty family names does not cause issues after this change. The latter is also inline with the discussion in [1] where there was consensus that empty family names should be acceptable for defining and matching @font-faces. [1] w3c/csswg-drafts#4510 Fixed: 1408640 Change-Id: I5b98309b2bfbee508b1db8eb90d84d3a47b7dc59 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4334276 Reviewed-by: Frédéric Wang <fwang@igalia.com> Commit-Queue: Dominik Röttsches <drott@chromium.org> Cr-Commit-Position: refs/heads/main@{#1117408}
In a recent Chrome issue we discovered that a style definition such as:
font: 1px "";
would parse as valid according to the spec prose.
Similarly, a JS font loading call such as:
document.fonts.load("1px \"\"")
leads to a promise with status
resolved
/fulfilled
in Safari / Firefox, even though to me that does not make sense, as a font with an empty family name cannot be reasonably matched.I suggest to add normative text in section 3.1 below the following paragraph:
similar to
Then we can add to the examples:
Perhaps we need to add something as well to describe that:
font-family: ,,,;
also should not parse as valid, i.e. a sequence of null identifiers separated by commas.
The text was updated successfully, but these errors were encountered: