summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 23:24:51 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 23:24:51 +0000
commit193a6b7feffd2ddb285676df63852147e2e8426e (patch)
tree8e2db8f10e3e73e74a20b95d8bb099d4dc517c4f
parentbc1890fe2b43d42ffc93749af566b416c9b5a1be (diff)
downloadchromium_src-193a6b7feffd2ddb285676df63852147e2e8426e.zip
chromium_src-193a6b7feffd2ddb285676df63852147e2e8426e.tar.gz
chromium_src-193a6b7feffd2ddb285676df63852147e2e8426e.tar.bz2
ash: Use big char such as 'G' to calculate minimum title width.
GetAverageCharacterWidth does not work well for title because there are many upper case chars there. As a result, 15 chars are not guaranteed to be visible. BUG=119496 TEST=We should always be able to see 15 chars in app list title. Review URL: https://chromiumcodereview.appspot.com/9835058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128609 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/app_list/app_list_item_view.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/ash/app_list/app_list_item_view.cc b/ash/app_list/app_list_item_view.cc
index 3258223..cd30fb0 100644
--- a/ash/app_list/app_list_item_view.cc
+++ b/ash/app_list/app_list_item_view.cc
@@ -220,7 +220,9 @@ gfx::Size AppListItemView::GetPreferredSizeForIconSize(
int left_right_padding = 20;
if (min_title_width == 0) {
const gfx::Font& title_font = GetTitleFontForIconSize(icon_size);
- min_title_width = kMinTitleChars * title_font.GetAverageCharacterWidth();
+ // Use big char such as 'G' to calculate min title width.
+ min_title_width = kMinTitleChars *
+ title_font.GetStringWidth(ASCIIToUTF16("G"));
left_right_padding = kLeftRightPaddingChars *
title_font.GetAverageCharacterWidth();
}