OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" | 7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Inset for the background. | 37 // Inset for the background. |
38 const CGFloat kBackgroundYInset = 4.0; | 38 const CGFloat kBackgroundYInset = 4.0; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 BubbleDecoration::BubbleDecoration() : retina_baseline_offset_(0) { | 42 BubbleDecoration::BubbleDecoration() : retina_baseline_offset_(0) { |
43 attributes_.reset([[NSMutableDictionary alloc] init]); | 43 attributes_.reset([[NSMutableDictionary alloc] init]); |
44 [attributes_ setObject:LocationBarDecoration::GetFont() | 44 [attributes_ setObject:LocationBarDecoration::GetFont() |
45 forKey:NSFontAttributeName]; | 45 forKey:NSFontAttributeName]; |
| 46 |
| 47 base::scoped_nsobject<NSMutableParagraphStyle> style( |
| 48 [[NSMutableParagraphStyle alloc] init]); |
| 49 [style setLineBreakMode:NSLineBreakByClipping]; |
| 50 [attributes_ setObject:style forKey:NSParagraphStyleAttributeName]; |
46 } | 51 } |
47 | 52 |
48 BubbleDecoration::~BubbleDecoration() { | 53 BubbleDecoration::~BubbleDecoration() { |
49 } | 54 } |
50 | 55 |
51 CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image, | 56 CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image, |
52 NSString* label) { | 57 NSString* label) { |
53 if (!image && !label) | 58 if (!image && !label) |
54 return kOmittedWidth; | 59 return kOmittedWidth; |
55 | 60 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; | 189 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; |
185 } | 190 } |
186 | 191 |
187 void BubbleDecoration::SetFont(NSFont* font) { | 192 void BubbleDecoration::SetFont(NSFont* font) { |
188 [attributes_ setObject:font forKey:NSFontAttributeName]; | 193 [attributes_ setObject:font forKey:NSFontAttributeName]; |
189 } | 194 } |
190 | 195 |
191 void BubbleDecoration::SetRetinaBaselineOffset(CGFloat offset) { | 196 void BubbleDecoration::SetRetinaBaselineOffset(CGFloat offset) { |
192 retina_baseline_offset_ = offset; | 197 retina_baseline_offset_ = offset; |
193 } | 198 } |
OLD | NEW |