Closed Bug 1278287 Opened 8 years ago Closed 8 years ago

Migrate the style-inspector-menu module (context menus for Rules and Computed view) to the new Menu API

Categories

(DevTools :: Inspector, enhancement, P1)

46 Branch
enhancement

Tracking

(firefox50 verified)

VERIFIED FIXED
Firefox 50
Iteration:
50.3 - Jul 18
Tracking Status
firefox50 --- verified

People

(Reporter: bgrins, Assigned: moby)

References

(Blocks 1 open bug)

Details

(Whiteboard: [devtools-html])

Attachments

(1 file, 6 obsolete files)

Bug 1266478 will convert the main inspector context menu, but the computed and rules views have a different place where menus are created (style-inspector-menu)
Severity: normal → enhancement
Priority: -- → P2
Whiteboard: [devtools-html][triage] → [devtools-html]
Flags: qe-verify?
Priority: P2 → P1
Assignee: nobody → mvonbriesen
Status: NEW → ASSIGNED
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
Not finished, but I wanted a preliminary review before continuing, to see if I've missed anything major.
Attachment #8762216 - Flags: review?(bgrinstead)
Comment on attachment 8762216 [details] [diff] [review]
style-inspector-menu.patch

Review of attachment 8762216 [details] [diff] [review]:
-----------------------------------------------------------------

Good start, see comment in line

::: devtools/client/inspector/shared/style-inspector-menu.js
@@ +74,5 @@
>        // so we need to save the node ourselves.
>        this.styleDocument.popupNode = event.explicitOriginalTarget;
>        this.styleWindow.focus();
> +      this.menu.popup(event.screenX, event.screenY, this.inspector._toolbox);
> +      this._updateMenuItems();

I'd basically remove the _updateMenuItems function and fold it's logic into the _createContextMenuItems function, then call _createContextMenuItems() before calling menu.popup.  The idea being that we recreate the menu from scratch with the correct menuitem state each time before a popup instead of previously, when the menu items were created once, assigned as instance variables, and then modified during the popup event.

This means we can stuff all of the menu creation logic into a single function and remove the DOM modification code.  In this case, the removeContextMenuItems function will also not be needed.
Attachment #8762216 - Flags: review?(bgrinstead) → feedback+
There's a lot of code in _updateMenuItems as well as _updateCopyMenuItems. Instead of removing those functions, can I just call them from _createContextMenuItems?
Flags: needinfo?(bgrinstead)
Also, since you want to create a new menu each time, shouldn't I call _createContextMenu rather than _createContextMenuItems before the popup? Otherwise I'd be appending items to the menu that already exists.
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
Attachment #8762216 - Attachment is obsolete: true
Attachment #8764042 - Flags: review?(bgrinstead)
Flags: qe-verify? → qe-verify+
QA Contact: alexandra.lucinet
Comment on attachment 8764042 [details] [diff] [review]
style-inspector-menu.patch

Review of attachment 8764042 [details] [diff] [review]:
-----------------------------------------------------------------

We discussed in person - this is on the right path.  Tests still need updating.  Also, please make _createContextMenu return a Menu, instead of attaching it onto the instance
Attachment #8764042 - Flags: review?(bgrinstead)
Flags: needinfo?(bgrinstead)
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2ccfe8611197
Attachment #8764042 - Attachment is obsolete: true
Attachment #8764753 - Flags: review?(bgrinstead)
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
fixed eslint errors

try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3067f7923fb0
Attachment #8764753 - Attachment is obsolete: true
Attachment #8764753 - Flags: review?(bgrinstead)
Attachment #8764975 - Flags: review?(bgrinstead)
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
eslint fixes... again
try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a013dd24d84c
Attachment #8764975 - Attachment is obsolete: true
Attachment #8764975 - Flags: review?(bgrinstead)
Comment on attachment 8765006 [details] [diff] [review]
style-inspector-menu.patch

Review of attachment 8765006 [details] [diff] [review]:
-----------------------------------------------------------------

I think this is ready for review now. I don't see anything notable on the try push.
Attachment #8765006 - Flags: review?(bgrinstead)
Comment on attachment 8765006 [details] [diff] [review]
style-inspector-menu.patch

Review of attachment 8765006 [details] [diff] [review]:
-----------------------------------------------------------------

Looking great!  Two more tests that need updating and weren't in our try push b/c they are part of the cliboard suite: browser_styleinspector_context-menu-copy-color_02.js and browser_styleinspector_context-menu-copy-urls.js
Attachment #8765006 - Flags: review?(bgrinstead)
Attached patch style-inspector-menu.patch (obsolete) — Splinter Review
Fixed those two tests. Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6f811b637bdc
Attachment #8765006 - Attachment is obsolete: true
Attachment #8766457 - Flags: review?(bgrinstead)
Comment on attachment 8766457 [details] [diff] [review]
style-inspector-menu.patch

