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

Side by Side Diff: ui/views/controls/label.cc

Issue 846853003: views::Label: Invalidate cached draw flags when background color is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698