Closed Bug 1855110 Opened 1 year ago Closed 8 months ago

[css-properties-values-api] Registered property dependency cycles with font/line-height relative units

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
123 Branch
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.

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.
Blocks: 1856522
Assignee: nobody → dshin
Blocks: 1865655
Summary: [css-properties-values-api] Registered property dependency cycles → [css-properties-values-api] Registered property dependency cycles with font/line-height relative units
Depends on: 1868436

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:

  1. Defers computation of registstered custom properties using font-relative
    units
  2. Keeps track of custom properties utilizing font-relative units
  3. Keeps track of non-custom, font-related properties making variable
    references
  4. 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

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

Attachment #9368226 - Attachment description: Bug 1855110: Part 1 - Don't use CSSOM in `unit-cycles.html` WPT test. r=#style → Bug 1855110: Part 1 - Don't use CSS Typed OM in `unit-cycles.html` WPT test. r=#style
Depends on: 1871540
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a965e291d156 Part 1 - Don't use CSS Typed OM in `unit-cycles.html` WPT test. r=firefox-style-system-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/9514e79f3209 Part 2 - Track and mark dependency cycles between custom properties and font-related properties. r=firefox-style-system-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/be11cd2890f6 Part 3 - Properly resolve registered custom properties using font-relative units. r=firefox-style-system-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44023 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
Regressions: 1875673
Blocks: 1864818
Duplicate of this bug: 1866917
No longer duplicate of this bug: 1866917
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: