Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: chrome/browser/ui/cocoa/menu_button.mm

Issue 1886903002: [Mac] Restore menu position for buttons after Material Design changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/menu_button.mm
diff --git a/chrome/browser/ui/cocoa/menu_button.mm b/chrome/browser/ui/cocoa/menu_button.mm
index 10520d5c144677298d7bd11e7e75e9817a0dafa5..af4a1388d111ff524507b21119cd018e1d4f5166 100644
--- a/chrome/browser/ui/cocoa/menu_button.mm
+++ b/chrome/browser/ui/cocoa/menu_button.mm
@@ -6,7 +6,10 @@
#include "base/logging.h"
#import "chrome/browser/ui/cocoa/clickhold_button_cell.h"
+#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
+#include "ui/base/material_design/material_design_controller.h"
#import "ui/base/cocoa/nsview_additions.h"
+#include "ui/base/material_design/material_design_controller.h"
@interface MenuButton (Private)
- (void)showMenu:(BOOL)isDragging;
@@ -157,6 +160,13 @@
frame.origin.x -= 2.0;
frame.size.height -= 19.0 - NSHeight(frame);
+ // The button's icon has a different relationship to its bounds in
+ // Material Design, so have to adjust the menu location by that delta.
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ frame.origin.x -= [ToolbarController materialDesignButtonInset];
+ frame.origin.y += [ToolbarController materialDesignButtonInset];
+ }
+
// Make our pop-up button cell and set things up. This is, as of 10.5, the
// official Apple-recommended hack. Later, perhaps |-[NSMenu
// popUpMenuPositioningItem:atLocation:inView:]| may be a better option.
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698