Skip to content

Commit b3b3292

Browse files
committed
[css-values-4] Correctly fix cyclic definitions with font-relative units. #2115
1 parent 2c4135c commit b3b3292

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

css-values-3/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ Relative lengths</h3>
919919
<h4 id="font-relative-lengths">
920920
Font-relative lengths: the ''em'', ''ex'', ''ch'', ''rem'' units</h4>
921921

922-
The <dfn export id="font-relative-length">font-relative lengths</dfn> refer to the font metrics of the element on which they are used,
922+
The <dfn export id="font-relative-length">font-relative lengths</dfn> refer to the font metrics of the element on which they are used--
923923
or, in the case of ''rem'', the metrics of the root element).
924924

925925
<dl export dfn-type=value dfn-for="<length>">

css-values-4/Overview.bs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ Relative lengths</h3>
933933
<h4 id="font-relative-lengths">
934934
Font-relative lengths: the ''em'', ''ex'', ''cap'', ''ch'', ''ic'', ''rem'', ''lh'', ''rlh'' units</h4>
935935

936-
The <dfn export id="font-relative-length">font-relative lengths</dfn> refer to the font metrics of the element on which they are used,
936+
The <dfn export id="font-relative-length">font-relative lengths</dfn>
937+
refer to the font metrics of the element on which they are used--
937938
or, in the case of ''rem'' and ''rlh'', the metrics of the root element.
938939

939940
<figure>
@@ -1033,22 +1034,24 @@ Font-relative lengths: the ''em'', ''ex'', ''cap'', ''ch'', ''ic'', ''rem'', ''l
10331034
Equal to the computed value of 'font-size' on the root element.
10341035
When specified on the 'font-size' property of the root element,
10351036
the ''rem'' units refer to the property's <em>initial value</em>.
1037+
10361038
<dt><dfn id="lh" lt="lh">lh unit</dfn>
10371039
<dd>
10381040
Equal to the computed value of the 'line-height' property of the element on which it is used,
1039-
converted to an absolute length by measuring the height of a line box containing only the strut (See [[CSS2/visudet#strut]]) would have.
1041+
converting ''line-height/normal'' to an absolute length
1042+
by using only the metrics of the <a href="https://www.w3.org/TR/css3-fonts/#first-available-font">first available font</a>.
10401043

10411044
<dt><dfn id="rlh" lt="rlh">rlh unit</dfn>
10421045
<dd>
10431046
Equal to the computed value of 'line-height' property on the root element,
1044-
converted to an absolute length by measuring the height of a line box containing only the strut (See [[CSS2/visudet#strut]]) would have.
1047+
converting ''line-height/normal'' to an absolute length as above.
10451048

1046-
Note: setting the 'height' of an element using either the ''lh'' or the ''rlh'' units
1049+
Note: Setting the 'height' of an element using either the ''lh'' or the ''rlh'' units
10471050
does not enable authors to control the actual number of lines in that element.
10481051
These units only enable length calculations based on the theoretical size of an ideal empty line;
10491052
the size of actual lines boxes may differ based on their content.
10501053
In cases where an author wants to limit the number of actual lines in an element,
1051-
the 'max-lines' property shall be used instead.
1054+
the 'max-lines' property can be used instead.
10521055
</dl>
10531056

10541057
Issue: We can potentially add more typographic units,
@@ -1060,15 +1063,24 @@ Font-relative lengths: the ''em'', ''ex'', ''cap'', ''ch'', ''ic'', ''rem'', ''l
10601063
that it would be worth adding them?
10611064
Or should we just wait for Houdini Custom Units?
10621065

1063-
When used in the value of the 'font-size' property
1064-
(and additionally for the ''lh'' and ''rlh'' units in the 'line-height' property)
1065-
on the element they refer to,
1066-
these units refer to the computed font metrics of the parent element
1067-
(or the computed font metrics corresponding to the initial values of the 'font' and 'line-height' properties,
1068-
if the element has no parent).
10691066
When used outside the context of an element
10701067
(such as in <a>media queries</a>),
1071-
these units refer to the computed font metrics corresponding to the initial values of the 'font' and/or 'line-height' properties.
1068+
these units refer to the metrics corresponding
1069+
to the initial values of the 'font' and 'line-height' properties.
1070+
When used in the value of the 'font-size' property on the element they refer to,
1071+
they resolve against the computed metrics of the parent element--
1072+
or against the computed metrics corresponding to the initial values
1073+
of the 'font' and 'line-height' properties,
1074+
if the element has no parent.
1075+
Additionally,
1076+
when ''lh'' or ''rlh'' units are used
1077+
in the value of the 'line-height' property on the element they refer to,
1078+
they resolve against the computed 'line-height' and font metrics of the parent element--
1079+
or the computed metrics corresponding to the initial values
1080+
of the 'font' and 'line-height' properties,
1081+
if the element has no parent.
1082+
(The other font-relative units continue to resolve against
1083+
the element’s own metrics when used in 'line-height'.)
10721084

10731085
<!--
10741086
██ ██ ██ ██ ██ ████████ ████████ ██████

0 commit comments

Comments
 (0)