| 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..6b6f8c9d3b1f130474d0660a8828ddd3ef5801b0 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,7 +432,7 @@ 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;
|
| }
|
|
|
| @@ -437,9 +445,11 @@ gfx::Size Textfield::GetPreferredSize() {
|
| // 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) {
|
|
|