Граф коммитов

185 Коммитов

Автор SHA1 Сообщение Дата
Mike Hommey 9331b9fb07 Bug 1851529 - Set clang-format ColumnLimit consistently. r=sylvestre,necko-reviewers,kershaw
For some reason, its value in the Google style we use is 80... except
for Objective-C, where it's 100, which led to things like:
https://hg.mozilla.org/mozilla-central/rev/31bf68247e6e
https://hg.mozilla.org/mozilla-central/rev/64ceb33533a4.

There's probably a discussion to have about whether 80 is the right
limit, but since it's what's used for everything except ObjC, let's roll
with it.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D187409
2023-09-05 11:23:01 +00:00
Eitan Isaacson b8cc36b196 Bug 1845587 - Don't close Firefox popups when MacOS toolbar menu opens. r=mstange
Now that we have native context menus we don't have to worry about those competing with the toolbar menus.

Differential Revision: https://phabricator.services.mozilla.com/D184631
2023-08-07 17:18:19 +00:00
Emilio Cobos Álvarez 4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
nicklas boman 5e31225558 Bug 1724649 - Followup to remove #include plstr.h r=necko-reviewers,xpcom-reviewers,valentin,nika
Differential Revision: https://phabricator.services.mozilla.com/D177690
2023-05-15 14:53:02 +00:00
Stephen A Pohl 6acadf197b Bug 1825812: Disable the 'Search With Google' service menu entry on macOS, as well as other services that open in Safari. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D174301
2023-03-31 17:42:28 +00:00
Emilio Cobos Álvarez cbda0a90db Bug 1824986 - Fix macOS build.
MANUAL PUSH: Trivial fix CLOSED TREE
2023-03-28 17:41:17 +02:00
Stephen A Pohl 336ff5573f Bug 660452: Enable services submenu in macOS context menus. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D173635
2023-03-25 18:04:45 +00:00
Emilio Cobos Álvarez 46dd8a0d40 Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin,stransky
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-24 15:43:49 +00:00
Iulian Moraru a713f3dd73 Backed out changeset f9a25f51a254 (bug 1811487) for causing bc failures related to PanelMultiView. CLOSED TREE 2023-01-23 21:11:43 +02:00
Emilio Cobos Álvarez e8d9ad8d88 Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-23 16:15:00 +00:00
Butkovits Atila 8ee1c95687 Backed out 2 changesets (bug 1811487) for causing failures at browser_PanelMultiView_keyboard.js. CLOSED TREE
Backed out changeset 88c5316c2183 (bug 1811487)
Backed out changeset 6350911c1c8d (bug 1811487)
2023-01-23 16:18:50 +02:00
Emilio Cobos Álvarez 5c3fc07c2e Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-23 11:58:25 +00:00
Stephen A Pohl 0a408a0948 Bug 1642138: Improve integration with the macOS-level Window menu handling to unlock built-in OS functionality such as tiling of windows. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D159723
2022-11-07 19:04:40 +00:00
Iulian Moraru 1c8854ed1e Backed out changeset 46538d8cbaf1 (bug 1642138) as per dev's request. CLOSED TREE 2022-11-05 03:02:28 +02:00
Stephen A Pohl 177c2181ca Bug 1642138: Improve integration with the macOS-level Window menu handling to unlock built-in OS functionality such as tiling of windows. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D159723
2022-11-03 19:32:27 +00:00
Markus Stange aa49005e37 Bug 1776763 - Only defer menu item activation if we know that the menu is open. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D151274
2022-07-07 20:47:38 +00:00
Markus Stange 954599ea69 Bug 1748815 - Always run command events outside the context menu event loop. r=bradwerth
This patch aligns the code paths for programmatic menu item activation and
user-initiated menu item activation.

Before this patch, user-initiated menu item activation caused
the command event to fire synchronously from menuItemHit.
After this patch, the command event fires from MenuClosedAsync,
which, if an item was activated, is called asynchronously once
the menu's nested event loop has been exited. (If no item has been
activated, MenuClosedAsync is called *inside* the menu's event
loop so that popuphiding / popuphidden events for submenus don't
get delayed.)

