Closed Bug 1546621 Opened 5 years ago Closed 5 years ago

Pseudo-element properties are not marked as overwritten in the rules inspector

Categories

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

defect

Tracking

(firefox-esr60 wontfix, firefox66 wontfix, firefox67 wontfix, firefox68 wontfix, firefox69 verified)

VERIFIED FIXED
Firefox 69
Tracking Status
firefox-esr60 --- wontfix
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- verified

People

(Reporter: cfogel, Assigned: rcaliman)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [dt-q])

Attachments

(3 files)

Attached image pseudoRules.png

Affected versions

  • 67.0b13, 68.0a1 (2019-04-23), 66.0.3, 57.0b9, 52.9.esr

Affected platforms

  • Windows10, Ubuntu 18.04

Steps to reproduce

  1. Launch Firefox, DevTools inspector;
  2. Access https://www.w3schools.com/css/tryit.asp?filename=trycss_firstline
  3. Right Click and inspect on the Red text row from the example;
  4. In the rules tab add multiple color properties

Expected result

  • the previous color(s) become dashed and are no longer marked as active

Actual result

  • no disable indicator for overwritten properties

Regression range

  • will provide one asap;
  • 31.0.a1 is not affected by this issue;

Additional notes

  • attached screenshot with the issue;
  • not limited to the color property, any other from the tested ones have the same behavior for;
Has Regression Range: --- → no
Has STR: --- → yes

Additional context:

The issue manifests when the pseudo-element is not selected. ::first-line doesn't have a correspondent node in the markup view to be selected, but ::before and ::after do. If selecting the pseudo-element directly, not its parent element, the overwritten properties show as expected.

To test, run this in the address bar of a new tab:
data:text/html,<style>div::before { color:red; color:black; content: "TEST" }</style><div>

Open DevTools and inspect the <div>, then Inspect the ::before pseudo-element for the <div>. Notice the different styling on the pseudo-element's declarations in the Rules view.

Priority: -- → P1

The issue manifests when the pseudo-element itself is not selected.

Whiteboard: [dt-q]

Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=3435dd7ad71fe9003bdeee18fd38d815e033beef&tochange=dc4d7f68030e9edd22ad0bb0bd2244d047dd767d

Suspect: 7275ea886739 Nicolas Chevobbe — Bug 1253869 - Don't assume that rule in the Rules view match the selected node when checking for overidden properties. r=gl

Regressed by: 1253869

Hey Gabriel, can you look at this one?

Flags: needinfo?(gl)

Sorry, Nicolas, could you look at this one?

Flags: needinfo?(gl) → needinfo?(nchevobbe)

That's quite an old patch regression :D I may have a look but can't promise anything.
Since it's a P1, feel free to have a look Inspector people :)

I'll take a look at it. I have a bit more exposure to this part of the code.
The P1 priority signifies the intent that we should fix this during this cycle, not that an urgent fix is required. It's on my radar now.

Assignee: nobody → rcaliman
Status: NEW → ASSIGNED
Flags: needinfo?(nchevobbe)
Priority: P1 → P2

We're very close to 68 going to beta, and this is an old regression, let's mark it as fix-optional for 68 then. It would be very nice to fix it sooner rather than later as this is a case where the rule-view is showing incorrect information, so fails at doing its job.

This patch adjust the method which marks CSS declaration as overridden to also consider pseudo-elements when they're not directly selected (i.e. their host element is selected).

For style rules on regular elements, there's a condition to only consider rules that match the selected element. This is done so that unmatched rules (you may get one after renaming a selector in the Rules view) don't influence the remaining matching rules. For pseudo-elements, this strict check caused pseudo-element rules to not show overridden declarations if they weren't directly selected in the markup view. For some types of pseudo-elements, it is impossible to ever select their nodes in the markup view because they don't exist, for example ::first-line, ::selection, ::first-letter, etc.

Also introduced an optimization to not call the logic to mark declarations as overridden for non-existent pseudo-elements. The previous code ran a minimum of 17 times, once for every entry in cssProperties.pseudoElements array which includes the full dictionary of pseudo-elements supported by Firefox.

Pushed by rcaliman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2901438abf7c
Ensure pseudo-element declarations are marked as overridden when host element is selected. r=pbro
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69

Is this something we should consider for Beta uplift or can this ride the trains?

Flags: needinfo?(rcaliman)
Flags: in-testsuite+

I believe this can safely ride the trains. It touches some sensitive code and it would be beneficial to let it go in slowly and notice any potential new bugs.

Flags: needinfo?(rcaliman)

Fix confirmed with 69.0a1 (2019-07-01) on Windows 10, macOS 10.11, Ubuntu 16.04.

Status: RESOLVED → VERIFIED
Has Regression Range: no → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: