Skip to content

[css-values-4] Cyclic dependency between lh and font-relative units #9018

Closed
@xiaochengh

Description

@xiaochengh

The spec only covers two cases of cyclic dependency:

  • Font-relative units used in font-size
  • lh/rlh used in line-height

There are more cases that are not covered:

  1. Font-relative units used in other font properties that affect font selection, e.g., font-weight: calc(10ex / 1px)
  2. Dependency cycle formed by font properties and line-height, e.g., line-height: 2em; font-size: 1lh

(Edit: 2 is already covered, as lh is considered a font-relative length unit)

Right now (1) isn't surfaced in any browser because no one supports calc(10ex / 1px) yet. But this will also surface if functions like atan2() and sign() that can convert a <length> into a non-length type is properly implemented. This has also been discussed in #8169

For (2), currently Blink and WebKit are breaking the cycle by using parent's line height to compute fon-size (see (test case)[https://jsfiddle.net/3rojdnsc/]). Gecko hasn't implemented lh yet.

I don't have a strong opinion on how exactly the cycle should be broken, and I guess it doesn't matter because there's no real use case with such dependency cycles. We just need a solution for spec completeness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions