w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.51k stars 669 forks source link

[css-text-decor] Can text-decoration-thickness mix percentages and lengths? #9469

Open nt1m opened 1 year ago

nt1m commented 1 year ago

There's a WPT testing that text-decoration-thickness takes calc() mixing percentages and lengths. https://github.com/web-platform-tests/wpt/blob/b5c73fa21b/css/css-text-decor/text-decoration-thickness-valid.html#L24-L25

Except the spec specifies the syntax to be: auto | from-font | <length> | <percentage>, which means that they can't actually be mixed? If they are allowed to be mixed, the type should probably be <length-percentage>.

It seems like the mixing is supported in Firefox / Chrome. Safari doesn't currently support percentages.

cc @kojiishi @fantasai @shivamidow

nt1m commented 1 year ago

cc @drott @jfkthame

Loirooriol commented 1 year ago

I would expect <length-percentage>.

shivamidow commented 1 year ago

Yeah, I also think <length-percentage> makes sense.

drott commented 1 year ago

@nt1m wrote:

If they are allowed to be mixed, the type should probably be .

Agree, that would make sense. We parse as ConsumeLengthOrPercent, (impl)

fantasai commented 1 year ago

Quite sure this was not intentional. Likely at the time this was written, there was no distinction between <length-percentage> and <length> | <percentage>. Fixed.

Loirooriol commented 1 year ago

@fantasai You fixed the grammar, but the prose below still tries to define <length> and <percentage> separately, instead of <length-percentage>.