| 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 085e3733a3be9ff68f7785246f225f33ed2c1a72..7867181ec1a6010aa77f4f41fe0b4a15de732c31 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;
|
|
|
| @@ -862,6 +865,7 @@ bool IsInternalURL(const GURL& url) {
|
| toView:view
|
| atPoint:position];
|
| }
|
| + [label setToolTip:base::SysUTF16ToNSString(labelText)];
|
|
|
| [view setFrameSize:NSMakeSize(viewWidth, NSHeight([view frame]))];
|
|
|
| @@ -879,6 +883,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];
|
| + [[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];
|
|
|
|
|