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

Unified Diff: ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm

Issue 2721383002: Use a plain UILabel for answers in suggest detail text. (Closed)
Patch Set: Add TODO. Created 3 years, 10 months 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: ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm
index 3196ae46d7e506a5e86867ed79bd9de53bb63bde..42d4a3af7d0aadd510d6c52e9034e158c490981f 100644
--- a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm
+++ b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.mm
@@ -34,6 +34,7 @@ const CGFloat kAppendButtonSize = 48.0;
@synthesize textTruncatingLabel = _textTruncatingLabel;
@synthesize detailTruncatingLabel = _detailTruncatingLabel;
+@synthesize detailAnswerLabel = _detailAnswerLabel;
@synthesize appendButton = _appendButton;
@synthesize answerImageView = _answerImageView;
@synthesize imageView = _imageView;
@@ -66,6 +67,14 @@ const CGFloat kAppendButtonSize = 48.0;
_detailTruncatingLabel.userInteractionEnabled = NO;
[self addSubview:_detailTruncatingLabel];
+ // Answers use a UILabel with NSLineBreakByTruncatingTail to produce a
+ // truncation with an ellipse instead of fading on multi-line text.
+ _detailAnswerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
rohitrao (ping after 24h) 2017/03/02 18:18:31 How does the frame for this label (and all the oth
Justin Donnelly 2017/03/02 18:52:05 The layout of these labels is done in OmniboxPopup
+ _detailAnswerLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ _detailAnswerLabel.userInteractionEnabled = NO;
+ _detailAnswerLabel.lineBreakMode = NSLineBreakByTruncatingTail;
+ [self addSubview:_detailAnswerLabel];
+
_appendButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
[_appendButton setContentMode:UIViewContentModeRight];
[self updateAppendButtonImages];
@@ -164,7 +173,9 @@ const CGFloat kAppendButtonSize = 48.0;
}
- (NSString*)accessibilityValue {
- return _detailTruncatingLabel.attributedText.string;
+ return _detailTruncatingLabel.hidden
+ ? _detailAnswerLabel.attributedText.string
+ : _detailTruncatingLabel.attributedText.string;
}
@end

Powered by Google App Engine
This is Rietveld 408576698