Skip to content

[css-fonts] Should font-palette be reset by the font shorthand? #7832

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

Closed
jfkthame opened this issue Oct 5, 2022 · 16 comments
Closed

[css-fonts] Should font-palette be reset by the font shorthand? #7832

jfkthame opened this issue Oct 5, 2022 · 16 comments

Comments

@jfkthame
Copy link
Contributor

jfkthame commented Oct 5, 2022

Currently, the spec for the font shorthand says that:

All subproperties of the 'font' property are first reset to their initial values, including ... 'font-palette'.

However, it appears that neither the WebKit nor Blink implementations actually do this:

> document.body.style.fontPalette = "dark"
< 'dark'
> document.body.style.font = "12px sans-serif"
< '12px sans-serif'
> window.getComputedStyle(document.body).fontPalette
< 'dark'

Should the spec be revised to reflect implementation reality here, or should this simply be regarded as a bug in those browsers?

@emilio
Copy link
Collaborator

emilio commented Oct 5, 2022

@litherum @drott was this intentional or an oversight?

@svgeesus
Copy link
Contributor

svgeesus commented Oct 5, 2022

The spec was only recently clarified to explicitly list all the longhands which are reset by the font shorthand. So I suspect that this is simply implementation lag. The spec is now pretty clear:

All subproperties of the font property are first reset to their initial values, including those listed above plus font-size-adjust, font-kerning, all subproperties of font-variant, font-feature-settings, font-language-override, font-optical-sizing, font-variation-settings, and font-palette.

@jfkthame
Copy link
Contributor Author

jfkthame commented Oct 5, 2022

And font-synthesis?

@svgeesus
Copy link
Contributor

svgeesus commented Oct 5, 2022

Good catch. Do we need to have discussion on a call so we are sure that the list of longhands reset by the font shorthand is

a) complete
b) agreed to be what we want?

@jfkthame
Copy link
Contributor Author

jfkthame commented Oct 5, 2022

I think it'd be worth asking the question, at least. I could imagine authors wanting to set font-palette, for example, on the root and not have it affected by shorthand font usage elsewhere.

moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 7, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 8e023280032c8b32c1eaeaf595c2eb989a4427f3
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 7, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 4e4eb99a7fd95b2e288e478b5d97019b259ada91
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 7, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 528b4c022a44e15cd66ef9dca54e7e67c89e2ba4
gecko-reviewers: emilio
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 7, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 7, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 7, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 2b445c555e746e572a28e612452ef26d2ecfb9e8
gecko-reviewers: emilio
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 8, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 8, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 8e023280032c8b32c1eaeaf595c2eb989a4427f3
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 4e4eb99a7fd95b2e288e478b5d97019b259ada91
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 528b4c022a44e15cd66ef9dca54e7e67c89e2ba4
gecko-reviewers: emilio
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1791778
gecko-commit: 2b445c555e746e572a28e612452ef26d2ecfb9e8
gecko-reviewers: emilio
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 13, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 13, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 13, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 13, 2022
…e font shorthand. r=emilio

