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

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: 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..4a6fe392d9070c40a994d2e43b737f1314c3e094 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm
@@ -23,6 +23,10 @@
namespace {
+// How much to adjust the cell sizing up from the default determined
+// by the font.
+const CGFloat kCellHeightAdjust = 6.0;
dschuyler 2015/04/24 18:43:08 This is moved from another file in this CL.
+
// How far to offset image column from the left.
const CGFloat kImageXOffset = 5.0;
@@ -205,6 +209,29 @@ NSAttributedString* CreateClassifiedAttributedString(
}
}
+- (id)copyWithZone:(NSZone*)zone {
+ NSAttributedString* separator = separator_.release();
groby-ooo-7-16 2015/04/24 20:11:16 Why release them?
dschuyler 2015/04/25 01:05:42 I was using code from this file as a pattern: src/
groby-ooo-7-16 2015/04/25 01:31:11 Huh? HyperlinkButtonCell's -copyWithZone: does not
+ NSAttributedString* description = description_.release();
+ NSAttributedString* prefix = prefix_.release();
dschuyler 2015/04/24 18:43:08 This is my first shot at a copyWithZone member. I
groby-ooo-7-16 2015/04/24 20:11:16 Why does this not work? Also, copy->separator_rese
dschuyler 2015/04/25 01:05:42 I must have mislead myself. I was getting a crash
groby-ooo-7-16 2015/04/25 01:31:11 I know it's tempting, but please don't cargo-cult
+ OmniboxPopupCell* copy = [super copyWithZone:zone];
+ copy->match_ = match_;
+ copy->separator_.reset([separator copy]);
+ separator_.reset(separator);
+ copy->description_.reset([description copy]);
+ description_.reset(description);
+ copy->prefix_.reset([prefix copy]);
+ prefix_.reset(prefix);
+ copy->maxMatchContentsWidth_ = maxMatchContentsWidth_;
+ copy->contentsOffset_ = contentsOffset_;
+ return copy;
+}
+
+- (NSRect)drawingRectForBounds:(NSRect)theRect {
+ // Enlarge the cell size.
+ theRect.size.height -= kCellHeightAdjust;
+ return theRect;
+}
+
- (void)setMaxMatchContentsWidth:(CGFloat)maxMatchContentsWidth {
maxMatchContentsWidth_ = maxMatchContentsWidth;
}

Powered by Google App Engine
This is Rietveld 408576698