Closed Bug 1639852 Opened 1 year ago Closed 1 year ago

Make inspector be more granular regarding pseudo-elements.


(DevTools :: Inspector: Rules, enhancement)



(firefox78 fixed)

Firefox 78
Tracking Status
firefox78 --- fixed


(Reporter: emilio, Assigned: emilio)




(1 file, 1 obsolete file)

In bug 1635675 and bug 1639756 I'm changing our UA sheets (one because I'm adding a web-exposed pseudo-element, another because I'm just rejiggering stuff).

Part of what I did was making some selectors a bit less redundant, like going from:

textarea::placeholder, input::placeholder

To just ::placeholder, as the engine knows how to only match placeholder rules in some cases.

This however trips some inspector tests, because now stuff starts matching when it didn't use to, and inspector tries to match every pseudo-element against every element.

This is, in fact, very annoying when you have the "Show browser styles" setting applied, as you get pseudo-elements for all sorts of stuff even though you're just looking at, e.g., a div.

Inspector could do better and only query pseudo-elements that are known to be useful. This may even reduce the work substantially enough that enabling collection of UA rules by default may be feasible, who knows :)

This is a bug that I noticed before my patch. Consider the following

input[type=file], ::file-picker-button {
color: red;

When matching an <input type=file>, you really want to keep both rules.
One matches a pseudo-element and one doesn't.

This caused failures in browser_rules_user-agent-styles.js with my
patches for bug 1639756 and bug 1635675, because this reuse logic was
choosing one rule, while the logic in the test was choosing another.

This prevents showing e.g. ::cue pseudo-elements for elements that are
not videos, and such.

This is useful on its own, but it's going to be even more useful because
I'm making some rules in the UA sheets less specific in the blocking

For example, after my patches, the number of expected rules in
test_styles-applied was 24 (instead of 9 with this patch). That's just
too much noise.

Depends on D76307

Attachment #9150732 - Attachment is obsolete: true
Pushed by
Don't collect pseudo-element rules for pseudo-elements that cannot apply. r=rcaliman
Depends on: 1640631
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.