csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-rhythm][css-values-4] Figure out the interaction between line-height-step and the lh and rlh units

Open frivoal opened this issue 8 years ago • 12 comments

The line-height-step property influences the line height.

The lh and rlh units depend on the line height.

We need to define if the property influences the units. I think it should.

frivoal avatar Jan 16 '17 08:01 frivoal

The line-height-step property changes the algorithm to compute the line height. If lh resolves to a used line height, it should. I haven't given enough thoughts if a unit can refer to a used line height but AFAIU you and tab were discussing it, right?

kojiishi avatar Jan 23 '17 09:01 kojiishi

Currently, lh is specified to refer to the computed line height. Can we move all this to computed time?

It seems to me that if we wanted to depend on the actual adjusted line height taking the content into account, we would need to do everything at used value time.

However, at computed value time, it should be possible to take the height of an empty line as adjusted by line-height-step. That sounds better to me than having units that resolved at used value time, which seems like a pretty big headache.

frivoal avatar Apr 07 '17 02:04 frivoal

(sorry for closing and reopening. I just meant to comment and mis-clicked).

frivoal avatar Apr 07 '17 02:04 frivoal

Also, we need to define what the lh and rlh units mean when used in the line-height-step property. I think they should give the non-adjusted / natural line height.

frivoal avatar Apr 07 '17 03:04 frivoal

Any use cases to prefer that?

@MurakamiShinyu

kojiishi avatar Apr 07 '17 09:04 kojiishi

Agreed with frivoal on the points.

Koji, we can't use used-value inputs into units, because they compute to absolute lengths at computed value time...

fantasai avatar Apr 07 '17 17:04 fantasai

Blink has the same constraints, can't use used-value to compute styles, that's ok.

I'm just curious, when we have a choice to round up during the style recalc, and @frivoal preferred not to do that IIUC, that what the reasons behind it.

kojiishi avatar Apr 09 '17 18:04 kojiishi

  • lh (and rlh) should reflect the size of the line-height adjusted by line-height-step, otherwise they are not usable. I will be typical to want a padding or a margin to be sized a a multiple (often 1, but not always) of the line height. For this to work, it must be the adjusted line height. Of course, each individual line may end up being different sizes depending on what's in them, but the basic step size of the rhythm is what matters here.

  • when we do that, we need to break the cycle that is introduced by trying to use lh as a value in line-height-step (and rlh in line-height-step on the root element). I can think of two solutions:

    1. use the (adjusted) line-height from the parent element
    2. use the non-adjusted line-height from the current element.

    I don't have data to support me, and I think I at this point I could go either way, but (ii) seems more useful.

frivoal avatar Apr 10 '17 05:04 frivoal

I see, you're talking about cycles.

Can we do something like what we do for em?

kojiishi avatar Apr 11 '17 10:04 kojiishi

This was discussed during a conf call, and generally agreed about. Someone now needs to write the proposed edits. (Could be me, @fantasai @tabatkins ...)

frivoal avatar Apr 18 '17 07:04 frivoal

What was the agreement referred to above?

lilles avatar Oct 12 '22 12:10 lilles

Ohh, talk about a backlog… sorry for the "small" delay. I believe the relevant minutes are these ones: https://lists.w3.org/Archives/Public/www-style/2017Apr/0027.html The summary is:

The proposed solution is lh includes calculation of line-height-step and if lh is used in line-height-step property, it refers to unadjusted line-height property.

The details are in the minutes.

frivoal avatar Oct 19 '22 15:10 frivoal