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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 19666006: Supports FontList in Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removes ResourceBundle::Delegate::GetFontList. Created 7 years, 5 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/views/omnibox/omnibox_result_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
index 1e722aa78866659196668f36ef19dde2a96936a4..fe2225ff7ce3b4ea45a2fb818a2f846aff105f47 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -107,17 +107,18 @@ OmniboxResultView::OmniboxResultView(
OmniboxResultViewModel* model,
int model_index,
LocationBarView* location_bar_view,
- const gfx::Font& font)
+ const gfx::FontList& font_list)
: edge_item_padding_(LocationBarView::GetItemPadding()),
item_padding_(LocationBarView::GetItemPadding()),
minimum_text_vertical_padding_(kMinimumTextVerticalPadding),
model_(model),
model_index_(model_index),
location_bar_view_(location_bar_view),
- font_(font),
- font_height_(std::max(font.GetHeight(),
- font.DeriveFont(0, gfx::BOLD).GetHeight())),
- ellipsis_width_(font.GetStringWidth(string16(kEllipsis))),
+ font_list_(font_list),
+ font_height_(std::max(font_list.GetHeight(),
+ font_list.DeriveFontList(gfx::BOLD).GetHeight())),
+ ellipsis_width_(font_list.GetPrimaryFont().GetStringWidth(
+ string16(kEllipsis))),
mirroring_context_(new MirroringContext()),
keyword_icon_(new views::ImageView()),
animation_(new ui::SlideAnimation(this)) {
@@ -403,7 +404,7 @@ int OmniboxResultView::DrawString(
gfx::RenderText* render_text = render_texts.back();
current_run->classifications.push_back(render_text);
render_text->SetText(text.substr(text_start, text_end - text_start));
- render_text->SetFont(font_);
+ render_text->SetFontList(font_list_);
// Calculate style-related data.
if (classifications[i].style & ACMatchClassification::MATCH)
@@ -471,7 +472,7 @@ int OmniboxResultView::DrawString(
// Align the text runs to a common baseline.
const gfx::Rect rect(
mirroring_context_->mirrored_left_coord(x, x + size.width()),
- y + font_.GetBaseline() - (*j)->GetBaseline(),
+ y + font_list_.GetBaseline() - (*j)->GetBaseline(),
size.width(), size.height());
(*j)->SetDisplayRect(rect);
(*j)->Draw(canvas);
@@ -513,7 +514,8 @@ void OmniboxResultView::Elide(Runs* runs, int remaining_width) const {
// Can we fit at least an ellipsis?
gfx::Font font((*j)->GetStyle(gfx::BOLD) ?
- (*j)->GetFont().DeriveFont(0, gfx::Font::BOLD) : (*j)->GetFont());
+ (*j)->GetPrimaryFont().DeriveFont(0, gfx::Font::BOLD) :
+ (*j)->GetPrimaryFont());
string16 elided_text(
ui::ElideText((*j)->text(), font, remaining_width, ui::ELIDE_AT_END));
Classifications::reverse_iterator prior(j + 1);

Powered by Google App Engine
This is Rietveld 408576698