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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm

Issue 1099403005: [AiS] changing mac omnibox suggestions form NSMatrix to NSTableView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unneeded code Created 5 years, 8 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: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
index df7b00d3bc6b1c315e1189e80962b1cd23eb322c..2531a70157029943c978ab82a79b240ce05ab46e 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
@@ -155,18 +155,16 @@ NSAttributedString* CreateClassifiedAttributedString(
} // namespace
+@implementation AutocompleteMatchWrapper
+@end
+
@implementation OmniboxPopupCell
+@synthesize attributedTitle;
+
- (id)init {
self = [super init];
if (self) {
- [self setImagePosition:NSImageLeft];
- [self setBordered:NO];
- [self setButtonType:NSRadioButton];
-
- // Without this highlighting messes up white areas of images.
- [self setHighlightsBy:NSNoCellMask];
-
const base::string16& raw_separator =
l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR);
separator_.reset(
@@ -205,6 +203,23 @@ NSAttributedString* CreateClassifiedAttributedString(
}
}
+- (id)copyWithZone:(NSZone*)zone {
+ NSAttributedString* separator = separator_.release();
+ NSAttributedString* description = description_.release();
+ NSAttributedString* prefix = prefix_.release();
+ OmniboxPopupCell* copy = [super copyWithZone:zone];
+ copy->match_ = match_;
+ copy->separator_.reset([separator copy]);
+ copy->description_.reset([description copy]);
+ copy->prefix_.reset([prefix copy]);
+ copy->maxMatchContentsWidth_ = maxMatchContentsWidth_;
+ copy->contentsOffset_ = contentsOffset_;
+ separator_.reset(separator);
+ description_.reset(description);
+ prefix_.reset(prefix);
+ return copy;
+}
Scott Hess - ex-Googler 2015/05/04 19:40:20 WRT your other question about whether -copyWithZon
dschuyler 2015/05/04 23:51:40 Yeah, it does seem to use the same cell over and o
Scott Hess - ex-Googler 2015/05/07 22:35:41 This is something I'm not entirely certain of. It
+
- (void)setMaxMatchContentsWidth:(CGFloat)maxMatchContentsWidth {
maxMatchContentsWidth_ = maxMatchContentsWidth;
}
@@ -353,10 +368,10 @@ NSAttributedString* CreateClassifiedAttributedString(
NSRect renderRect = ShiftRect(cellFrame, offset);
renderRect.size.width =
std::min(NSWidth(renderRect), static_cast<CGFloat>(maxWidth));
+ NSRect textRect = [as boundingRectWithSize:renderRect.size options:nil];
+ renderRect.origin.y += (NSHeight(cellFrame) - NSHeight(textRect)) / 2;
if (renderRect.size.width != 0) {
- [self drawTitle:as
- withFrame:FlipIfRTL(renderRect, cellFrame)
- inView:controlView];
+ [as drawInRect:FlipIfRTL(renderRect, cellFrame)];
}
return NSWidth(renderRect);
}

Powered by Google App Engine
This is Rietveld 408576698