| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 }; | 489 }; |
| 490 | 490 |
| 491 // Use hardcoded colors for inverted color scheme support and STYLE_BUTTON. | 491 // Use hardcoded colors for inverted color scheme support and STYLE_BUTTON. |
| 492 if (color_utils::IsInvertedColorScheme()) { | 492 if (color_utils::IsInvertedColorScheme()) { |
| 493 colors[STATE_NORMAL] = colors[STATE_HOVERED] = colors[STATE_PRESSED] = | 493 colors[STATE_NORMAL] = colors[STATE_HOVERED] = colors[STATE_PRESSED] = |
| 494 SK_ColorWHITE; | 494 SK_ColorWHITE; |
| 495 label_->SetBackgroundColor(SK_ColorBLACK); | 495 label_->SetBackgroundColor(SK_ColorBLACK); |
| 496 label_->set_background(Background::CreateSolidBackground(SK_ColorBLACK)); | 496 label_->set_background(Background::CreateSolidBackground(SK_ColorBLACK)); |
| 497 label_->SetAutoColorReadabilityEnabled(true); | 497 label_->SetAutoColorReadabilityEnabled(true); |
| 498 label_->SetShadows(gfx::ShadowValues()); | 498 label_->SetShadows(gfx::ShadowValues()); |
| 499 } else if (style() == STYLE_BUTTON) { | 499 } else { |
| 500 PlatformStyle::ApplyLabelButtonTextStyle(label_, &colors); | 500 if (style() == STYLE_BUTTON) |
| 501 PlatformStyle::ApplyLabelButtonTextStyle(label_, &colors); |
| 501 label_->set_background(nullptr); | 502 label_->set_background(nullptr); |
| 502 } else { | 503 label_->SetAutoColorReadabilityEnabled(false); |
| 503 label_->set_background(nullptr); | |
| 504 } | 504 } |
| 505 | 505 |
| 506 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { | 506 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { |
| 507 if (!explicitly_set_colors_[state]) { | 507 if (!explicitly_set_colors_[state]) { |
| 508 SetTextColor(static_cast<ButtonState>(state), colors[state]); | 508 SetTextColor(static_cast<ButtonState>(state), colors[state]); |
| 509 explicitly_set_colors_[state] = false; | 509 explicitly_set_colors_[state] = false; |
| 510 } | 510 } |
| 511 } | 511 } |
| 512 } | 512 } |
| 513 | 513 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 void LabelButton::ResetLabelEnabledColor() { | 588 void LabelButton::ResetLabelEnabledColor() { |
| 589 const SkColor color = | 589 const SkColor color = |
| 590 explicitly_set_colors_[state()] | 590 explicitly_set_colors_[state()] |
| 591 ? button_state_colors_[state()] | 591 ? button_state_colors_[state()] |
| 592 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 592 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 593 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 593 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 594 label_->SetEnabledColor(color); | 594 label_->SetEnabledColor(color); |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace views | 597 } // namespace views |
| OLD | NEW |