This currently fails in webkit & blink; w3c/csswg-drafts#7832 asks the CSS WG to confirm
whether to keep the existing spec (which is what's implemented here) or change it to match those implementations
(in which case we'll need to do a minor followup to tweak our behavior accordingly).

Differential Revision: https://phabricator.services.mozilla.com/D158787
@fantasai
Copy link
Collaborator

fantasai commented Dec 6, 2022

So if I understand correctly, what we have is the following:

Set Explicitly

font-style
font-weight
font-size
font-stretch (L3)
font-family
font-variant-caps (L2)
line-height

Reset Implicitly

font-size-adjust
font-kerning
font-variant-*
font-feature-settings
font-variation-settings
font-language-override
font-optical-sizing

Cascaded Independently

font-synthesis-*

And the question right now is whether font-palette belongs in Reset Implicitly or Cascaded Independently.

Fwiw, I think it'd be helpful to include a Note of any font-* properties not reset by the font shorthand in the spec, so we're clear that leaving something out is not an oversight.

@svgeesus
Copy link
Contributor

svgeesus commented Dec 6, 2022

And the question right now is whether font-palette belongs in Reset Implicitly or Cascaded Independently.

Exactly

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-fonts] Should `font-palette` be reset by the `font` shorthand?, and agreed to the following:

  • RESOLVED: Use set explicitly, reset implicitly and cascade implicitly terms
  • RESOLVED: Put font-palette in the cascaded independently category
  • RESOLVED: Explicitly enumerate all properties which are cascaded independently that start with font-
The full IRC log of that discussion <chris_> q+
<flackr> jfkthame: When implementing font palette for gecko, I noticed in blink and webkit the font shorthand doesn't reset ?? to the initial. This could just be a bug, but I wonder if it would be preferable
<flackr> s/??/font-palette
<flackr> jfkthame: font palette seems to be a bit different in that it may be set on the root, and devs may be surprised when the font short-hand loses that setting
<astearns> ack chris_
<flackr> chris_: Agree it's surprising. The only reason the spec doesn't do this was because it's recent.
<flackr> chris_: This one should not have been in the implicitly reset
<flackr> chris_: We should use set explicitly, reset implicitly, and cascade??
<flackr> chris_: it's common to set on the root, it makes sense
<dbaron> s/cascade??/cascaded independently/
<flackr> RESOLVED: Use set explicitly, reset implicitly and cascade implicitly terms
<flackr> RESOLVED: Put font-palette in the cascaded independently category
<flackr> fantasai: Every property that's not part of the shorthand be cascaded independently. It would be helpful to have a note for the properties that begin with font- to consider them explicitly
<flackr> astearns: are there any properties beside font-palette and font-synthesis in this category?
<flackr> chris_: don't think so, might happen
<flackr> RESOLVED: Explicitly enumerate all properties which are cascaded independently that start with font-

webkit-commit-queue pushed a commit to nt1m/WebKit that referenced this issue Dec 13, 2022
https://bugs.webkit.org/show_bug.cgi?id=248949
rdar://103119662

Reviewed by Cameron McCormack.

It was resolved in w3c/csswg-drafts#7832 to remove font-palette from the font shorthand.

WPT synced from Mozilla's change: https://phabricator.services.mozilla.com/D164128

* LayoutTests/fast/css/font-shorthand-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/font-shorthand-serialization-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-vs-shorthand-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-vs-shorthand.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention.html:
* LayoutTests/platform/win/fast/css/font-shorthand-expected.txt:
* LayoutTests/platform/win/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::fontShorthandValue):
* Source/WebCore/css/StylePropertyShorthand.h:

Canonical link: https://commits.webkit.org/257772@main
@drott
Copy link
Collaborator

drott commented Jan 11, 2023

As we're currently working on the reset behaviour it'd be good to be able to quote an updated spec text.

@svgeesus svgeesus self-assigned this Jan 11, 2023
@svgeesus
Copy link
Contributor

I will try to get this done in the next few days

@svgeesus
Copy link
Contributor

Added the list of set explicitly, reset implicitly and cascade implicitly groups.

@svgeesus
Copy link
Contributor

@drott please take a look

@drott
Copy link
Collaborator

drott commented Jan 19, 2023

@drott please take a look

Thanks, mostly LGTM, I left two comments here regarding extra prose in the beginning and end.

@cdoublev
Copy link
Collaborator

I do not see font-variant-emoji listed as a reset-only sub-property. Is it intentional?

@svgeesus
Copy link
Contributor

I do not see font-variant-emoji listed as a reset-only sub-property. Is it intentional?

Not intentional, thanks for noticing, corrected.

Thanks, mostly LGTM, I left two comments here regarding extra prose in the beginning and end.

The "extra text" at the beginning has been there since CSS1, although I moved it to the start of the section.
I added your suggestion for better text at the end.

@drott
Copy link
Collaborator

drott commented Jan 23, 2023

Thanks for the edits, @svgeesus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants