Index: chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm b/chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm |
index 82e25620b893c45f809715c31a2b20dd7da073b4..f33aeceb0727a7f4328b1bee32c6ae314a6036ac 100644 |
--- a/chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm |
+++ b/chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm |
@@ -14,6 +14,9 @@ namespace { |
// Border inset for error label. |
const CGFloat kLabelInset = 3.0; |
+const CGFloat kMaxLabelWidth = |
+ 2 * autofill::kFieldWidth + autofill::kHorizontalFieldPadding; |
+ |
} // namespace |
@@ -39,14 +42,10 @@ const CGFloat kLabelInset = 3.0; |
[label_ setBordered:NO]; |
[label_ setDrawsBackground:NO]; |
[label_ setStringValue:message]; |
- NSSize labelSize = [[label_ cell] cellSizeForBounds: |
- NSMakeRect( |
- 0, 0, |
- 2 * autofill::kFieldWidth + autofill::kHorizontalFieldPadding, |
- CGFLOAT_MAX)]; |
- [label_ setFrameSize:labelSize]; |
- [label_ setFrameOrigin:NSMakePoint(kLabelInset, kLabelInset)]; |
- |
+ NSRect labelFrame = NSMakeRect(kLabelInset, kLabelInset, 0, 0); |
+ labelFrame.size = [[label_ cell] cellSizeForBounds: |
+ NSMakeRect(0, 0, kMaxLabelWidth, CGFLOAT_MAX)]; |
+ [label_ setFrame:labelFrame]; |
[[self bubble] addSubview:label_]; |
NSRect windowFrame = [[self window] frame]; |
@@ -59,4 +58,8 @@ const CGFloat kLabelInset = 3.0; |
return self; |
} |
+- (CGFloat)maxWidth { |
+ return kMaxLabelWidth + 2 * kLabelInset; |
+} |
+ |
@end |