This patch makes three major changes to align the two code paths:

 - menuItemHit now calls ActivateItemAfterClosing. This fixes bug 1748815.
 - NativeMenuMac::ActivateItem (used in automated tests) calls the
   relevant methods in the same order as user-initiated item activation.

This means that what we're testing is now closer to what we're shipping.

This patch also removes the call to runAfterMenuClosed. The runnable
that calls MenuClosedAsync is already guaranteed to run outside the
menu's event loop when a menu item was activated (I'm 99% sure about this):
For user-initiated activations, the macOS code exits the loop immediately
after calling menuItemHit and doesn't give our CFRunLoopSource another
chance to run until the stack is unwound. For test-initiated activations,
we set MOZMenuOpeningCoordinator.needToUnwindForMenuClosing which tells
our native event loop to not run anything until the stack is unwound.

Differential Revision: https://phabricator.services.mozilla.com/D149316
2022-06-23 15:05:39 +00:00
Markus Stange 7d1db2f3bc Bug 1748815 - Don't dispatch separate runnables for menu item activation, just rely on the existing calls to MenuClosedAsync. r=bradwerth
ActivateItemAfterClosing is currently only called during automated tests.

Before this patch, the DoCommandRunnable could be run from two different places:
Either from the regular event loop (dispatched in `-[MOZMenuOpeningCoordinator _runMenu]`
once the menu event loop is exited), or from MenuClosedAsync, whichever happens first.

MenuClosedAsync always runs when the menu closes, so we can rely on
it being called after ActivateItemAfterClosing.

So we can simplify the code by just always firing the command event
from MenuClosedAsync.

Differential Revision: https://phabricator.services.mozilla.com/D149315
2022-06-23 15:05:38 +00:00
Emilio Cobos Álvarez 9c190fff4b Bug 1771564 - Constify ComputedStyle usage in nsComputedDOMStyle. r=dholbert
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.

Doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D147555
2022-05-28 01:04:24 +00:00
Kagami Sascha Rosylight a1852f800f Bug 1539884 - Part 35: Mark relevant nsMenuX methods to CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134473
2021-12-23 16:27:25 +00:00
Emilio Cobos Álvarez 2d0a072174 Bug 1723921 - Cleanup nsComputedDOMStyle and related APIs. r=layout-reviewers,jfkthame
This will make implementing the new behavior behind a pref
really straight-forward, and is generally nicer.

Depends on D121858

Differential Revision: https://phabricator.services.mozilla.com/D121705
2021-08-07 09:47:15 +00:00
Markus Stange a59a685f73 Bug 1717129 - Don't call into the native event loop while waiting to unwind into the NSMenu tracking event loop after closing a menu. r=harry
This avoids timeouts in some automated tests in certain scenarios.

Differential Revision: https://phabricator.services.mozilla.com/D118237
2021-06-21 17:18:43 +00:00
Markus Stange d6591ed5d6 Bug 1710507 - Make native menus respect the XUL element's directionality. r=emilio
This affects both native context menus and menubar menus.

Doing a flush here is fine, the nsMenuX constructor already flushes via SetupIcon()
(which also uses nsComputedDOMStyle, in nsMenuItemIconX::GetIconURI).

Differential Revision: https://phabricator.services.mozilla.com/D114785
2021-05-11 20:34:17 +00:00
Markus Stange 607f63b94a Bug 1705120 - Notify nsMenuX observers when a menu item is about to be activated, and supply the activated DOM element. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D114434
2021-05-07 17:00:20 +00:00
Markus Stange 65997668d2 Bug 1705120 - Add -[MenuDelegate menu:willActivateItem:] and call it before activating an item. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D114433
2021-05-07 17:00:20 +00:00
Markus Stange 5bcf113e2e Bug 1704102 - On 10.14 and 10.15, make NSMenu adopt the system appearance by briefly changing the NSWindow appearance during menu opening. r=harry
This can be disabled by setting the following pref to false:
widget.macos.enable-pre-bigsur-workaround-for-dark-mode-context-menus

