Open Bug 2038040 Opened 7 months ago Updated 6 months ago

improve/simplify indexing and visibility tracking in macOS menu code

Categories

(Core :: Widget: Cocoa, enhancement)

enhancement

Tracking

()

People

(Reporter: jaas, Assigned: jaas, NeedInfo)

References

Details

Attachments

(1 external file)

The macOS menu code (nsMenuX.mm, nsMenuBarX.mm) does some things that are fragile and complicated:

  1. Instead of hiding native menu items when their associated DOM node is hidden, the native menu items are remove and re-inserted on visibility changes. This requires fragile calculations to figure out where to re-insert.
  2. The code maintains a count of the number of visible items, which is complex and fragile.

We can probably make things simpler and more robust by doing things like just hiding native menu items instead of removing and reinserting, and just calculating the visible items count when we need it instead of incrementing and decrementing all over the place.

Assignee: nobody → jaas
Severity: -- → S3
Attachment #9584341 - Attachment description: WIP: Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. → Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. r?#mac-reviewers
Pushed by jaas@kflag.net: https://github.com/mozilla-firefox/firefox/commit/d62dfac563d2 https://hg.mozilla.org/integration/autoland/rev/d0ee43ef933e Improve/simplify indexing and visibility tracking in macOS menu code. r=mac-reviewers,bradwerth
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e741041e3d87 https://hg.mozilla.org/integration/autoland/rev/9ba464acdecb Revert "Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. r=mac-reviewers,bradwerth" for causing reftest leakcheck failures @ chrome.toml
Flags: needinfo?(jaas)
Attachment #9584341 - Attachment description: Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. r?#mac-reviewers → Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. r=mac-reviewers,bradwerth
Pushed by jaas@kflag.net: https://github.com/mozilla-firefox/firefox/commit/bff84a6e644c https://hg.mozilla.org/integration/autoland/rev/caeec5137e5f Improve/simplify indexing and visibility tracking in macOS menu code. r=mac-reviewers,bradwerth
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0099e0350171 https://hg.mozilla.org/integration/autoland/rev/cce7df254852 Revert "Bug 2038040 - Improve/simplify indexing and visibility tracking in macOS menu code. r=mac-reviewers,bradwerth" for causing mochitests failures at widget/tests/test_keycodes

Backed out for causing mochitests failures at widget/tests/test_keycodes
Backout Link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-FAIL | widget/tests/test_keycodes.xhtml | US keyCode=35 (0x23) chars='p' unmodifiedChars='p', a needed event is not fired - got "", expected "keydown"

Duplicate of this bug: 2037897

Working on a fix.

There is an r+ patch which didn't land and no activity in this bug for 1 week.
:jaas, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(jaas)
Flags: needinfo?(bwerth)

Changed status to Plan Changes.

Flags: needinfo?(jaas)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: