Commit 30de025e authored by Daniel Zhang's avatar Daniel Zhang Committed by Commit Bot

Fix SearchResult tile font

Fixing a bug that involves SearchResult tile text
being cut off on the second line of text.
Standardized text style between SearchResults and
SearchResultTileItems.

Bug: 869632
Change-Id: Ifbcc68c29c17b78a5d2323aa59dc98a759b81b34
Reviewed-on: https://chromium-review.googlesource.com/1162742Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Daniel Zhang <oxyflush@google.com>
Cr-Commit-Position: refs/heads/master@{#581015}
parent 6874ed57
...@@ -49,6 +49,11 @@ constexpr int kSearchRatingStarSize = 12; ...@@ -49,6 +49,11 @@ constexpr int kSearchRatingStarSize = 12;
constexpr int kSearchRatingStarHorizontalSpacing = 1; constexpr int kSearchRatingStarHorizontalSpacing = 1;
constexpr int kSearchRatingStarVerticalSpacing = 2; constexpr int kSearchRatingStarVerticalSpacing = 2;
// Delta applied to the font size of SearchResultTile rating.
constexpr int kSearchRatingTextSizeDelta = 1;
// Delta applied to the font size of SearchResultTile price.
constexpr int kSearchPriceTextSizeDelta = 1;
constexpr int kIconSelectedSize = 56; constexpr int kIconSelectedSize = 56;
constexpr int kIconSelectedCornerRadius = 4; constexpr int kIconSelectedCornerRadius = 4;
// Icon selected color, #000 8%. // Icon selected color, #000 8%.
...@@ -192,13 +197,44 @@ void SearchResultTileItemView::SetSearchResult(SearchResult* item) { ...@@ -192,13 +197,44 @@ void SearchResultTileItemView::SetSearchResult(SearchResult* item) {
if (rating_) { if (rating_) {
rating_->SetBackground( rating_->SetBackground(
views::CreateSolidBackground(kCardBackgroundColor)); views::CreateSolidBackground(kCardBackgroundColor));
if (!IsSuggestedAppTile()) {
// App search results use different fonts than AppList apps.
rating_->SetFontList(
ui::ResourceBundle::GetSharedInstance()
.GetFontList(kSearchResultTitleFontStyle)
.DeriveWithSizeDelta(kSearchRatingTextSizeDelta));
rating_->SetLineHeight(rating_->font_list().GetHeight());
} else {
rating_->SetFontList(font);
rating_->SetLineHeight(font.GetHeight());
}
} }
if (price_) { if (price_) {
price_->SetBackground(views::CreateSolidBackground(kCardBackgroundColor)); price_->SetBackground(views::CreateSolidBackground(kCardBackgroundColor));
if (!IsSuggestedAppTile()) {
// App search results use different fonts than AppList apps.
price_->SetFontList(
ui::ResourceBundle::GetSharedInstance()
.GetFontList(kSearchResultTitleFontStyle)
.DeriveWithSizeDelta(kSearchPriceTextSizeDelta));
price_->SetLineHeight(price_->font_list().GetHeight());
} else {
price_->SetFontList(font);
price_->SetLineHeight(font.GetHeight());
}
} }
title_->SetBackground(views::CreateSolidBackground(kCardBackgroundColor)); title_->SetBackground(views::CreateSolidBackground(kCardBackgroundColor));
title_->SetFontList(font); if (!IsSuggestedAppTile()) {
title_->SetLineHeight(font.GetHeight()); // App search results use different fonts than AppList apps.
title_->SetFontList(
ui::ResourceBundle::GetSharedInstance()
.GetFontList(kSearchResultTitleFontStyle)
.DeriveWithSizeDelta(kSearchResultTitleTextSizeDelta));
title_->SetLineHeight(title_->font_list().GetHeight());
} else {
title_->SetFontList(font);
title_->SetLineHeight(font.GetHeight());
}
title_->SetEnabledColor(kSearchTitleColor); title_->SetEnabledColor(kSearchTitleColor);
} }
......
...@@ -146,7 +146,8 @@ void SearchResultView::CreateTitleRenderText() { ...@@ -146,7 +146,8 @@ void SearchResultView::CreateTitleRenderText() {
render_text->SetText(result_->title()); render_text->SetText(result_->title());
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
render_text->SetFontList( render_text->SetFontList(
rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(2)); rb.GetFontList(kSearchResultTitleFontStyle)
.DeriveWithSizeDelta(kSearchResultTitleTextSizeDelta));
// When result is an omnibox non-url search, the matched tag indicates // When result is an omnibox non-url search, the matched tag indicates
// proposed query. For all other cases, the matched tag indicates typed search // proposed query. For all other cases, the matched tag indicates typed search
// query. // query.
......
...@@ -125,6 +125,13 @@ const ui::ResourceBundle::FontStyle kItemTextFontStyle = ...@@ -125,6 +125,13 @@ const ui::ResourceBundle::FontStyle kItemTextFontStyle =
const float kAllAppsOpacityStartPx = 8.0f; const float kAllAppsOpacityStartPx = 8.0f;
const float kAllAppsOpacityEndPx = 144.0f; const float kAllAppsOpacityEndPx = 144.0f;
// Delta applied to font size of all AppListSearchResult titles.
const int kSearchResultTitleTextSizeDelta = 2;
// Font style for AppListSearchResultTileItemViews that are not suggested apps.
const ui::ResourceBundle::FontStyle kSearchResultTitleFontStyle =
ui::ResourceBundle::BaseFont;
// The UMA histogram that logs usage of suggested and regular apps. // The UMA histogram that logs usage of suggested and regular apps.
const char kAppListAppLaunched[] = "Apps.AppListAppLaunched"; const char kAppListAppLaunched[] = "Apps.AppListAppLaunched";
......
...@@ -73,6 +73,10 @@ ASH_PUBLIC_EXPORT extern const ui::ResourceBundle::FontStyle kItemTextFontStyle; ...@@ -73,6 +73,10 @@ ASH_PUBLIC_EXPORT extern const ui::ResourceBundle::FontStyle kItemTextFontStyle;
ASH_PUBLIC_EXPORT extern const float kAllAppsOpacityStartPx; ASH_PUBLIC_EXPORT extern const float kAllAppsOpacityStartPx;
ASH_PUBLIC_EXPORT extern const float kAllAppsOpacityEndPx; ASH_PUBLIC_EXPORT extern const float kAllAppsOpacityEndPx;
ASH_PUBLIC_EXPORT extern const int kSearchResultTitleTextSizeDelta;
ASH_PUBLIC_EXPORT extern const ui::ResourceBundle::FontStyle
kSearchResultTitleFontStyle;
// The different ways that the app list can transition from PEEKING to // The different ways that the app list can transition from PEEKING to
// FULLSCREEN_ALL_APPS. These values are written to logs. New enum // FULLSCREEN_ALL_APPS. These values are written to logs. New enum
// values can be added, but existing enums must never be renumbered or deleted // values can be added, but existing enums must never be renumbered or deleted
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment