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

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 2620453005: Material Design: Fix MdLabelButton not updating text colors on theme changes (Closed)
Patch Set: Refactor Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 style_)); 370 style_));
371 return border; 371 return border;
372 } 372 }
373 373
374 void LabelButton::SetBorder(std::unique_ptr<Border> border) { 374 void LabelButton::SetBorder(std::unique_ptr<Border> border) {
375 border_is_themed_border_ = false; 375 border_is_themed_border_ = false;
376 View::SetBorder(std::move(border)); 376 View::SetBorder(std::move(border));
377 ResetCachedPreferredSize(); 377 ResetCachedPreferredSize();
378 } 378 }
379 379
380 void LabelButton::ResetExplicitnessOfEnabledTextColors() {
381 for (ButtonState state : {STATE_NORMAL, STATE_HOVERED, STATE_PRESSED})
Evan Stade 2017/01/07 01:31:40 hmm, this is not quite as I imagined, because STAT
Tom (Use chromium acct) 2017/01/07 02:35:11 Done. I liked (c) the most so I went with that
382 explicitly_set_colors_[state] = false;
383 }
384
380 gfx::Rect LabelButton::GetChildAreaBounds() { 385 gfx::Rect LabelButton::GetChildAreaBounds() {
381 return GetLocalBounds(); 386 return GetLocalBounds();
382 } 387 }
383 388
384 void LabelButton::SetFontList(const gfx::FontList& font_list) { 389 void LabelButton::SetFontList(const gfx::FontList& font_list) {
385 cached_normal_font_list_ = font_list; 390 cached_normal_font_list_ = font_list;
386 if (PlatformStyle::kDefaultLabelButtonHasBoldFont) { 391 if (PlatformStyle::kDefaultLabelButtonHasBoldFont) {
387 cached_bold_font_list_ = font_list.DeriveWithWeight( 392 cached_bold_font_list_ = font_list.DeriveWithWeight(
388 GetValueBolderThan(font_list.GetFontWeight())); 393 GetValueBolderThan(font_list.GetFontWeight()));
389 if (is_default_) { 394 if (is_default_) {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 : PlatformStyle::TextColorForButton(button_state_colors_, *this); 609 : PlatformStyle::TextColorForButton(button_state_colors_, *this);
605 if (state() != STATE_DISABLED && label_->enabled_color() != color) 610 if (state() != STATE_DISABLED && label_->enabled_color() != color)
606 label_->SetEnabledColor(color); 611 label_->SetEnabledColor(color);
607 } 612 }
608 613
609 bool LabelButton::UseFloodFillInkDrop() const { 614 bool LabelButton::UseFloodFillInkDrop() const {
610 return !GetText().empty(); 615 return !GetText().empty();
611 } 616 }
612 617
613 } // namespace views 618 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698