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

Unified Diff: ui/views/controls/button/md_text_button.cc

Issue 2190453002: Update CrOS logout button for MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix override Created 4 years, 4 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
« no previous file with comments | « ui/views/controls/button/md_text_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/md_text_button.cc
diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc
index ebb275ea5cc56a4559bf107646258818b68a89e7..77eb8e436e73a403cfa8f865ac008ae030c1d97e 100644
--- a/ui/views/controls/button/md_text_button.cc
+++ b/ui/views/controls/button/md_text_button.cc
@@ -206,10 +206,20 @@ void MdTextButton::SetEnabledTextColors(SkColor color) {
UpdateColors();
}
+void MdTextButton::AdjustFontSize(int size_delta) {
+ LabelButton::AdjustFontSize(size_delta);
+ UpdatePaddingForFont();
+}
+
void MdTextButton::UpdateStyleToIndicateDefaultStatus() {
UpdateColors();
}
+void MdTextButton::SetFontList(const gfx::FontList& font_list) {
+ NOTREACHED()
+ << "Don't call MdTextButton::SetFontList (it will soon be protected)";
+}
+
MdTextButton::MdTextButton(ButtonListener* listener)
: LabelButton(listener, base::string16()),
focus_ring_(new internal::MdFocusRing()),
@@ -221,12 +231,16 @@ MdTextButton::MdTextButton(ButtonListener* listener)
SetMinSize(gfx::Size(kMinWidth, 0));
SetFocusPainter(nullptr);
label()->SetAutoColorReadabilityEnabled(false);
- SetFontList(GetMdFontList());
-
AddChildView(focus_ring_);
focus_ring_->SetVisible(false);
set_request_focus_on_press(false);
+ LabelButton::SetFontList(GetMdFontList());
+ UpdatePaddingForFont();
+}
+
+MdTextButton::~MdTextButton() {}
+void MdTextButton::UpdatePaddingForFont() {
// Top and bottom padding depend on the font. Example: if font cap height is
// 9dp, use 8dp bottom padding and 7dp top padding to total 24dp.
const gfx::FontList& font = label()->font_list();
@@ -247,8 +261,6 @@ MdTextButton::MdTextButton(ButtonListener* listener)
bottom_padding - inbuilt_bottom_padding, kHorizontalPadding));
}
-MdTextButton::~MdTextButton() {}
-
void MdTextButton::UpdateColors() {
ui::NativeTheme::ColorId fg_color_id =
is_cta_ ? ui::NativeTheme::kColorId_TextOnCallToActionColor
« no previous file with comments | « ui/views/controls/button/md_text_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698