Open Bug 1583641 Opened 5 years ago Updated 2 years ago

[InactiveCSS] hints on pseudo-element rules displayed in their binding elements' rules are incorrect

Categories

(DevTools :: Inspector: Rules, defect, P2)

70 Branch
defect

Tracking

(Not tracked)

People

(Reporter: untainsyd, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 2 obsolete files)

Attached image css_hints_bug.png

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

I have been doing web-page and i have tried to align custom <li> dots/bullets for my unordered list and i used "display: inline-block;" and "vertical-align: middle;" for mine task.

Actual results:

Firefox Dev. Tools CSS-hints noticed for me that:
"vertical-align has no effect on this element since it’s not an inline or table-cell element.
Try adding display:inline or display:table-cell. Learn more"

Expected results:

This hints wouldn't have appeared because "vertical-align: middle" works in this case.

Component: Untriaged → Layout: Block and Inline
Product: Firefox → Core
Component: Layout: Block and Inline → Inspector: Rules
Product: Core → DevTools
Summary: In Firefox Developer Edition hints doesn't work correctly → devtools inspector hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work
Summary: devtools inspector hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work → [Inactive CSS] devtools inspector hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work
Blocks: 1540753
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Assignee: nobody → mratcliffe
Status: NEW → ASSIGNED
Summary: [Inactive CSS] devtools inspector hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work → [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work if 'vertical-align' is set on the ::before pseudo-element of a list item
Attached file Test case
Attachment #9100849 - Attachment is obsolete: true
Summary: [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work if 'vertical-align' is set on the ::before pseudo-element of a list item → [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work if 'vertical-align' is set on a ::before pseudo-element
Summary: [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it actually does work if 'vertical-align' is set on a ::before pseudo-element → [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it does if 'vertical-align' is set on a ::before pseudo-element

Changing the description to reflect what the problem here actually is.

Some STRs:

  • Open the test case: attachment 9100855 [details]
  • Open the inspector
  • Select the <div>
  • In the Rules panel, expand the "pseudo elements" section to reveal the div::before rule
    ==> Notice that the vertical-align property is marked as inactive, this is WRONG
  • Now open the div and select the ::before pseudo-element in the DOM tree
    ==> Notice that the same rule in the Rules panel has the vertical-align property marked as active. This is CORRECT.

The problem is the following:

  • When we explicitely select pseudo-element in the DOM tree, everything goes well, because the DOM node and computed style information we pass to the InactiveCSS helper are the right ones.
  • When we only select the parent div element in the DOM tree, but still show the corresponding pseudo-elements rules in the Rules panel, we pass the div and its computed style to the InactiveCSS helper. So we evaluate the inactivity state of the pseudo-element by looking at the div's styles, which is wrong.
Summary: [InactiveCSS] hints that 'vertical-align' won't work on a 'display: inline-block' element when it does if 'vertical-align' is set on a ::before pseudo-element → [InactiveCSS] hints on pseudo-element rules displayed in their binding elements' rules are incorrect

The inactive-property-helper can sometimes be called for properties inside rules
that match pseudo-elements, even though the node being passed is not the pseudo-
element itself.

This happens because the Rules view has a feature whereby selecting, say, a <div>
will show its rules, but also any pseudo-element rules that may be applied that
result in the creation of a pseudo-element inside of it.
So if you have div::before { content: "" } in CSS, then selecting that div will
also show this rule in the Rules view.

This patch adds a check for this case, and when it happens, walks the DOM to
find the right pseudo-element, and then gets its style.

Attachment #9100859 - Attachment is obsolete: true
Assignee: michael → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: