| OLD | NEW |
| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // Typically the border renders differently when focused. | 419 // Typically the border renders differently when focused. |
| 420 SchedulePaint(); | 420 SchedulePaint(); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void LabelButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 423 void LabelButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 424 ResetColorsFromNativeTheme(); | 424 ResetColorsFromNativeTheme(); |
| 425 UpdateThemedBorder(); | 425 UpdateThemedBorder(); |
| 426 ResetLabelEnabledColor(); | 426 ResetLabelEnabledColor(); |
| 427 // Invalidate the layout to pickup the new insets from the border. | 427 // Invalidate the layout to pickup the new insets from the border. |
| 428 InvalidateLayout(); | 428 InvalidateLayout(); |
| 429 // The entire button has to be repainted here, since the native theme can |
| 430 // define the tint for the entire background/border/focus ring. |
| 431 SchedulePaint(); |
| 429 } | 432 } |
| 430 | 433 |
| 431 void LabelButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 434 void LabelButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 432 image()->SetPaintToLayer(true); | 435 image()->SetPaintToLayer(true); |
| 433 image()->layer()->SetFillsBoundsOpaquely(false); | 436 image()->layer()->SetFillsBoundsOpaquely(false); |
| 434 ink_drop_container_->SetVisible(true); | 437 ink_drop_container_->SetVisible(true); |
| 435 ink_drop_container_->layer()->Add(ink_drop_layer); | 438 ink_drop_container_->layer()->Add(ink_drop_layer); |
| 436 } | 439 } |
| 437 | 440 |
| 438 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 441 void LabelButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 void LabelButton::ResetLabelEnabledColor() { | 609 void LabelButton::ResetLabelEnabledColor() { |
| 607 const SkColor color = | 610 const SkColor color = |
| 608 explicitly_set_colors_[state()] | 611 explicitly_set_colors_[state()] |
| 609 ? button_state_colors_[state()] | 612 ? button_state_colors_[state()] |
| 610 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 613 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 611 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 614 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 612 label_->SetEnabledColor(color); | 615 label_->SetEnabledColor(color); |
| 613 } | 616 } |
| 614 | 617 |
| 615 } // namespace views | 618 } // namespace views |
| OLD | NEW |