[csswg-drafts] [css-fonts][cssom] Serialization of font properties when system font is specified

upsuper has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts][cssom] Serialization of font properties when system font is specified ==
For example, if I have `font: menu`, what should be returned for
* `getPropertyValue('font')`
* `getPropertyValue('font-family')`
* `cssText`

This isn't quite interop at the moment. See the following table on Windows:

Browser | font | font-family | cssText
-- | -- | -- | --
Blink | `12px "Segoe UI"` | `"Segoe UI"` | expand to all longhands
Edge | `menu` | `Segoe UI` | `font: 400 9pt Segoe UI;`
Gecko | `menu` | `-moz-use-system-font` | `font: menu;`

In Gecko, we use an internal property for holding system font with a placeholder value on all font longhands. And then we expand that to actual value during computation. I admit that the -moz-prefixed thing doesn't make much sense here anyway.

It seems to me that Blink expands the system font into their actual value during parsing. This is probably the simplest way to implement, and the spec somehow indicates this behavior (see the last yellow box in [the section of font shorthand](https://drafts.csswg.org/css-fonts-3/#font-prop)), but there is a problem with this approach that, it would be unable to respond to system setting changes.

Edge seems to go a middle path, although I'm not sure how exactly it is implemented. My guess is that, they store system font as specified value, and when others want to serialize the longhands, it returns the effective value of the corresponding system font?

It would probably make most sense to standardize some behavior similar to Edge, but returns `font: menu;` for cssText instead, I guess.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1586 using your GitHub account

Received on Friday, 7 July 2017 01:36:58 UTC