fix: don't append Shift modifier text twice to accelerators (#15400)
* fix: don't append Shift modifier text twice to accelerators * style: use the new way of creating patches * test: add menu item accelerator display tests * fix: allocate accelerator on the stack * fix: adjust tests to match expected behavior on mac
This commit is contained in:
		
					parent
					
						
							
								1d81d1a706
							
						
					
				
			
			
				commit
				
					
						aa6f7a5d9f
					
				
			
		
					 4 changed files with 78 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -155,6 +155,12 @@ base::string16 Menu::GetSublabelAt(int index) const {
 | 
			
		|||
  return model_->GetSublabelAt(index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
base::string16 Menu::GetAcceleratorTextAt(int index) const {
 | 
			
		||||
  ui::Accelerator accelerator;
 | 
			
		||||
  model_->GetAcceleratorAtWithParams(index, true, &accelerator);
 | 
			
		||||
  return accelerator.GetShortcutText();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Menu::IsItemCheckedAt(int index) const {
 | 
			
		||||
  return model_->IsItemCheckedAt(index);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +201,7 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
 | 
			
		|||
      .SetMethod("getCommandIdAt", &Menu::GetCommandIdAt)
 | 
			
		||||
      .SetMethod("getLabelAt", &Menu::GetLabelAt)
 | 
			
		||||
      .SetMethod("getSublabelAt", &Menu::GetSublabelAt)
 | 
			
		||||
      .SetMethod("getAcceleratorTextAt", &Menu::GetAcceleratorTextAt)
 | 
			
		||||
      .SetMethod("isItemCheckedAt", &Menu::IsItemCheckedAt)
 | 
			
		||||
      .SetMethod("isEnabledAt", &Menu::IsEnabledAt)
 | 
			
		||||
      .SetMethod("isVisibleAt", &Menu::IsVisibleAt)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,7 @@ class Menu : public mate::TrackableObject<Menu>,
 | 
			
		|||
  int GetCommandIdAt(int index) const;
 | 
			
		||||
  base::string16 GetLabelAt(int index) const;
 | 
			
		||||
  base::string16 GetSublabelAt(int index) const;
 | 
			
		||||
  base::string16 GetAcceleratorTextAt(int index) const;
 | 
			
		||||
  bool IsItemCheckedAt(int index) const;
 | 
			
		||||
  bool IsEnabledAt(int index) const;
 | 
			
		||||
  bool IsVisibleAt(int index) const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue