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

Unified Diff: ui/app_list/views/app_list_item_view.cc

Issue 574983002: Remove unnecessary font list creation in AppListItemView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/app_list_item_view.cc
diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc
index 737e21f0aac6289b0ac364ddba55963e5f2baee0..4a255d03f0a946f3393140d3efa68b1f9b4c25e2 100644
--- a/ui/app_list/views/app_list_item_view.cc
+++ b/ui/app_list/views/app_list_item_view.cc
@@ -41,15 +41,6 @@ const int kTopPadding = 20;
const int kIconTitleSpacing = 7;
const int kProgressBarHorizontalPadding = 12;
-// The font is different on each platform. The font size is adjusted on some
-// platforms to keep a consistent look.
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
-// Reducing the font size by 2 makes it the same as the Windows font size.
-const int kFontSizeDelta = -2;
-#else
-const int kFontSizeDelta = 0;
-#endif
-
// Radius of the folder dropping preview circle.
const int kFolderPreviewRadius = 40;
@@ -95,8 +86,16 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
title_->SetBackgroundColor(0);
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColor(kGridTitleColor);
- title_->SetFontList(
- rb.GetFontList(kItemTextFontStyle).DeriveWithSizeDelta(kFontSizeDelta));
+
+ const gfx::FontList& font_list = rb.GetFontList(kItemTextFontStyle);
+// The font is different on each platform. The font size is adjusted on some
+// platforms to keep a consistent look.
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ // Reducing the font size by 2 makes it the same as the Windows font size.
+ const int kFontSizeDelta = -2;
+ font_list = font_list.DeriveWithSizeDelta(kFontSizeDelta);
tapted 2014/09/18 01:56:45 assigning to a const reference? pretty sure that s
+#endif
+ title_->SetFontList(font_list);
tapted 2014/09/18 01:56:45 nit: I think I liked the #ifdefs being just around
title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_->Invalidate();
SetTitleSubpixelAA();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698