Closed Bug 1262425 Opened 9 years ago Closed 1 month ago

Computed padding value doesn't appear in the computed-styles tab when the value comes from a css variable

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(firefox148 fixed)

RESOLVED FIXED
148 Branch
Tracking Status
firefox148 --- fixed

People

(Reporter: pbro, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

(Whiteboard: [btpp-backlog])

Attachments

(1 file, 1 obsolete file)

STR: - Open a new tab with this URL: data:text/html,<style>:root{--size:20px;} div {padding: var(--size);}</style><div></div> - Open the inspector, select the div, and switch to the computed tab ==> The padding value doesn't appear in the list of computed styles. It only appears if you switch the "browser styles" ON.
Filter on CLIMBING SHOES.
Priority: -- → P3
Whiteboard: [btpp-backlog]
See Also: → 1145527
Product: Firefox → DevTools
Component: Inspector: Computed → Inspector
Severity: normal → S3
Duplicate of this bug: 1400046
Duplicate of this bug: 1509619

from (dupe) https://bugzilla.mozilla.org/show_bug.cgi?id=1400046#c1 :

I found out that this bug only appears for shorthand properties. Longhands are displayed as expected.

Blocks: 2003264

When setting a longhand property value using CSS variable, the property value
we get for the shorthand from the rule CSSStyleDeclaration is an empty string.
In such case, we don't want to filter out the property if the "Browser styles"
checkbox is not checked.
In order to fix this, we check for the presence of the property in the CSSStyleDeclaration
instead of checking its truthiness, as CSSStyleDeclaration.getPropertyValue will
return an empty string for non-set properties as well.
We also change a similar check to make sure we include the matched selector, even
if we can't display a meaningful value to the user (see Bug 2003264).

Because of these changes, browser_computed_custom_properties.js needed to be
updated. We change the border we were using to outline because it gives
us less longhand properties to check.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Attachment #9530037 - Attachment description: Bug 1262425 - [devtools] Fix displaying shorthand computed properties whose value depends on longhand using CSS variable. r=#devtools → WIP: Bug 1262425 - [devtools] Fix displaying shorthand computed properties whose value depends on longhand using CSS variable. r=#devtools
Attachment #9530037 - Attachment description: WIP: Bug 1262425 - [devtools] Fix displaying shorthand computed properties whose value depends on longhand using CSS variable. r=#devtools → Bug 1262425 - [devtools] Fix displaying shorthand computed properties whose value depends on longhand using CSS variable. r=#devtools
Attachment #9530630 - Attachment description: Bug 1262425 - [devtools] Add chrome-only CSSStyleDeclaration#hasProperty(propertyName). r=emilio. → Bug 1262425 - [devtools] Add chrome-only CSSStyleDeclaration#hasLonghandProperty(propertyName). r=emilio.
Depends on: 2006255

Comment on attachment 9530630 [details]
Bug 1262425 - [devtools] Add chrome-only CSSStyleDeclaration#hasLonghandProperty(propertyName). r=emilio.

Revision D274933 was moved to bug 2006255. Setting attachment 9530630 [details] to obsolete.

Attachment #9530630 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/19db3bf02015 https://hg.mozilla.org/integration/autoland/rev/8ddcc220e631 [devtools] Fix displaying shorthand computed properties whose value depends on longhand using CSS variable. r=devtools-reviewers,bomsy
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
QA Whiteboard: [qa-triage-done-c149/b148]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: