Re: [csswg-drafts] [css-values] Consider requiring same relative <length> units in atan2() (#8169)

The CSS Working Group just discussed `[css-values] Consider requiring same relative <length> units in atan2()`, and agreed to the following:

* `RESOLVED: font-relative units resolve against the parent element when used in any font-* property (and anything else that affects font selection)`
* `RESOLVED: Do something similar for line-height (details TBD)`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> scriben+<br>
&lt;fantasai> scribe+<br>
&lt;fantasai> TabAtkins: Emilio brought up originally, if your two calculations in atan2() have different units with potentially different calculation times (e.g. 'em' vs 'px'), can cause circular dependency issues<br>
&lt;fantasai> TabAtkins: this washes the units away into plain numbers, allowing them to be used in more places<br>
&lt;fantasai> TabAtkins: but if you use this property in other properties that affect resolution of those units it's a problem<br>
&lt;fantasai> TabAtkins: agree it's an issue, but not specific to atan2()<br>
&lt;fantasai> TabAtkins: it's a property of calc() unit division in general<br>
&lt;fantasai> TabAtkins: e.g. calc(1em/1ex) is a number<br>
&lt;fantasai> TabAtkins: Agree this is an issue, but we need to solve generally<br>
&lt;fantasai> TabAtkins: not address atan2() specifically<br>
&lt;fantasai> emilio: I agree<br>
&lt;fantasai> emilio: Firefox considers atan2() of two different lengths that aren't absolute, we consider that invalid and don't parse it<br>
&lt;TabAtkins> yeah that exact restriciton is *nonsensical*<br>
&lt;fantasai> emilio: I guess my question is, at least WebKit is completely broken and just ignores the units<br>
&lt;fantasai> emilio: this is an issue, but we shouldn't parse different units if we don't support the units<br>
&lt;fantasai> emilio: agree it's a general issue<br>
&lt;fantasai> TabAtkins: for the font-dependent units, when used directly where they can affect the resolution<br>
&lt;fantasai> TabAtkins: we resolve against parent element instead, and this resolves the circular dependency<br>
&lt;fantasai> TabAtkins: Can we do that here?<br>
&lt;fantasai> emilio: Using the parent makes sense<br>
&lt;fantasai> emilio: It's a little bit tricky<br>
&lt;fantasai> emilio: Note that implementation-wise this isn't only issue<br>
&lt;astearns> q+<br>
&lt;TabAtkins> 1) font-dependent units are invalid in proeprties where they're problematic, or 2) font-dependent units resolve based on parent metrics instead<br>
&lt;fantasai> emilio: also now things that can resolve to a number resolve eagerly, but with these units cannot<br>
&lt;fantasai> emilio: I agree resolving to parent font is less ugly solution<br>
&lt;fantasai> emilio: whether that's enough for custom properties etc, I need to think... probably it is?<br>
&lt;fantasai> emilio: Would be great to have a central place for these dependencies<br>
&lt;fantasai> astearns: Wanted clarification on using parent value for these things<br>
&lt;fantasai> astearns: that's in all contexts, not just when using calc() in problematic property?<br>
&lt;fantasai> TabAtkins: No, that would be fundamentally incompatible with existing usage of calc()<br>
&lt;fantasai> TabAtkins: using width in 'em' uses element's own font size, correct and necessary to maintain<br>
&lt;fantasai> TabAtkins: this is wrt font-dependent units, or other property-dependent units<br>
&lt;fantasai> astearns: Concern that if you use same function in two different properties, you might get different results<br>
&lt;astearns> ack astearns<br>
&lt;fantasai> TabAtkins: if you use font-size: 2em; and width: 2em they're different<br>
&lt;fantasai> TabAtkins: this just expands the set of properties affected, because unit algebra allows putting them in places not currently accepting units<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> fantasai: i agree - ideally doing same as font-size makes the most sense. probablyl should say generally for font-relative units in the font-* properties<br>
&lt;TabAtkins> fantasai: dont' think there's anything reasonable to do besides making them invalid, which is less godd<br>
&lt;TabAtkins> fantasai: other a little complex is line-height unit<br>
&lt;TabAtkins> fantasai: unlike font-size, line-height accepts font-relative units, but produces the lh unit. forget how we resolved that circularity<br>
&lt;dbaron> s/accepts font-relative units/treats font-relative units relative to the current element/<br>
&lt;fantasai> TabAtkins: Emilio also wanted a centralized location for all the dependencies we have<br>
&lt;fantasai> TabAtkins: We do have a wiki page tracking these, could move into appendix of Values?<br>
&lt;emilio> wfm<br>
&lt;TabAtkins> https://wiki.csswg.org/spec/property-dependencies<br>
&lt;emilio> fantasai: not all of the dependencies are unit dependencies<br>
&lt;emilio> ... not sure those make sense in values<br>
&lt;fantasai> astearns: put in definition of units?<br>
&lt;fantasai> emilio: discussing things like position affecting display, etc.<br>
&lt;fantasai> TabAtkins: tracking unit dependencies is what we need to define for this, could limit to addressing that<br>
&lt;fantasai> fantasai: That's easy, it's just everything in font-relative units section<br>
&lt;fantasai> astearns: So first is to define set of properties that affect font-relative units?<br>
&lt;TabAtkins> fantasai: so that's all the font-* properties, anything affecting font selection, affects 'ex' and similar units<br>
&lt;TabAtkins> fantasai: I think we just generally say all font properties need to look up the parent<br>
&lt;TabAtkins> fantasai: we didn't say this before because only font-size could take a numeric value, now many can<br>
&lt;TabAtkins> astearns: so you're arguing against a list of properties?<br>
&lt;TabAtkins> fantasai: Yeah we're gonna add more props over time. should literally just say "all the font-* props"<br>
&lt;TabAtkins> fantasai: So no fancy table needed, just say "all the font properties".<br>
&lt;TabAtkins> TabAtkins: and do something for line-height<br>
&lt;TabAtkins> fantasai: yes<br>
&lt;TabAtkins> astearns: so proposed reoslution is if you use the font-relative units in a math fucntion...<br>
&lt;TabAtkins> fantasai: No, not just in a function. Any usage. We might expand usage in the future.<br>
&lt;TabAtkins> astearns: concerns with the reoslution?<br>
&lt;TabAtkins> TabAtkins: i'll run the exact test by emilio when i get some text down<br>
&lt;TabAtkins> emilio: what happens with length-valued custom props?<br>
&lt;TabAtkins> emilio: if you use ems in a custom prop that takes &lt;length>, and then use it in font-size...<br>
&lt;TabAtkins> fantasai: the substiution happens before computation...<br>
&lt;fantasai> s/happens/should happen/<br>
&lt;TabAtkins> emilio: but it has to compute to something<br>
&lt;TabAtkins> emilio: if you getComputedStyle() it has to return a length<br>
&lt;TabAtkins> TabAtkins: yeah there might be an issue there, i'll review<br>
&lt;TabAtkins> astearns: so proposed resolution is if you use font-relative units in font-* properties, you get the value from teh parent<br>
&lt;TabAtkins> astearns: objections?<br>
&lt;fantasai> ACTION TabAtkins: Figure out what to do on custom properties typed as lengths<br>
&lt;TabAtkins> RESOLVED: font-relative units resolve against the parent element when used in any font-* property (and anything else that affects font selection)<br>
&lt;fantasai> astearns: line-height?<br>
&lt;fantasai> TabAtkins: We need to dig into exactly what that works out to<br>
&lt;fantasai> RESOLVED: Do something similar for line-height (details TBD)<br>
&lt;fantasai> astearns: container query units?<br>
&lt;fantasai> TabAtkins: by definition, they're not circular because already resolvign against an ancestor eleent<br>
&lt;fantasai> s/eleent/element<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8169#issuecomment-1632890687 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 12 July 2023 16:56:54 UTC