Skip to content

Commit 1fed9d8

Browse files
committed
[css-values] First stab at trying to fix the definition of compatible units... deal with 'em' units in example of multiplicative factor, and split out used values because they additional combine percentages/numbers/keywords/etc.
1 parent b881fc2 commit 1fed9d8

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

css-values/Overview.bs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,15 +808,27 @@ Numbers with Units: <a>dimensions</a></h3>
808808
resolutions (<<resolution>>),
809809
and other quantities.
810810

811-
When serializing <a lt="computed value">computed</a> and <a>used values</a>,
811+
<h3 id="compat">
812+
Compatible Units</h3>
813+
814+
When serializing <a>computed values</a>,
812815
<dfn export local-lt=compatible>compatible units</dfn>
813816
(those related by a static multiplicative factor,
814817
like the 96:1 factor between ''px'' and ''in'',
815-
or the 1000:1 factor between ''ms'' and ''s'')
818+
or the the computed 'font-size' factor between ''em'' and ''px'')
816819
are converted into a single <dfn export local-lt=canonical>canonical unit</dfn>.
817820
Each group of compatible units defines which among them is the <a>canonical unit</a>
818821
that will be used for serialization.
819822

823+
When serializing <a href="https://www.w3.org/TR/cssom-1/#resolved-values">resolved values</a>
824+
that are <a>used values</a>,
825+
all value types (percentages, numbers, keywords, etc.)
826+
that represent lengths are considered <a>compatible</a> with lengths.
827+
Likewise any future API that returns <a>used values</a>
828+
must consider any values represent distances/durations/frequencies/etc.
829+
as <a>compatible</a> with the relevant class of <a>dimensions</a>,
830+
and canonicalize accordingly.
831+
820832
<!--
821833
██ ████████ ██ ██ ██████ ████████ ██ ██
822834
██ ██ ███ ██ ██ ██ ██ ██ ██
@@ -1608,7 +1620,7 @@ Computed Value</h4>
16081620
in particular, all ''calc()'' expressions can be reduced
16091621
to a sum of a <<number>>, a <<percentage>>, and some <<dimension>>s,
16101622
eliminating all multiplication or division,
1611-
and combining identical units.
1623+
and combining terms with identical units.
16121624

16131625
At this time, all units can be absolutized
16141626
to a single unit per type at computed-value time,

0 commit comments

Comments
 (0)