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(); |
} |