Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7562)

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm

Issue 115753002: [rAc] [OSX] Use vertically compact text to show suggestions, when it fits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up more Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
index e854cd2d1667e6a4645975d42ff2894b3586e154..56ee21e93f7f58ca024f3c1fee66e7e064296a46 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
@@ -125,7 +125,9 @@ const CGFloat kLabelTopPadding = 5.0;
[self setView:view];
}
-- (void)setSuggestionText:(NSString*)line icon:(NSImage*)icon {
+- (void)setSuggestionText:(NSString*)line
+ icon:(NSImage*)icon
+ wrapText:(BOOL)wrapText {
[label_ setString:@""];
if ([icon size].width) {
@@ -151,8 +153,12 @@ const CGFloat kLabelTopPadding = 5.0;
[[label_ textStorage] appendAttributedString:str1];
[label_ setVerticallyResizable:YES];
- [label_ setHorizontallyResizable:NO];
- [label_ setFrameSize:NSMakeSize(2 * autofill::kFieldWidth, kInfiniteSize)];
+ [label_ setHorizontallyResizable:!wrapText];
+ if (wrapText)
+ [label_ setFrameSize:NSMakeSize(4 * autofill::kFieldWidth, kInfiniteSize)];
+ else
+ [label_ setFrameSize:NSMakeSize(kInfiniteSize, kInfiniteSize)];
+ [[label_ layoutManager] ensureLayoutForTextContainer:[label_ textContainer]];
[label_ sizeToFit];
}

Powered by Google App Engine
This is Rietveld 408576698