See Comment 13
Attachment #8766457 - Flags: review?(bgrinstead)
Fix eslint problems. Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=488203173774
Attachment #8766457 - Attachment is obsolete: true
Attachment #8766518 - Flags: review?(bgrinstead)
Comment on attachment 8766518 [details] [diff] [review]
style-inspector-menu.patch

Review of attachment 8766518 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good
Attachment #8766518 - Flags: review?(bgrinstead) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/4e695d4a3a84
Migrate the style-inspector-menu module; r=bgrins
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/4e695d4a3a84
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Iteration: --- → 50.2 - Jul 4
Found some potential issues while verifying this fix using latest Nightly 50.0a1, across platforms [1], as it follows:
1. In Computed view, ‘Show MDN Docs’ option via the context menu remains displayed when scrolling up/down.
2. In Computed view, after clicking on ‘Visit MDN page’ link, the tooltip remains visible; Shouldn’t it fade away on click?
3. With Light and Firebug Themes, ‘Visit MDN page’ link has the same color before and after clicking on it. Shouldn't there be a difference between both states (clicked/not clicked) like with the Dark theme? 
4. [Mac OS X only] - there is no hand cursor at mouse over ‘Visit MDN page’ link. 
4.1. Not reproducible with the Dark theme.
5. bug 1285229 is also applicable for both Rules and Computed context menus - the context menu remains displayed when repeatedly right clicking on any elements

All the mentioned inconsistencies are available in this - https://goo.gl/mcbYF4 - screen recording.
 
Maximillian, any ideas? Looking forward for your input regarding the above! Thanks!

[1] Windows 10 64-bit, Mac OS X 10.11.1 and Ubuntu 16.04 64-bit
QA Whiteboard: [qe-dthtml]
Flags: needinfo?(mvonbriesen)
I don't think I am hiding the popup properly in the new patch. I'll see if I can fix these issues. Thanks for the help, Alexandra.
Flags: needinfo?(mvonbriesen)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Iteration: 50.2 - Jul 4 → 50.3 - Jul 18
The MDN Docs popup seems unrelated to the context menu used to open it - I don't think the things from Comment 19 have to do with the work to convert the context menu. Alexandra, did the behavior here change as a result of the bug, or do you see the same behavior in an earlier build?  I believe I see the same thing in Dev Edition.
Flags: needinfo?(alexandra.lucinet)
(In reply to Alexandra Lucinet, QA Mentor [:adalucinet] from comment #19)
> 5. bug 1285229 is also applicable for both Rules and Computed context menus
> - the context menu remains displayed when repeatedly right clicking on any
> elements

I believe the fix in Bug 1285229 will also solve it here
Depends on: 1285229
(In reply to Brian Grinstead [:bgrins] from comment #21)
> Alexandra, did the behavior here change as a result of the
> bug, or do you see the same behavior in an earlier build?  I believe I see
> the same thing in Dev Edition.

None of the mentioned issues are recent regressions - also reproducible with latest Developer Edition 49.0a2, across platforms. Should I file separate reports?
Flags: needinfo?(alexandra.lucinet) → needinfo?(bgrinstead)
(In reply to Alexandra Lucinet, QA Mentor [:adalucinet] from comment #23)
> (In reply to Brian Grinstead [:bgrins] from comment #21)
> > Alexandra, did the behavior here change as a result of the
> > bug, or do you see the same behavior in an earlier build?  I believe I see
> > the same thing in Dev Edition.
> 
> None of the mentioned issues are recent regressions - also reproducible with
> latest Developer Edition 49.0a2, across platforms. Should I file separate
> reports?

Yes please, file issues in the inspector component.  Also note that bug 1283454 is in progress and modifying the mdn tooltip, although I doubt it will affect most of these issues.
Flags: needinfo?(bgrinstead)
Status: ASSIGNED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
(In reply to Brian Grinstead [:bgrins] from comment #24)
> Yes please, file issues in the inspector component.  Also note that bug
> 1283454 is in progress and modifying the mdn tooltip, although I doubt it
> will affect most of these issues.
Thank you, Brian!

> 1. In Computed view, ‘Show MDN Docs’ option via the context menu remains displayed when scrolling up/down.
There was already a report on this matter - commented in bug 938097

> 2. In Computed view, after clicking on ‘Visit MDN page’ link, the tooltip remains visible
> 3. With Light and Firebug Themes, ‘Visit MDN page’ link has the same color before and after clicking on it.
Logged bug 1286521

> 4. [Mac OS X only] - there is no hand cursor at mouse over ‘Visit MDN page’ link.
Weird fact - this issue is no longer reproducible under Mac OS X 10.11.1 nor 10.9.5, using latest 50.0a1; tried even with the Nightly build used in comment 19, but without success. 

Based on this output, marking here accordingly.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: