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

Unified Diff: ui/views/controls/textfield/native_textfield_views.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: ui/views/controls/textfield/native_textfield_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 31687afa180b6ef02987f1d6793e22dfeb1a9ed0..2ac35aac75cf0d252946fd1bde4f53c96478ebe9 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
-#include "grit/app_locale_settings.h"
#include "grit/ui_strings.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -82,14 +81,7 @@ NativeTextfieldViews::NativeTextfieldViews(Textfield* parent)
cursor_timer_(this),
aggregated_clicks_(0) {
set_border(text_border_);
-
-#if defined(OS_CHROMEOS)
- GetRenderText()->SetFontList(gfx::FontList(l10n_util::GetStringUTF8(
- IDS_UI_FONT_FAMILY_CROS)));
-#else
- GetRenderText()->SetFont(textfield_->font());
-#endif
-
+ GetRenderText()->SetFontList(textfield_->font_list());
UpdateColorsFromTheme(GetNativeTheme());
set_context_menu_controller(this);
set_drag_controller(this);
@@ -575,13 +567,7 @@ void NativeTextfieldViews::UpdateReadOnly() {
}
void NativeTextfieldViews::UpdateFont() {
-#if defined(OS_CHROMEOS)
- // For ChromeOS, we support a pre-defined font list per locale. UpdateFont()
- // only changes the font size, not the font family names.
- GetRenderText()->SetFontSize(textfield_->font().GetFontSize());
-#else
- GetRenderText()->SetFont(textfield_->font());
-#endif
+ GetRenderText()->SetFontList(textfield_->font_list());
OnCaretBoundsChanged();
}
@@ -726,11 +712,11 @@ void NativeTextfieldViews::ClearEditHistory() {
}
int NativeTextfieldViews::GetFontHeight() {
- return GetRenderText()->GetFont().GetHeight();
+ return GetRenderText()->font_list().GetHeight();
}
int NativeTextfieldViews::GetTextfieldBaseline() const {
- return GetRenderText()->GetFont().GetBaseline();
+ return GetRenderText()->font_list().GetBaseline();
}
int NativeTextfieldViews::GetWidthNeededForText() const {
@@ -1166,7 +1152,7 @@ void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
!textfield_->placeholder_text().empty()) {
canvas->DrawStringInt(
textfield_->placeholder_text(),
- GetRenderText()->GetFont(),
+ GetRenderText()->GetPrimaryFont(),
textfield_->placeholder_text_color(),
GetRenderText()->display_rect());
}

Powered by Google App Engine
This is Rietveld 408576698