Differential Revision: https://phabricator.services.mozilla.com/D114037
2021-05-04 16:00:52 +00:00
Markus Stange 806ce6ffd1 Bug 1707598 - Make sure that command events from activateItem only run once the nested event loop for the NSMenu has been exited. r=harry
This avoids bugs where a menu close request (cancelTrackingWithoutAnimation) would be dropped
if the command event did certain unexpected things. I'm not 100% sure what the exact
circumstances for the bad behavior were (see bug 1707598 comment 7 for details), but
this seems like the right thing to do anyway.

We also need to delay the call to MenuClosedAsync, because MenuClosedAsync flushes any pending
command runnables (so that the command event fires before popuphiding / popuphidden). However, we
can only delay the call to MenuClosedAsync if we know thath the entire menu closes, and not just a
submenu.

Differential Revision: https://phabricator.services.mozilla.com/D113734
2021-04-30 17:45:59 +00:00
Markus Stange 1e542500e5 Bug 1707598 - Let MenuClosed know when it's called after ActivateItem. r=harry
In the next patch, it will make different decisions for how to dispatch the
MenuClosedAsync event based on this flag.

Depends on D113987

Differential Revision: https://phabricator.services.mozilla.com/D113988
2021-04-30 17:45:59 +00:00
Markus Stange 775aafc5ba Bug 1707598 - Rename ActivateItemAndClose and call cancelTrackingWithoutAnimation in NativeMenuMac::ActivateItem. r=harry
This also makes sure we call ActivateItemAfterMenuClosing on the submenu that
immediately contains the activated menu item, and not on the root menu.
This usually doesn't make a difference, except in the case where something
calls FlushMenuClosedRunnable afterwards; in that case, before this patch, we
might accidentally fired the popuphidden event for the submenu before the
command event for the clicked item.

Depends on D113733

Differential Revision: https://phabricator.services.mozilla.com/D113987
2021-04-30 17:45:58 +00:00
Markus Stange 83880d0070 Bug 1707598 - Make DoCommandRunnable a regular runnable, not a cancelable runnable. r=harry
It doesn't need to be cancelable - the Run() method already nulls out mMenuItem,
so once Run() has been called once, it won't do anything on subsequent invocations.
This patch also improves safety a bit, by moving the pending command runnables
out of the mPendingCommandRunnables field before running them, so that the Run()
method has no way of invalidating the array that's being iterated over.

Differential Revision: https://phabricator.services.mozilla.com/D113732
2021-04-30 17:45:58 +00:00
Markus Stange 42b56e15e1 Bug 1704883 - Report which mouse button was used to click items in native menus. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D111981
2021-04-21 03:45:27 +00:00
Markus Stange a29fcf0959 Bug 1705842 - Allow opening empty menus, by putting a placeholder item in place. r=harry
This is exercised by one of the subtests of
browser/components/extensions/test/browser/browser_ext_menus_replace_menu.js :

The menu is opened while it's empty, and then the content items are added
asynchronously while the menu is open.

If we try to open an NSMenu with zero NSMenuItems, macOS immediately closes the
menu after opening it. With a placeholder item it stays open as expected.

Differential Revision: https://phabricator.services.mozilla.com/D112458
2021-04-19 23:08:36 +00:00
Markus Stange 01f82d18dd Bug 1705842 - Support inserting and removing menu elements while the menu is open. r=harry
This makes the WebExtension API menus.refresh() work.

Differential Revision: https://phabricator.services.mozilla.com/D112457
2021-04-19 23:08:36 +00:00
Markus Stange 02c085c927 Bug 1705842 - Add WillInsertChild and WillRemoveChild. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112456
2021-04-19 23:08:35 +00:00
Markus Stange a9744be335 Bug 1705842 - Create generic CreateMenuChild and AddMenuChild methods. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112455
2021-04-19 23:08:35 +00:00
Markus Stange 935fc2584e Bug 1705842 - Remove unnecessary null check and submenu assignment. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112454
2021-04-19 23:08:34 +00:00
Markus Stange 8fce76f595 Bug 1705842 - Change internal visibility before calling MenuChildChangedVisibility. r=harry
This will make a difference once code inside MenuChildChangedVisibility starts
calling IsVisible(). The method name has "Changed" in it, so it should be called
after the change.

