Add new relative units RCH, REX, RCAP, and RIC
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Tracking
()
People
(Reporter: aja, Unassigned, Mentored)
References
(Blocks 1 open bug, )
Details
(Keywords: parity-chrome, parity-safari)
Expected results:
Add new relative units RCH and REX
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
Also ic
and cap
, and their root-element variants ric
and rcap
.
Comment 2•3 years ago
|
||
This should be sort of straight-forward to implement following the rem code. Just adding more root font metrics in Device
and tracking changes and so on.
Comment 3•3 years ago
|
||
I'm not sure we want to exactly follow the rem
pattern here. AFAICS, for rem
we always record the root font size in Device
during finish_restyle
for the root element, which is OK as it's quite simple -- it's just the computed value of the font-size
property. But retrieving the other metrics ch
, ex
, ic
and cap
, is significantly more work as it requires actually instantiating a font to read metrics from it. I suspect the root-element versions of these units will only rarely be used, so it seems regrettable to always do that work.
Can we instead do something like evaluate them lazily on first use (which will usually not happen), and only then cache the value in Device
?
Comment 4•3 years ago
|
||
We can, though is it really that much work to get the initial font-size metrics for the root element? In particular, won't the initial font metrics ~always be used for layout at some point? Anyways doing it lazily seems doable as well.
Comment 5•3 years ago
|
||
I'd be curious how often the root element's font metrics get used for anything; I'm guessing it may be quite common that a site specifies a bunch of font-*
properties on the body
, and nothing actually refers back to or uses the root's font, but I haven't looked into this deeply.
Updated•1 year ago
|
Comment 6•8 months ago
|
||
Safari and Chrome now support all four of these units as of WebKit preview 179.
Comment 7•3 months ago
|
||
(In other words:) According MDN CSS length
BCD, Firefox is the only* major browser currently lacking support for rcap
, rch
, rex
and ric
units, as of now.
(* Samsung Internet reportedly does supports neither cap
nor rcap
.)
Updated•2 months ago
|
Description
•