Chromium Code Reviews| 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/label.h" | 5 #include "ui/views/controls/label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 void Label::UpdateColorsFromTheme(const ui::NativeTheme* theme) { | 589 void Label::UpdateColorsFromTheme(const ui::NativeTheme* theme) { |
| 590 if (!enabled_color_set_) { | 590 if (!enabled_color_set_) { |
| 591 requested_enabled_color_ = theme->GetSystemColor( | 591 requested_enabled_color_ = theme->GetSystemColor( |
| 592 ui::NativeTheme::kColorId_LabelEnabledColor); | 592 ui::NativeTheme::kColorId_LabelEnabledColor); |
| 593 } | 593 } |
| 594 if (!disabled_color_set_) { | 594 if (!disabled_color_set_) { |
| 595 requested_disabled_color_ = theme->GetSystemColor( | 595 requested_disabled_color_ = theme->GetSystemColor( |
| 596 ui::NativeTheme::kColorId_LabelDisabledColor); | 596 ui::NativeTheme::kColorId_LabelDisabledColor); |
| 597 } | 597 } |
| 598 if (!background_color_set_) { | 598 if (!background_color_set_) { |
| 599 background_color_ = theme->GetSystemColor( | 599 background_color_ = |
| 600 ui::NativeTheme::kColorId_LabelBackgroundColor); | 600 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
|
sky
2016/10/03 16:12:05
Why are you preferring dialogbackground to labelba
Evan Stade
2016/10/03 19:46:44
I'd say it only implies labels /can/ be used in di
| |
| 601 } | 601 } |
| 602 RecalculateColors(); | 602 RecalculateColors(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 bool Label::ShouldShowDefaultTooltip() const { | 605 bool Label::ShouldShowDefaultTooltip() const { |
| 606 const gfx::Size text_size = GetTextSize(); | 606 const gfx::Size text_size = GetTextSize(); |
| 607 const gfx::Size size = GetContentsBounds().size(); | 607 const gfx::Size size = GetContentsBounds().size(); |
| 608 return !obscured() && (text_size.width() > size.width() || | 608 return !obscured() && (text_size.width() > size.width() || |
| 609 (multi_line() && text_size.height() > size.height())); | 609 (multi_line() && text_size.height() > size.height())); |
| 610 } | 610 } |
| 611 | 611 |
| 612 } // namespace views | 612 } // namespace views |
| OLD | NEW |