Differential Revision: https://phabricator.services.mozilla.com/D112453
2021-04-19 23:08:34 +00:00
Markus Stange 7c3e29a98e Bug 1705842 - Make sure that items that are un-hidden while the menu is open get their icon set up. r=harry
Before, we were only calling SetUpIcon if the item was visible during menu
construction on menu opening, but not if the item became visible after menu
opening.

Differential Revision: https://phabricator.services.mozilla.com/D112452
2021-04-19 23:08:34 +00:00
Markus Stange ca9f8e2db0 Bug 1705842 - Combine the two methods and properly update mVisibleItemsCount, and add some asserts. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112450
2021-04-19 23:08:33 +00:00
Markus Stange c48e8404c1 Bug 1705842 - Make InsertChildNativeMenuItem support nsMenuItemX, too. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112449
2021-04-19 23:08:33 +00:00
Markus Stange 98e6596cf3 Bug 1705842 - Move command registration and NSMenuItem target/action initialization into nsMenuItemX. r=harry
This means that it'll happen even if the menu item is not visible. This will make
it possible to make a menu item visible after initial menu construction.

Differential Revision: https://phabricator.services.mozilla.com/D112448
2021-04-19 23:08:32 +00:00
Markus Stange 388df46cfd Bug 1705842 - Add nsMenuItemX::IsVisible() and nsMenuX::IsVisible(). r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112447
2021-04-19 23:08:32 +00:00
Markus Stange d977ec7a4b Bug 1705862 - Add missing null checks.
Differential Revision: https://phabricator.services.mozilla.com/D112470
2021-04-17 15:19:20 +00:00
Markus Stange 8eefb45e0a Bug 1705582 - Make sure NativeMenuMac::Close fires popuphiding / popuphidden even if the menu wasn't fully opened. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112304
2021-04-16 21:41:15 +00:00
Markus Stange 45feb2e517 Bug 1704554 - Allow NativeMenu::Observer to listen for submenu state changes. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112273
2021-04-16 16:18:29 +00:00
Markus Stange f1854f2427 Bug 1704682 - Call OnMenuOpened before dispatching the popupshown event. r=harry
This will cause nsXULPopupManager to change the state to "open" before the
popupshown event fires. This is consistent with non-native menus.

This was caught by dom/html/test/browser_content_contextmenu_userinput.js.

Differential Revision: https://phabricator.services.mozilla.com/D111766
2021-04-13 15:05:55 +00:00
Markus Stange 2a928677df Bug 1704215 - Fire popupshown asynchronously after menuWillOpen. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D111669
2021-04-13 14:45:09 +00:00
Markus Stange bce7ac29c5 Bug 1704212 - Make sure we don't forget about simulated-open submenus when closing their parents, and try to enforce that submenus run their popuphidden events before their parents. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D111667
2021-04-13 02:52:44 +00:00
Markus Stange e0064d8c44 Bug 1704212 - Remove unused return value from MenuOpened(), make MenuOpened() ignore repeated invocations, and adjust comments. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D111661
2021-04-13 02:52:42 +00:00
Markus Stange 59e8b65b9d Bug 1704209 - Add NativeMenu::ActivateItem. r=harry
The asynchronous aspects of this are somewhat messy.

Hiding the menu visually before executing the command event is necessary for
the test browser/components/places/tests/browser/browser_library_bookmark_pages.js
which opens a modal sheet from a command event, and the modal has a nested event
loop.

Flushing command events before MenuClosedAsync is necessary for the test
browser/base/content/test/contextMenu/browser_contextmenu_linkopen.js, which
calls hidePopup right after it calls menuitem.click(); without the flushing,
the call to hidePopup would run the popuphiding/popuphidden events before the
command event and the command event handler would fail.

Differential Revision: https://phabricator.services.mozilla.com/D111520
2021-04-13 02:52:40 +00:00