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

Unified Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 905543002: [OSX] Fix alignment for permission bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index 5d8df94028728e71101f9ef22d563b3c37de2f90..e4f3efcce20ccf012bb95a82341012aefe1dd50b 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -39,8 +39,14 @@ using base::UserMetricsAction;
namespace {
+// Distance between permission icon and permission label.
+const CGFloat kHorizontalIconPadding = 8.0f;
+
+// Distance between two permission labels.
+const CGFloat kVerticalPermissionPadding = 2.0f;
+
const CGFloat kHorizontalPadding = 13.0f;
-const CGFloat kVerticalPadding = 13.0f;
+const CGFloat kVerticalPadding = 15.0f;
const CGFloat kBetweenButtonsPadding = 10.0f;
const CGFloat kButtonRightEdgePadding = 17.0f;
const CGFloat kTitlePaddingX = 50.0f;
@@ -296,12 +302,13 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
permissionMenus.reset([[NSMutableArray alloc] init]);
CGFloat maxPermissionLineWidth = 0;
+ CGFloat verticalPadding = 0.0f;
for (auto it = requests.begin(); it != requests.end(); it++) {
base::scoped_nsobject<NSView> permissionView(
[[self labelForRequest:(*it)] retain]);
NSPoint origin = [permissionView frame].origin;
origin.x += kHorizontalPadding;
- origin.y += yOffset;
+ origin.y += yOffset + verticalPadding;
[permissionView setFrameOrigin:origin];
[contentView addSubview:permissionView];
@@ -321,6 +328,9 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
maxPermissionLineWidth = std::max(
maxPermissionLineWidth, NSMaxX([permissionView frame]));
yOffset += NSHeight([permissionView frame]);
+
+ // Add extra padding for all but first permission.
+ verticalPadding = kVerticalPermissionPadding;
}
base::scoped_nsobject<NSView> titleView(
@@ -446,7 +456,7 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate {
[permissionLabel setStringValue:base::SysUTF16ToNSString(label)];
[permissionLabel sizeToFit];
[permissionLabel setFrameOrigin:
- NSMakePoint(NSWidth([permissionIcon frame]), 0)];
+ NSMakePoint(NSWidth([permissionIcon frame]) + kHorizontalIconPadding, 0)];
[permissionView addSubview:permissionLabel];
// Match the horizontal centers of the two subviews. Note that the label's
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698