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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <vector> | 10 #include <vector> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 requested_disabled_color_ = color; | 101 requested_disabled_color_ = color; |
102 disabled_color_set_ = true; | 102 disabled_color_set_ = true; |
103 RecalculateColors(); | 103 RecalculateColors(); |
104 } | 104 } |
105 | 105 |
106 void Label::SetBackgroundColor(SkColor color) { | 106 void Label::SetBackgroundColor(SkColor color) { |
107 is_first_paint_text_ = true; | 107 is_first_paint_text_ = true; |
108 background_color_ = color; | 108 background_color_ = color; |
109 background_color_set_ = true; | 109 background_color_set_ = true; |
110 RecalculateColors(); | 110 RecalculateColors(); |
| 111 cached_draw_params_.text.clear(); |
111 } | 112 } |
112 | 113 |
113 void Label::SetShadows(const gfx::ShadowValues& shadows) { | 114 void Label::SetShadows(const gfx::ShadowValues& shadows) { |
114 is_first_paint_text_ = true; | 115 is_first_paint_text_ = true; |
115 shadows_ = shadows; | 116 shadows_ = shadows; |
116 ResetLayoutCache(); | 117 ResetLayoutCache(); |
117 } | 118 } |
118 | 119 |
119 void Label::SetSubpixelRenderingEnabled(bool subpixel_rendering_enabled) { | 120 void Label::SetSubpixelRenderingEnabled(bool subpixel_rendering_enabled) { |
120 is_first_paint_text_ = true; | 121 is_first_paint_text_ = true; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 592 } |
592 | 593 |
593 bool Label::ShouldShowDefaultTooltip() const { | 594 bool Label::ShouldShowDefaultTooltip() const { |
594 const gfx::Size text_size = GetTextSize(); | 595 const gfx::Size text_size = GetTextSize(); |
595 const gfx::Size size = GetContentsBounds().size(); | 596 const gfx::Size size = GetContentsBounds().size(); |
596 return !obscured() && (text_size.width() > size.width() || | 597 return !obscured() && (text_size.width() > size.width() || |
597 (multi_line_ && text_size.height() > size.height())); | 598 (multi_line_ && text_size.height() > size.height())); |
598 } | 599 } |
599 | 600 |
600 } // namespace views | 601 } // namespace views |
OLD | NEW |