Closed Bug 1840987 Opened 11 months ago Closed 5 months ago

Consider supporting non-inherited custom properties

Categories

(DevTools :: General, defect, P3)

defect

Tracking

(firefox122 fixed)

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: zrhoffman, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

Currently, DevTools assumes in at least one place that custom properties are inherited.

However, registered custom properties can be specified to not inherit.

Blocks: 1841021
No longer blocks: css-properties-values-api

Depends on Bug 1840478 for platform support

Depends on: 1840478

On this page: data:text/html,<meta charset=utf8><style>@property --b { syntax: '<color>'; inherits: false; initial-value: gold; }%20 main { --b: cyan; } div { background: var(--b); }%20 </style><main>hello<div>world</div></main><div>OUT</div>

Inspecting the "world" <div> (that should have a gold background, the initial value of --b), we shouldn't see the --b: cyan from the main rule as being inherited.


We don't have a lot of information at the moment. We should add a property in the declaration object (that we compute on the server), that would indicate that we're dealing with a non-inherits custom property.

That means that we need to have a way to know when a custom property does not inherit. The spec doesn't seem to indicate any native way of doing this (e.g. there's no CSS.customProperties that would return a list of all the PropertyDefinition that were registered.

Severity: -- → S3
Priority: -- → P3

Since registered custom properties can be specified to not inherit,
DevTools need to retrieve this information in order to display accurate
data in the rules view.
The method signature is changed and now take a Document so we can lookup
the registry.
The existing test is updated with registered and unregistered custom properties.

Next patch in queue handles the impact in DevTools code.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Remove the specific callsites where we were making such assumption, and update
the calls to InspectorUtils.isInheritedProperty to pass a document, since it's
now required to check if custom properties inherit.

Depends on D194629

Comment on attachment 9365369 [details]
Bug 1840987 - Make InspectorUtils.isInheritedProperty check property definition in custom properties registry. r=zrhoffman.

Revision D194629 was moved to bug 1866707. Setting attachment 9365369 [details] to obsolete.

Attachment #9365369 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bf44380b0901
[devtools] Don't assume CSS variables always inherit. r=devtools-reviewers,ochameau.
https://hg.mozilla.org/integration/autoland/rev/e79bd3724b5b
[devtools] Ignore non-inheriting custom properties when computing CSS variable value. r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: