Closed Bug 1646028 Opened 4 years ago Closed 4 years ago

Make the BoxModelHighlighter compatible with Fission

Categories

(DevTools :: Inspector, task, P1)

task

Tracking

(Fission Milestone:M6c, firefox82 fixed)

RESOLVED FIXED
82 Branch
Fission Milestone M6c
Tracking Status
firefox82 --- fixed

People

(Reporter: rcaliman, Assigned: rcaliman)

References

(Blocks 1 open bug)

Details

(Whiteboard: dt-fission-m2-mvp)

Attachments

(9 files, 2 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
No description provided.
Blocks: dt-fission-inspector
No longer blocks: 1568827
Severity: -- → N/A
Priority: -- → P3

Depends on D81528

Blocks: 1623667
Fission Milestone: --- → M6b
Depends on: 1607756
Whiteboard: dt-fission-m2-mvp
Priority: P3 → P1
Assignee: nobody → rcaliman
Status: NEW → ASSIGNED

Depends on D81525

Introduced a centralized way in HighlightersOverlay to invoke highlighters by type, automatically managing previously active highlighters.

First some context.
HighlightersOverlay is a bit of a misnomer. It already does a few things:

  • provides methods to manually invoke some highlighters (Flex/Grid/Shapes/BoxModel)
  • provides a way to delegate mouse events from Rules view / Computed view / Markup and invoke highlighters based on the event's target node
  • manages state of Flex/Grid highlighters to be able to restore them on page refresh
  • exposes the node that is highlighted by a particular highlighter
  • misc handlers for events that require hiding highlighters by type (ex mutation events)

The changes in this patch add the core functionality which will automatically manage the visibility of highlighters regardless of their node's host frame:

  • this._activeHighlighters is a Map which maps a highlighter type to the currently visible highlighter instance and its corresponding NodeFront
  • showHighlighterTypeForNode(type, nodeFront, options) invokes a highlighter type for a given NodeFront while toggling off any existing highlighter for that type. For situations where multiple highlighters of the same type can be visible at the same time (ex: Grid), this is where we could manage their visibility.
  • hideHighlighterType(type) hides all highlighters of a given type; can be followed-up with a more specific hideHighlighterTypeForNode() when needed
  • getNodeForActiveHighlighter(type) returns the NodeFront currently highlighted by a highlighter type. This is an abstracted replacement for flexboxHighlighterShown, geometryEditorHighlighterShown, etc.
Accommodation for tests

To mitigate the fact that many tests and some consumers expect exact event names to be fired, like "box-model-highlighter-shown", instead of generic shown/hidden events with the highlighter type property as event data, we introduce a temporary map, HIGHLIGHTER_EVENTS, from which we pick the event to fire according to the highlighter type. As we progress in refactoring, the intent is for this map to slowly go away.

Intent for refactoring

The intent is for all client-side consumers to invoke highlighters via these methods. For example:

this.inspector.highlighters.showHighlighterTypeForNode(
      "BoxModelHighlighter",
      nodeFront
    )

See another example of this in the migration of FlexboxHighligther in D79694.

Future plans

In the medium-term, it's likely we'll move this part of HighligthersOverlay from inspector to toolbox and rename it HighlightersManager. This way, other consumers, like Debugger and Console can also use it instead of the existing approach. Haven't attempted this yet. Pending updates to the Flexbox, Grid, Shapes and CSS Transform highlighters so when we migrate paths from inspector.highlighters to ⭐️ toolbox.highlighters is done in one go for all tests and consumers.

Depends on D81526

This patch updates tests pertaining only to node picker behavior. Run one-by-one, they're all expected to pass.

However, running the whole Inspector test suite at this point in the commit series will fail some other tests because:

  • we're updating shared test helpers here without also updating the other tests;
  • there is inter-dependence in the other tests between node picker and markup view which is being migrated to the new highlighters approach in D81530

The rest of the tests are getting updated in D81529 (blocked on D81530).

Fission Milestone: M6b → M6c
Attachment #9160068 - Attachment is obsolete: true
Attachment #9160066 - Attachment is obsolete: true
Blocks: 1572662
Attachment #9167881 - Attachment description: Bug 1646028 - Update Markup view to use Box Model Highlighter → Bug 1646028 - Update Markup view to use Box Model Highlighter. r=jdescottes
Attachment #9167882 - Attachment description: Bug 1646028 - Update Box Model diagram to use Box Model Highlighter → Bug 1646028 - Update Box Model diagram to use Box Model Highlighter. r=jdescottes
Attachment #9167884 - Attachment description: Bug 1646028 - Fix Inspector tests using node reps to use Box Model Highlighter → Bug 1646028 - Fix Inspector tests using node reps to use Box Model Highlighter r=jdescottes
Attachment #9167885 - Attachment description: Bug 1646028 - Hide the correct Box Model Highlighter before a node screenshot → Bug 1646028 - Hide the correct Box Model Highlighter before a node screenshot. r=jdescottes

Depends on D85863

Follow-up for code review https://phabricator.services.mozilla.com/D81526#inline-471516

Renaming existing events emitted on behalf of CssTransformHighlighter to avoid conflict and confusion with the generic show/hide highlighter events introduced in HighlightersOverlay. When migrating the CssTransformHighlighter to the Fission-ready highlighters approach, these event names will go away completely.

Attachment #9174626 - Attachment description: Bug 1646028 - Rename show/hide events for CssTransformHighlighter to avoid conflicts with generic highlighter events. r=jescottes → Bug 1646028 - Rename show/hide events for CssTransformHighlighter to avoid conflicts with generic highlighter events. r=jdescottes
Pushed by rcaliman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b8d122ab6cca Add generic highlighter manager to HighlightersOverlay. r=ochameau https://hg.mozilla.org/integration/autoland/rev/41f041e761d2 Update Node Picker to use Box Model Highlighter. r=ochameau,jdescottes https://hg.mozilla.org/integration/autoland/rev/1a827ef694de Add test helpers for waiting on highlighter events r=jdescottes https://hg.mozilla.org/integration/autoland/rev/6faaa43b8581 Update Markup view to use Box Model Highlighter. r=jdescottes https://hg.mozilla.org/integration/autoland/rev/ea3f6fd17ccf Update Box Model diagram to use Box Model Highlighter. r=jdescottes https://hg.mozilla.org/integration/autoland/rev/f244dea69b4b Update Animation Inspector to use Box Model Highlighter r=jdescottes https://hg.mozilla.org/integration/autoland/rev/42e5958e33dd Fix Inspector tests using node reps to use Box Model Highlighter r=jdescottes https://hg.mozilla.org/integration/autoland/rev/75a8335648a8 Hide the correct Box Model Highlighter before a node screenshot. r=jdescottes https://hg.mozilla.org/integration/autoland/rev/19e4fcbb39f6 Rename show/hide events for CssTransformHighlighter to avoid conflicts with generic highlighter events. r=jdescottes
Blocks: 1665341
Regressions: 1667368
Regressions: 1670498
Blocks: 1675226
Blocks: 1680931
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: