Chromium Code Reviews| 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 ba2e49238f6c29c7915df4a9d5bb88369cf241dd..f6366d9683fb03839527463f321b8f013666594d 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| @@ -31,9 +31,10 @@ const CGFloat kBackgroundYInset = 4.0; |
| } // namespace |
| -BubbleDecoration::BubbleDecoration() { |
| +BubbleDecoration::BubbleDecoration() : baseline_offset_(0) { |
| attributes_.reset([[NSMutableDictionary alloc] init]); |
| - [attributes_ setObject:GetFont() forKey:NSFontAttributeName]; |
| + [attributes_ setObject:LocationBarDecoration::GetFont() |
| + forKey:NSFontAttributeName]; |
| } |
| BubbleDecoration::~BubbleDecoration() { |
| @@ -102,6 +103,7 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) { |
| if (label_) { |
| NSRect textRect = frame; |
| textRect.origin.x = textOffset; |
| + textRect.origin.y += baseline_offset_; |
| textRect.size.width = NSMaxX(decoration_frame) - NSMinX(textRect); |
| DrawLabel(label_, attributes_, textRect); |
| } |
| @@ -154,3 +156,15 @@ void BubbleDecoration::SetLabel(NSString* label) { |
| void BubbleDecoration::SetTextColor(NSColor* text_color) { |
| [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; |
| } |
| + |
| +NSFont* BubbleDecoration::GetFont() const { |
|
tapted
2016/04/27 02:37:39
nit: order after DrawWithBackgroundInFrame
shrike
2016/04/27 16:35:17
Done.
|
| + return [attributes_ objectForKey:NSFontAttributeName]; |
| +} |
| + |
| +void BubbleDecoration::SetFont(NSFont* font) { |
| + [attributes_ setObject:font forKey:NSFontAttributeName]; |
| +} |
| + |
| +void BubbleDecoration::SetBaselineOffset(CGFloat offset) { |
| + baseline_offset_ = offset; |
| +} |