Index: chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
index cdea965d56e39fda08c72b0b0b9357250576ccfe..148f9c7e0dcc2e4d0df036597feb1e1acaa90d45 100644 |
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
@@ -24,12 +24,7 @@ CGFloat BubblePadding() { |
return ui::MaterialDesignController::IsModeMaterial() ? 8.0 : 3.0; |
} |
-// Additional padding between the divider between the omnibox text and the |
-// divider. The desired value is 8px. We get 3px by subtracting the existing |
-// padding in location_bar_view from 8px. |
-CGFloat DividerPadding() { |
- return ui::MaterialDesignController::IsModeMaterial() ? 2.0 : 0.0; |
-} |
+const CGFloat kDividerPadding = 2.0; |
// Padding between the icon and label. |
CGFloat kIconLabelPadding = 4.0; |
@@ -43,11 +38,23 @@ BubbleDecoration::BubbleDecoration() : retina_baseline_offset_(0) { |
attributes_.reset([[NSMutableDictionary alloc] init]); |
[attributes_ setObject:LocationBarDecoration::GetFont() |
forKey:NSFontAttributeName]; |
+ |
+ base::scoped_nsobject<NSMutableParagraphStyle> style( |
+ [[NSMutableParagraphStyle alloc] init]); |
+ [style setLineBreakMode:NSLineBreakByClipping]; |
+ [attributes_ setObject:style forKey:NSParagraphStyleAttributeName]; |
} |
BubbleDecoration::~BubbleDecoration() { |
} |
+// Additional padding between the divider between the omnibox text and the |
+// divider. The desired value is 8px. We get 3px by subtracting the existing |
+// padding in location_bar_view from 8px. |
+CGFloat BubbleDecoration::DividerPadding() const { |
+ return ui::MaterialDesignController::IsModeMaterial() ? kDividerPadding : 0.0; |
+} |
+ |
CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image, |
NSString* label) { |
if (!image && !label) |
@@ -143,7 +150,12 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) { |
[transform translateXBy:0 yBy:retina_baseline_offset_]; |
[transform concat]; |
} |
- DrawLabel(label_, attributes_, textRect); |
+ |
+ base::scoped_nsobject<NSAttributedString> str([[NSAttributedString alloc] |
+ initWithString:label_ |
+ attributes:attributes_]); |
+ |
+ DrawAttributedString(str, textRect); |
} |
} |