From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- widget/cocoa/nsMenuUtilsX.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 widget/cocoa/nsMenuUtilsX.h (limited to 'widget/cocoa/nsMenuUtilsX.h') diff --git a/widget/cocoa/nsMenuUtilsX.h b/widget/cocoa/nsMenuUtilsX.h new file mode 100644 index 0000000000..0ec8d8555d --- /dev/null +++ b/widget/cocoa/nsMenuUtilsX.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsMenuUtilsX_h_ +#define nsMenuUtilsX_h_ + +#include "nscore.h" +#include "nsStringFwd.h" + +#import + +class nsIContent; +class nsMenuBarX; +class nsMenuX; + +// Namespace containing utility functions used in our native menu implementation. +namespace nsMenuUtilsX { +void DispatchCommandTo(nsIContent* aTargetContent, NSEventModifierFlags aModifierFlags, + int16_t aButton); +NSString* GetTruncatedCocoaLabel(const nsString& itemLabel); +uint8_t GeckoModifiersForNodeAttribute(const nsString& modifiersAttribute); +unsigned int MacModifiersForGeckoModifiers(uint8_t geckoModifiers); +nsMenuBarX* GetHiddenWindowMenuBar(); // returned object is not retained +NSMenuItem* GetStandardEditMenuItem(); // returned object is not retained +bool NodeIsHiddenOrCollapsed(nsIContent* aContent); + +// Find the menu item by following the path aLocationString from aRootMenu. +// aLocationString is a '|'-separated list of integers, where each integer is +// the index of the menu item in the menu. +// aIsMenuBar needs to be true if aRootMenu is the app's mainMenu, so that the +// app menu can be skipped during the search. +NSMenuItem* NativeMenuItemWithLocation(NSMenu* aRootMenu, NSString* aLocationString, + bool aIsMenuBar); + +// Traverse the menu tree and check that there are no cycles or NSMenu(Item) objects that are used +// more than once. If inconsistencies are found, these functions crash the process. +void CheckNativeMenuConsistency(NSMenu* aMenu); +void CheckNativeMenuConsistency(NSMenuItem* aMenuItem); + +// Print out debugging information about the native menu tree structure. +void DumpNativeMenu(NSMenu* aMenu); +void DumpNativeMenuItem(NSMenuItem* aMenuItem); + +extern bool gIsSynchronouslyActivatingNativeMenuItemDuringTest; + +} // namespace nsMenuUtilsX + +#endif // nsMenuUtilsX_h_ -- cgit v1.2.3