Clean-up: Replaces obsolete Font/FontList methods.

Replaces obsolete methods of gfx::Font and gfx::FontList with new ones.

BUG=265485
TEST=none

Review URL: https://codereview.chromium.org/140693017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248926 0039d316-1c4b-4281-b951-d872f2087c98
parent 6fcfd90d
...@@ -52,12 +52,10 @@ views::Label* CreateShortcutLabel( ...@@ -52,12 +52,10 @@ views::Label* CreateShortcutLabel(
if (orientation == ui::CandidateWindow::VERTICAL) { if (orientation == ui::CandidateWindow::VERTICAL) {
shortcut_label->SetFontList( shortcut_label->SetFontList(
shortcut_label->font_list().DeriveFontListWithSizeDeltaAndStyle( shortcut_label->font_list().Derive(kFontSizeDelta, gfx::Font::BOLD));
kFontSizeDelta, gfx::Font::BOLD));
} else { } else {
shortcut_label->SetFontList( shortcut_label->SetFontList(
shortcut_label->font_list().DeriveFontListWithSizeDelta( shortcut_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
kFontSizeDelta));
} }
// TODO(satorux): Maybe we need to use language specific fonts for // TODO(satorux): Maybe we need to use language specific fonts for
// candidate_label, like Chinese font for Chinese input method? // candidate_label, like Chinese font for Chinese input method?
...@@ -108,7 +106,7 @@ views::Label* CreateCandidateLabel( ...@@ -108,7 +106,7 @@ views::Label* CreateCandidateLabel(
// Change the font size. // Change the font size.
candidate_label->SetFontList( candidate_label->SetFontList(
candidate_label->font_list().DeriveFontListWithSizeDelta(kFontSizeDelta)); candidate_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
return candidate_label; return candidate_label;
...@@ -124,8 +122,7 @@ views::Label* CreateAnnotationLabel( ...@@ -124,8 +122,7 @@ views::Label* CreateAnnotationLabel(
// Change the font size and color. // Change the font size and color.
annotation_label->SetFontList( annotation_label->SetFontList(
annotation_label->font_list().DeriveFontListWithSizeDelta( annotation_label->font_list().DeriveWithSizeDelta(kFontSizeDelta));
kFontSizeDelta));
annotation_label->SetEnabledColor(theme.GetSystemColor( annotation_label->SetEnabledColor(theme.GetSystemColor(
ui::NativeTheme::kColorId_LabelDisabledColor)); ui::NativeTheme::kColorId_LabelDisabledColor));
annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
......
...@@ -488,7 +488,10 @@ class AudioDetailedView : public TrayDetailsView, ...@@ -488,7 +488,10 @@ class AudioDetailedView : public TrayDetailsView,
} }
void AddScrollListInfoItem(const base::string16& text) { void AddScrollListInfoItem(const base::string16& text) {
views::Label* label = new views::Label(text); views::Label* label = new views::Label(
text,
ui::ResourceBundle::GetSharedInstance().GetFontList(
ui::ResourceBundle::BoldFont));
// Align info item with checkbox items // Align info item with checkbox items
int margin = kTrayPopupPaddingHorizontal + int margin = kTrayPopupPaddingHorizontal +
...@@ -507,8 +510,6 @@ class AudioDetailedView : public TrayDetailsView, ...@@ -507,8 +510,6 @@ class AudioDetailedView : public TrayDetailsView,
right_margin)); right_margin));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0));
label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle(
0, gfx::Font::BOLD));
scroll_content()->AddChildView(label); scroll_content()->AddChildView(label);
} }
......
...@@ -59,7 +59,7 @@ class TraySms::SmsDefaultView : public TrayItemMore { ...@@ -59,7 +59,7 @@ class TraySms::SmsDefaultView : public TrayItemMore {
public: public:
explicit SmsDefaultView(TraySms* owner) explicit SmsDefaultView(TraySms* owner)
: TrayItemMore(owner, true) { : TrayItemMore(owner, true) {
SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed( SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_AURA_UBER_TRAY_SMS)); IDR_AURA_UBER_TRAY_SMS));
Update(); Update();
} }
...@@ -96,11 +96,10 @@ class TraySms::SmsMessageView : public views::View, ...@@ -96,11 +96,10 @@ class TraySms::SmsMessageView : public views::View,
index_(index) { index_(index) {
number_label_ = new views::Label( number_label_ = new views::Label(
l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER, l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER,
base::UTF8ToUTF16(number))); base::UTF8ToUTF16(number)),
ui::ResourceBundle::GetSharedInstance().GetFontList(
ui::ResourceBundle::BoldFont));
number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
number_label_->SetFontList(
number_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(
0, gfx::Font::BOLD));
message_label_ = new views::Label(base::UTF8ToUTF16(message)); message_label_ = new views::Label(base::UTF8ToUTF16(message));
message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
...@@ -125,8 +124,9 @@ class TraySms::SmsMessageView : public views::View, ...@@ -125,8 +124,9 @@ class TraySms::SmsMessageView : public views::View,
private: private:
void LayoutDetailedView() { void LayoutDetailedView() {
views::ImageButton* close_button = new views::ImageButton(this); views::ImageButton* close_button = new views::ImageButton(this);
close_button->SetImage(views::CustomButton::STATE_NORMAL, close_button->SetImage(
ResourceBundle::GetSharedInstance().GetImageSkiaNamed( views::CustomButton::STATE_NORMAL,
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_AURA_WINDOW_CLOSE)); IDR_AURA_WINDOW_CLOSE));
const int msg_width = owner_->system_tray()->GetSystemBubble()-> const int msg_width = owner_->system_tray()->GetSystemBubble()->
bubble_view()->GetPreferredSize().width() - bubble_view()->GetPreferredSize().width() -
......
...@@ -301,8 +301,8 @@ void TimeView::SetupLabels() { ...@@ -301,8 +301,8 @@ void TimeView::SetupLabels() {
void TimeView::SetupLabel(views::Label* label) { void TimeView::SetupLabel(views::Label* label) {
label->set_owned_by_client(); label->set_owned_by_client();
SetupLabelForTray(label); SetupLabelForTray(label);
label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle( label->SetFontList(label->font_list().DeriveWithStyle(
0, label->font_list().GetFontStyle() & ~gfx::Font::BOLD)); label->font_list().GetFontStyle() & ~gfx::Font::BOLD));
} }
} // namespace tray } // namespace tray
......
...@@ -15,9 +15,8 @@ ...@@ -15,9 +15,8 @@
#include "grit/ash_resources.h" #include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/insets.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/size.h"
#include "ui/views/bubble/tray_bubble_view.h" #include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/label_button_border.h" #include "ui/views/controls/button/label_button_border.h"
...@@ -83,8 +82,6 @@ class LogoutConfirmationDialogDelegate ...@@ -83,8 +82,6 @@ class LogoutConfirmationDialogDelegate
LogoutButton::LogoutButton(views::ButtonListener* listener) LogoutButton::LogoutButton(views::ButtonListener* listener)
: views::LabelButton(listener, base::string16()) { : views::LabelButton(listener, base::string16()) {
SetupLabelForTray(label()); SetupLabelForTray(label());
SetFontList(
GetFontList().DeriveFontListWithSizeDeltaAndStyle(0, gfx::Font::NORMAL));
for (size_t state = 0; state < views::Button::STATE_COUNT; ++state) for (size_t state = 0; state < views::Button::STATE_COUNT; ++state)
SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE); SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE);
......
...@@ -45,7 +45,7 @@ views::View* TrayMonitor::CreateTrayView(user::LoginStatus status) { ...@@ -45,7 +45,7 @@ views::View* TrayMonitor::CreateTrayView(user::LoginStatus status) {
SkColorSetARGB(64, 0, 0, 0)); SkColorSetARGB(64, 0, 0, 0));
label_->SetShadowOffset(0, 1); label_->SetShadowOffset(0, 1);
label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_->SetFontList(label_->font_list().DeriveFontListWithSizeDelta(-2)); label_->SetFontList(label_->font_list().DeriveWithSizeDelta(-2));
return view; return view;
} }
......
...@@ -54,8 +54,8 @@ views::Label* CreateAndSetupLabel() { ...@@ -54,8 +54,8 @@ views::Label* CreateAndSetupLabel() {
views::Label* label = new views::Label; views::Label* label = new views::Label;
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
SetupLabelForTray(label); SetupLabelForTray(label);
label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle( label->SetFontList(label->font_list().DeriveWithStyle(
0, label->font_list().GetFontStyle() & ~gfx::Font::BOLD)); label->font_list().GetFontStyle() & ~gfx::Font::BOLD));
return label; return label;
} }
......
...@@ -56,8 +56,7 @@ void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, ...@@ -56,8 +56,7 @@ void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
text_label_ = new views::Label(text); text_label_ = new views::Label(text);
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_label_->SetFontList( text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
if (text_default_color_) if (text_default_color_)
text_label_->SetEnabledColor(text_default_color_); text_label_->SetEnabledColor(text_default_color_);
AddChildView(text_label_); AddChildView(text_label_);
...@@ -80,8 +79,7 @@ views::Label* HoverHighlightView::AddLabel(const base::string16& text, ...@@ -80,8 +79,7 @@ views::Label* HoverHighlightView::AddLabel(const base::string16& text,
text_label_->SetBorder( text_label_->SetBorder(
views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin)); views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin));
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_label_->SetFontList( text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
// Do not set alpha value in disable color. It will have issue with elide // Do not set alpha value in disable color. It will have issue with elide
// blending filter in disabled state for rendering label text color. // blending filter in disabled state for rendering label text color.
text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127)); text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127));
...@@ -113,8 +111,7 @@ views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text, ...@@ -113,8 +111,7 @@ views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text,
text_label_ = new views::Label(text); text_label_ = new views::Label(text);
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_label_->SetFontList( text_label_->SetFontList(text_label_->font_list().DeriveWithStyle(style));
text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0)); text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0));
if (text_default_color_) if (text_default_color_)
text_label_->SetEnabledColor(text_default_color_); text_label_->SetEnabledColor(text_default_color_);
......
...@@ -14,10 +14,10 @@ namespace ash { ...@@ -14,10 +14,10 @@ namespace ash {
namespace internal { namespace internal {
void SetupLabelForTray(views::Label* label) { void SetupLabelForTray(views::Label* label) {
// Making label_font static to avoid the time penalty of DeriveFont for // Making label_font static to avoid the time penalty of Derive for all but
// all but the first call. // the first call.
static const gfx::FontList label_font_list( static const gfx::FontList label_font_list(
gfx::FontList().DeriveFontListWithSizeDeltaAndStyle(1, gfx::Font::BOLD)); gfx::FontList().Derive(1, gfx::Font::BOLD));
label->SetFontList(label_font_list); label->SetFontList(label_font_list);
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColor(SK_ColorWHITE); label->SetEnabledColor(SK_ColorWHITE);
......
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