Closed Bug 1588773 Opened 5 years ago Closed 5 years ago

Use ContentDOMReference for "Inspect Element"

Categories

(DevTools :: Inspector, task, P3)

task

Tracking

(firefox72 fixed)

RESOLVED FIXED
Firefox 72
Tracking Status
firefox72 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 3 open bugs)

Details

Attachments

(2 files)

For the "Inspect Element" feature available in the regular context menu opened on content pages, we currently compute the selectors needed to target the element on which the user clicked and pass this list of selectors to DevTools.

(note we have several selectors to accommodate for iframes/webcomponents).

Some pointers to the existing code:

All this logic relies on the findAllCssSelectors and getSelectorParent from css-selector.js that will no longer work in a Fission setup. So it would be nice to update to switch to another API before that.

Also if anything in the page changes after right clicking and invalidates the selector, the current approach will fail to highlight the good node, while the ContentDOMReference would be able to do it.

Depends on D48808

Using ContentDOMReference instead of creating an array of selectors makes inspect element more stable in case the page is modified between after the contextmenu opens.
It will also make the feature easier to make fission compatible

Depends on D49303

Some methods from css-logic were extracted from the devtools codebase to be used by context-menu files.
This was only needed in order to compute the css-selectors for Inspect Element.
If we use ContentDOMReference instead, those helpers can move back in the devtools codebase
(leaving them in css-selector.js fails the all-files-referenced test for some reason as well)

Blocks: 1589320
Depends on: 1590050
Blocks: 1590392
Blocks: 1399045
Blocks: 1568822
Blocks: 1360136
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a69208bb8c1a
Use ContentDOMReference for context menu Inspect Element r=mconley,pbro
https://hg.mozilla.org/integration/autoland/rev/ee250b40876e
Move css-selector.js helpers back to DevTools css-logic.js r=pbro
Blocks: 1591960
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: