[css-properties-values-api] Registered property dependency cycles with font/line-height relative units
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox123 | --- | fixed |
People
(Reporter: zrhoffman, Assigned: dshin)
References
(Blocks 1 open bug, )
Details
Attachments
(3 files)
Registered custom properties follow the same rules for dependency cycle resolution as unregistered custom properties, with the following additional constraints:
For any registered custom property with a <length> or <length-percentage> syntax component:
If the property contains any of the following units: em, ex, cap, ch, ic, lh; then add an edge between the property and the font-size of the current element.
If the property contains the lh unit, add an edge between the property and the line-height of the current element.
If the property contains any of the following units: rem, rlh; then add an edge between the property and the font-size' of the root element.
If the property contains the rlh unit, add an edge between the property and the line-height' of the root element.
For example, given this registration:
CSS.registerProperty({ name: "--my-font-size", syntax: "<length>", initialValue: "0px", inherits: false });
the following will produce a dependency cycle:
div { --my-font-size: 10em; font-size: var(--my-font-size); }
and font-size will behave as if the value unset was specified.
Reporter | ||
Comment 1•1 year ago
|
||
As noted in https://github.com/w3c/css-houdini-drafts/issues/1080:
- Dependency cycles need to be checked for properties with every syntax except
*
, not just<length>
and<length-percentage>
- We will need to add an edge to every font-* property, not just
font-size
.
Reporter | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 2•11 months ago
|
||
Assignee | ||
Comment 3•11 months ago
|
||
Registered custom properties may utilize font-relative units such as em
,
ex
, etc. Font-related properties (More with calc()
unit algebra), in
turn, may refer to such registered custom properties, leading to a cycle
(Note, unregistered properties are effectively copy-pastes, so it does not
suffer from this issue).
This patch:
- Defers computation of registstered custom properties using font-relative
units - Keeps track of custom properties utilizing font-relative units
- Keeps track of non-custom, font-related properties making variable
references - Expands the cycle detection to non-custom properties
Because of 1, this patch causes registered custom property using
font-relative units to resolve as if they're unregistered - this will be
addressed in the next patch.
Depends on D196193
Assignee | ||
Comment 4•11 months ago
|
||
Resolution of such custom properties (And other properties depending on them)
must take place after font-related properties (Which are prioritary) are
resolved. Resolution of custom properties is therefore split into two phases,
before and after prioritary properties are resolved.
Depends on D196194
Updated•11 months ago
|
Comment 7•10 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a965e291d156
https://hg.mozilla.org/mozilla-central/rev/9514e79f3209
https://hg.mozilla.org/mozilla-central/rev/be11cd2890f6
Description
•