| Index: ui/views/controls/textfield/textfield.cc
|
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
|
| index 258e90b6acb8f276dd872c5d21b27209974c6dd1..67b9ac76585ef83c5f74500c88e3b8de8f5b1632 100644
|
| --- a/ui/views/controls/textfield/textfield.cc
|
| +++ b/ui/views/controls/textfield/textfield.cc
|
| @@ -270,13 +270,21 @@ void Textfield::SetCursorEnabled(bool enabled) {
|
| native_wrapper_->SetCursorEnabled(enabled);
|
| }
|
|
|
| -void Textfield::SetFont(const gfx::Font& font) {
|
| - font_ = font;
|
| +void Textfield::SetFontList(const gfx::FontList& font_list) {
|
| + font_list_ = font_list;
|
| if (native_wrapper_)
|
| native_wrapper_->UpdateFont();
|
| PreferredSizeChanged();
|
| }
|
|
|
| +const gfx::Font& Textfield::GetPrimaryFont() const {
|
| + return font_list_.GetPrimaryFont();
|
| +}
|
| +
|
| +void Textfield::SetFont(const gfx::Font& font) {
|
| + SetFontList(gfx::FontList(font));
|
| +}
|
| +
|
| void Textfield::SetHorizontalMargins(int left, int right) {
|
| margins_.Set(margins_.top(), left, margins_.bottom(), right);
|
| horizontal_margins_were_set_ = true;
|
| @@ -424,22 +432,19 @@ void Textfield::Layout() {
|
| int Textfield::GetBaseline() const {
|
| gfx::Insets insets = GetTextInsets();
|
| const int baseline = native_wrapper_ ?
|
| - native_wrapper_->GetTextfieldBaseline() : font_.GetBaseline();
|
| + native_wrapper_->GetTextfieldBaseline() : font_list_.GetBaseline();
|
| return insets.top() + baseline;
|
| }
|
|
|
| gfx::Size Textfield::GetPreferredSize() {
|
| gfx::Insets insets = GetTextInsets();
|
|
|
| - // For NativeTextfieldViews, we might use a pre-defined font list (defined in
|
| - // IDS_UI_FONT_FAMILY_CROS) as the fonts to render text. The fonts in the
|
| - // list might be different (in name or in size) from |font_|, so we need to
|
| - // use GetFontHeight() to get the height of the first font in the list to
|
| - // guide textfield's height.
|
| const int font_height = native_wrapper_ ? native_wrapper_->GetFontHeight() :
|
| - font_.GetHeight();
|
| - return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) +
|
| - insets.width(), font_height + insets.height());
|
| + font_list_.GetHeight();
|
| + return gfx::Size(
|
| + GetPrimaryFont().GetExpectedTextWidth(default_width_in_chars_)
|
| + + insets.width(),
|
| + font_height + insets.height());
|
| }
|
|
|
| void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) {
|
|
|