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

Unified Diff: ui/views/controls/styled_label.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/styled_label.h ('k') | ui/views/controls/tabbed_pane/tabbed_pane.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/styled_label.cc
diff --git a/ui/views/controls/styled_label.cc b/ui/views/controls/styled_label.cc
index 24d9862c87ccc30b3ced727b11fafe47e687a783..e7ee56c0b44de2b806803fd4da900308c5ade9d4 100644
--- a/ui/views/controls/styled_label.cc
+++ b/ui/views/controls/styled_label.cc
@@ -157,9 +157,15 @@ gfx::Insets StyledLabel::GetInsets() const {
return insets;
}
-int StyledLabel::GetHeightForWidth(int w) {
- if (w != calculated_size_.width())
- calculated_size_ = CalculateAndDoLayout(w, true);
+int StyledLabel::GetHeightForWidth(int w) const {
+ if (w != calculated_size_.width()) {
+ // TODO(erg): Munge the const-ness of the style label. CalculateAndDoLayout
+ // doesn't actually make any changes to member variables when |dry_run| is
+ // set to true. In general, the mutating and non-mutating parts shouldn't
+ // be in the same codepath.
+ calculated_size_ =
+ const_cast<StyledLabel*>(this)->CalculateAndDoLayout(w, true);
+ }
return calculated_size_.height();
}
« no previous file with comments | « ui/views/controls/styled_label.h ('k') | ui/views/controls/tabbed_pane/tabbed_pane.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698