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-text-3] letter-spacing computed values don't reflect reality #1484

Closed
nox opened this Issue May 31, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@nox
Contributor

nox commented May 31, 2017

The spec says that the computed value should be an absolute length, but at least Safari and Firefox preserve the keyword normal in computed values.

@fantasai

This comment has been minimized.

Contributor

fantasai commented Mar 8, 2018

CSS2 used to treat normal different than 0, so computing differently was a requirement. Now that the spec treats them the same, it's possible to compute through. I'll ask the WG if they want to change the implementations or the spec in this case.

@fantasai fantasai added the Agenda+ label Mar 8, 2018

@FremyCompany

This comment has been minimized.

Contributor

FremyCompany commented Mar 20, 2018

Edge also computes to normal

@css-meeting-bot

This comment has been minimized.

Member

css-meeting-bot commented Mar 21, 2018

The Working Group just discussed letter-spacing computed values don't reflect reality, and agreed to the following resolutions:

  • RESOLVED: We have the spec say computed value of letter-spacing is absolute length. There's a quirk to getComputedStyle where 0 serializes to normal and that doesn't extend to the computed style map
The full IRC log of that discussion <dael> Topic: letter-spacing computed values don't reflect reality
<dael> github: https://github.com//issues/1484
<dael> fantasai: property has a normal keyword that's the initial and takes length
<dael> fantasai: normal is effectively 0 except in 2.1 we said normal you could adjust inter-letter spacing for justificaiton purposes. In text L3 I decided that was unnecessary restriction and we shouldn't distinguish normal and 0
<dael> fantasai: Spec says they're 100% eq. Since impl do normal to normal for computations we can say normal computes to normal and means 0. I don't see a significan't difference. Reason to compute through it you don't have to set a value to animate. normal to normal advantage is it's impl.
<dael> myles: Making sure I understand. If I animate from -5 to 5 I'll get visual flash?
<dael> fantasai: No, if you animate from initial value to 1em it won't animate correctly because it's a keyword.
<dael> myles: So that's why you unified 0 and normal?
<dael> fantasai: I did it because we might as well have computed value reflect what's in the engine. So at the end when you get computed you can't tell there's a normal. Interms of computed value the only observable difference is animations and transitions.
<AmeliaBR> FYI, In Chrome, letter-spacing: 0 computes to "normal". https://codepen.io/AmeliaBR/pen/73997f70e22754a85e0e6f83c5c1daf1?editors=1111
<dael> myles: okay
<fantasai> AmeliaBR: that's a *problem*
<AmeliaBR> (In Edge & Firefox, it computes to 0px)
<dael> astearns: It's work for each engine to change from computing to normal to compute to 0. Seems like we have at least 3 engines computing to normal. I'm not sure there's enough value to justify the work.
<dael> fantasai: AmeliaBR points out a test case where Blink computes 0 to normal and that shouldn't happen.
<dael> astearns: That's a bug.
<dael> dbaron: My be a sign that the animation thing works.
<dael> astearns: And if anyone depends on that working in Chrome it might be worth the effort.
<dbaron> s/My/May/
<dael> astearns: We'd have to see if any other engine has a bug.
<dael> fantasai: So make the spec match impland if people come back with use cases we can change back
<dael> astearns: Change spec to say normal computes to normal.
<dael> astearns: Obj?
<dael> Rossen_: We resolved on this 2 weeks ago. I'm fine resolving again.
<dael> fantasai: Might have been a different property.
<dael> myles: Are we trying to change semantics or computed value?
<dael> astearns: Just computed. We're chaning the spec for the computed value to match impl.
<dael> Rossen_: And what AmeliaBR points out that chrome...edge computes to normal as well.
<dael> florian: Why?
<dael> Rossen_: The web needs to work
<dael> fantasai: noooooo...that's bad.
<dael> astearns: 0 computing to normal seems like you'd lose information.
<dael> florian: They do the same thing so not really...
<dael> Rossen_: I can fix the bug if there's a similar fix in other engines.
<dael> Rossen_: I'm all for resolving here. I just want to point out what the irc states about Edge is not correct.
<dael> myles: I tested in webkit you set 0 and computed returns normal.
<dael> Rossen_: There's a codepen from AmeliaBR
<dael> florian: So only FF does normal to normal and 0 to 0?
<dael> Rossen_: Yes.
<dael> florian: Why????
<dael> astearns: Probably they mathced another engine
<AmeliaBR> In my testing, Edge v16 is returning 0px. So they must have changed for v17, if that's what Rossen is seeing.
<dael> florian: If we've got 3 engines doing it there might be a reason. A compat reason.
<Rossen_> dael, thank you for adding the drama in the IRC notes!!! :)
<dael> fantasai: Gecko hassn't changed to do this thing. That's good enough reason to say the spec doesn't want that.
<dael> astearns: Edge made the change recently so Rossen_ you might be able to find out why the change was made.
<dael> Rossen_: I would guess interop issue. I could go through finding hte bug. We're not going to go back to be 0 and break interop to comply to the spec if the web doesn't do that.
<fantasai> Computing zero to 'normal' makes *no sense*
<dael> Rossen_: you need to lobby with Chrome and Webkit and then we'll fix.
<dael> astearns: The question of what normal computes to I can see the value of computing to 0 for animations. I don't think it's worth it. I don't see the value of 0 computing to normal. That seems like matching for matching
<dael> laim: Is normal required to be 0? You can't do smaller spacing?
<dael> florian: That would be a violation
<dael> fantasai: You could change spec to allow that. If normal computes to itself it can be different then 0. It could do what liam says and take into account optical sizes and adjust inter-letter spacing if font says that for example
<dael> fantasai: I don't think we have fonts that do that or impl that do that so normal and 0 are eq. but could be different.
<dael> florian: We're got what does normal compute to and lots of people compute to normal. 0 computing to normal is separate thing.
<dael> dbaron: The 0 computing to normal might happen at level of getComputedStyle
<dael> myles: Exactly. In our impl when we represent letter spacing it's a float. We don't store extra information to know if it was normal. It's one float until we produce the getComputedStyle and if it's 0 we write normal.
<dael> Rossen_: I think same for us.
<AmeliaBR> So "normal" would be the "used value" for a computed value of 0?
<dael> fantasai: That makes sense. If they want to store as a float that's fine. Computed value of 0 should be 0 and have normal compute away. Turning ino a keyword in the middle makes no sense
<dael> florian: Should we say in addition to normal compute to 0 resolved value may or must be normal?
<dael> florian: If everybody does it...
<dael> fantasai: Gecko isn't. If this is an impl issue where they're not storing enough information to know if it's was normal or 0 they should output 0. It just requires no special case in getComputedStyle
<dael> florian: There may be a set of scripts expecting it.
<dael> fantasai: If that script exists we can reconsider. Gecko doesn't do it.
<dael> dbaron: More likely is a script that looks at getComputedStyle to know if it's the initial value. It looks for normal asn says ofh that's the initial value
<dael> florian: If Gecko hasn't heard it's not that bad.
<dael> dbaron: All browsers agree is if you set nothing getComputedStyle returns normal.
<dael> astearns: This has taken a lot of time.
<dael> astearns: I suggest we resolve on computed value of normal, change the spec to say normal if the computed value of normal.
<dael> florian: computed value of normal is 0 [missed] for animation it's 0.
<dbaron> I think the best option may be to leave the spec as it is... if one of the non-Gecko browsers is willing to change.
<dael> astearns: Do we want impl detail of how this is stored?
<dael> fantasai: You can tell if you're doing that based on how it animates. It's about what computed style is. We're down to the spec if fine to say letter spacing normal computes to 0. Now we need to know if getComputedStyle value becomes the string normal and that's a web compat question.
<fantasai> s/value/value of zero/
<dael> Rossen_: Take the two issues separately. First one I think is easier. getComputedStyle value of letter spacing spec as normal should be normal. I think that's the original thing we wanted to resolve.
<dael> fantasai: The question was the computed value which isn't the same thing.
<dael> fantasai: All impl currently if you spec letter-spacing:0 they storoe computed value of 0. They may or may not return getComputedValue of 0. It may convert to normal during that call.
<dael> fantasai: Several impl store it as a number. Gecko makes a distinction between spec as nomrl and spec as 0.
<myles> dbaron: so you just have the extra bit just for getComputedStyle?
<dbaron> myles, I think so
<dael> fantasai: All impl if you spec 0 they store 0. Gecko stores normal if you spec normal. During getComputedStyle API call there are several impl that convert 0 to report at normal. Gecko returns the keyword or 0 depending on what spec.
<dael> florian: Ideally waht we want is everyone to converge to computing normal to 0 but there may be web compat issue on that. Maybe have people that recently changed figure out why and we can see if the web compat is managable or not.
<dael> myles: If we're going to resolve we shouldr esolve on what 3 or 4 browsers do.
<dael> florian: It's insane
<dael> myles: But 3 or 4 do it.
<dael> florian: But 4th doesn't so it's not required.
<myles> s/or/of/
<dael> Rossen_: Are you going to try and spec text that will set right expectation for authors or write academic papers.
<dael> florian: If we have a dependency we write that. We have a browser that doesn't do it.
<dael> Rossen_: Let me give an example. If you recall the flexbox % for top and bottom padding it was done only for web compat. We want the web to work and applications to use the web.
<dael> fantasai: No one disagrees.
<dael> Rossen_: If we spec something not in any browser but FF do you expect anyone will change?
<dael> florian: You're making 2 arguments. The web compat I agree. The fact that FF doesn't do it we're not locked on. I would prefer doing the sane thing if we're not locked.
<dael> florian: It's not necessarily a web compat problem because not everyone does the same thing. Given that we may not be stuck I'd prefer to try and do the sane thing.
<fantasai> Specifying 'letter-spacing: 0', having it behave as zero (observable from animations), and having getComputedStyle returning 'normal' is very weird
<dael> astearns: I'd like to go back to dbaron on IRC where he thinks best option is leave spec as is where computed value should be absolute lengths. I believe that would require Gecko to change to leave off the normal value, but he mentioned non-Gecko browsers would need to change.
<dael> astearns: I think what florian said is we need to find out if this is a web compat thing.
<dael> florian: Someone will h ave to change any way.
<dael> ??: Absent compat data engines won't change.
<dbaron> s/??/hober/
<dael> hober: Absent compelling data that one is preferable three engines win. It doesn't matter if it makes sense.
<tantek> can't even find a bug in bugzilla on this for compat reasons
<dael> hober: I don't see why we're still arguing.
<tantek> does this affect transitions?
<dael> astearns: I think we're arguing because it's a hard pill to spec behavior that we think has no value.
<dael> florian: We have to add things to the spec to add the special case.
<dael> fantasai: I think it's not a benefit to authors that if they spec letter spacing 0 and get back normal.
<tantek> tangentially related: https://bugzilla.mozilla.org/show_bug.cgi?id=694834
<dael> dbaron: I think the other thing that makes sense it spec the computed value is a number. In getComputedStyle a computed value of 0 serializes to normal and not extend that to computed style map.
<dael> fantasai: If we spec this that's how we have to spec this. When you spec 0 computed is 0. It's only the getComputedStyle call that is normal. This is a resolved value quirk we have to put in. If it's not required by web compat I'd rather not do that. If this is just how people just cheated it in I'd rather not.
<dael> dbaron: I think hober is right. it's not worth the energy we'd need to deal witht he compat changes to fix this.
<dael> astearns: You're will ing the expend the energy to match?
<dael> dbaron: Yeah.
<dael> astearns: Proposal is we have spec say computed value of letter-spacing is absolute length. There's a quite to getComputedStyle where 0 serializes to normal and that doesn't extend to the computed style map
<dael> astearns: Obj?
<dbaron> s/quite/quirk/
<dael> RESOLVED: We have the spec say computed value of letter-spacing is absolute length. There's a quirk to getComputedStyle where 0 serializes to normal and that doesn't extend to the computed style map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment