Chromium Code Reviews| Index: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm |
| index 8c2e8a66239b08de8a38f93ab04a18a384941324..ec4407b57b6015a6200af87879388b273fe45aad 100644 |
| --- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm |
| +++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm |
| @@ -85,6 +85,9 @@ const CGFloat kPermissionImageSize = 16; |
| // Spacing between a permission image and the text. |
| const CGFloat kPermissionImageSpacing = 6; |
| +// Minimum distance between the label and its corresponding menu. |
| +const CGFloat kMinSeparationBetweenLabelAndMenu = 16; |
| + |
| // Square size of the permission delete button image. |
| const CGFloat kPermissionDeleteImageSize = 16; |
| @@ -864,6 +867,7 @@ bool IsInternalURL(const GURL& url) { |
| toView:view |
| atPoint:position]; |
| } |
| + [label setToolTip:base::SysUTF16ToNSString(labelText)]; |
| [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))]; |
| @@ -881,6 +885,28 @@ bool IsInternalURL(const GURL& url) { |
| position.y -= titleRect.origin.y; |
| [button setFrameOrigin:position]; |
| + // Truncate the label if it's too wide. |
| + // This is a workaround for https://crbug.com/654268 until MacViews ships. |
| + NSRect labelFrame = [label frame]; |
| + if (isRTL) { |
| + CGFloat maxLabelWidth = NSMaxX(labelFrame) - NSMaxX([button frame]) - |
| + kMinSeparationBetweenLabelAndMenu; |
| + if (NSWidth(labelFrame) > maxLabelWidth) { |
| + labelFrame.origin.x = NSMaxX(labelFrame) - maxLabelWidth; |
| + labelFrame.size.width = maxLabelWidth; |
| + [label setFrame:labelFrame]; |
|
Robert Sesek
2016/11/03 00:04:31
These two lines are duplicated within the two bran
lgarron
2016/11/03 00:05:21
They are conditional within both branches. Do you
lgarron
2016/11/03 00:15:00
Note that putting this inside the conditional insi
|
| + [[label cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
| + } |
| + } else { |
| + CGFloat maxLabelWidth = NSMinX([button frame]) - NSMinX(labelFrame) - |
| + kMinSeparationBetweenLabelAndMenu; |
| + if (NSWidth(labelFrame) > maxLabelWidth) { |
| + labelFrame.size.width = maxLabelWidth; |
| + [label setFrame:labelFrame]; |
| + [[label cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
| + } |
| + } |
| + |
| // Align the icon with the text. |
| [self alignPermissionIcon:imageView withTextField:label]; |