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

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: bug links Created 4 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
« 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..3d3e5310cb472a1131a56ffc70276d1b6289be7a 100644
--- a/ui/views/controls/button/md_text_button.cc
+++ b/ui/views/controls/button/md_text_button.cc
@@ -136,6 +136,11 @@ void MdTextButton::PaintMdFocusRing(gfx::Canvas* canvas,
canvas->DrawRoundRect(rect, kFocusBorderCornerRadius, paint);
}
+void MdTextButton::AdjustFontSize(int size_delta) {
+ SetFontList(GetFontList().DeriveWithSizeDelta(size_delta));
+ UpdatePaddingForFont();
+}
+
void MdTextButton::SetCallToAction(bool cta) {
if (is_cta_ == cta)
return;
@@ -221,12 +226,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);
+ SetFontList(GetMdFontList());
sky 2016/07/27 19:57:07 As anyone can call SetFontList, shouldn't you make
Evan Stade 2016/07/27 20:09:47 are you suggesting making SetFontList virtual? I'm
+ 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 +256,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