2929 */
3030
3131import * as Common from '../../core/common/common.js' ;
32+ import * as Host from '../../core/host/host.js' ;
3233import * as i18n from '../../core/i18n/i18n.js' ;
3334import * as Root from '../../core/root/root.js' ;
3435import * as Bindings from '../../models/bindings/bindings.js' ;
@@ -213,7 +214,11 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
213214 return ;
214215 }
215216
216- const contextMenu = new UI . ContextMenu . ContextMenu ( event , { useSoftMenu : true } ) ;
217+ // Differentiate between Mac and other platforms to use SoftContextMenu or native menus
218+ // while we are gradually landing CLs to enable accelerators for native menus on Mac.
219+ // We will use native menus disregarding of the platform once all CLs are in.
220+ const useSoftMenu = Host . Platform . isMac ( ) ;
221+ const contextMenu = new UI . ContextMenu . ContextMenu ( event , { useSoftMenu} ) ;
217222
218223 if ( UI . ActionRegistry . ActionRegistry . instance ( ) . hasAction ( 'drjones.performance-panel-context' ) ) {
219224 const aiNode = this . getAIEventNodeTreeFromEntryIndex ( entryIndex ) ;
@@ -230,6 +235,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
230235 jslogContext : 'hide-function' ,
231236 } ) ;
232237 hideEntryOption . setShortcut ( 'H' ) ;
238+ hideEntryOption . setAccelerator ( UI . KeyboardShortcut . Keys . H , [ UI . KeyboardShortcut . Modifiers . None ] ) ;
233239
234240 const hideChildrenOption = contextMenu . defaultSection ( ) . appendItem ( i18nString ( UIStrings . hideChildren ) , ( ) => {
235241 this . modifyTree ( PerfUI . FlameChart . FilterAction . COLLAPSE_FUNCTION , entryIndex ) ;
@@ -238,6 +244,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
238244 jslogContext : 'hide-children' ,
239245 } ) ;
240246 hideChildrenOption . setShortcut ( 'C' ) ;
247+ hideChildrenOption . setAccelerator ( UI . KeyboardShortcut . Keys . C , [ UI . KeyboardShortcut . Modifiers . None ] ) ;
241248
242249 const hideRepeatingChildrenOption =
243250 contextMenu . defaultSection ( ) . appendItem ( i18nString ( UIStrings . hideRepeatingChildren ) , ( ) => {
@@ -247,6 +254,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
247254 jslogContext : 'hide-repeating-children' ,
248255 } ) ;
249256 hideRepeatingChildrenOption . setShortcut ( 'R' ) ;
257+ hideRepeatingChildrenOption . setAccelerator ( UI . KeyboardShortcut . Keys . R , [ UI . KeyboardShortcut . Modifiers . None ] ) ;
250258
251259 const resetChildrenOption = contextMenu . defaultSection ( ) . appendItem ( i18nString ( UIStrings . resetChildren ) , ( ) => {
252260 this . modifyTree ( PerfUI . FlameChart . FilterAction . RESET_CHILDREN , entryIndex ) ;
@@ -255,6 +263,7 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
255263 jslogContext : 'reset-children' ,
256264 } ) ;
257265 resetChildrenOption . setShortcut ( 'U' ) ;
266+ resetChildrenOption . setAccelerator ( UI . KeyboardShortcut . Keys . U , [ UI . KeyboardShortcut . Modifiers . None ] ) ;
258267
259268 contextMenu . defaultSection ( ) . appendItem ( i18nString ( UIStrings . resetTrace ) , ( ) => {
260269 this . modifyTree ( PerfUI . FlameChart . FilterAction . UNDO_ALL_ACTIONS , entryIndex ) ;
0 commit comments