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

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..a696995609fe160f2e51d9d507210654945fa945 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;
@@ -70,6 +61,20 @@ const gfx::ShadowValues& GetIconShadows() {
return icon_shadows;
}
+gfx::FontList GetFontList() {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ 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;
+ return font_list.DeriveWithSizeDelta(kFontSizeDelta);
+#else
+ return font_list;
+#endif
+}
+
} // namespace
// static
@@ -91,12 +96,12 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
is_highlighted_(false) {
icon_->set_interactive(false);
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
title_->SetBackgroundColor(0);
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColor(kGridTitleColor);
- title_->SetFontList(
- rb.GetFontList(kItemTextFontStyle).DeriveWithSizeDelta(kFontSizeDelta));
+
+ static const gfx::FontList font_list = GetFontList();
+ title_->SetFontList(font_list);
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