Index: ui/views/controls/label.h |
diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h |
index f3b6b634d29cf9d8e567e3271dfd9e0aa89da1ce..01bb10e1453a8b0158d3801549de87119e61a1d8 100644 |
--- a/ui/views/controls/label.h |
+++ b/ui/views/controls/label.h |
@@ -149,6 +149,14 @@ class VIEWS_EXPORT Label : public View { |
void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
private: |
+ struct DrawStringParams { |
+ base::string16 text; |
+ gfx::Rect bounds; |
+ int flags; |
+ |
+ DrawStringParams() : flags(0) {} |
sky
2015/01/08 03:48:49
style guide says members after functions, even for
ckocagil
2015/01/08 14:16:32
Done.
|
+ }; |
+ |
// These tests call CalculateDrawStringParams in order to verify the |
// calculations done for drawing text. |
FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString); |
@@ -174,16 +182,14 @@ class VIEWS_EXPORT Label : public View { |
gfx::Rect GetAvailableRect() const; |
// Returns parameters to be used for the DrawString call. |
- void CalculateDrawStringParams(base::string16* paint_text, |
- gfx::Rect* text_bounds, |
- int* flags) const; |
+ const DrawStringParams* CalculateDrawStringParams() const; |
sky
2015/01/08 03:48:49
Document ownership here.
ckocagil
2015/01/08 14:16:32
Done.
|
// Updates any colors that have not been explicitly set from the theme. |
void UpdateColorsFromTheme(const ui::NativeTheme* theme); |
- // Resets |cached_heights_| and |cached_heights_cursor_| and mark |
- // |text_size_valid_| as false. |
- void ResetCachedSize(); |
+ // Resets |cached_heights_|, |cached_heights_cursor_|, |cached_draw_params_| |
+ // and mark |text_size_valid_| as false. |
+ void ResetLayoutCache(); |
bool ShouldShowDefaultTooltip() const; |
@@ -221,6 +227,9 @@ class VIEWS_EXPORT Label : public View { |
mutable std::vector<gfx::Size> cached_heights_; |
mutable int cached_heights_cursor_; |
+ // The cached results of CalculateDrawStringParams(). |
+ mutable scoped_ptr<const DrawStringParams> cached_draw_params_; |
sky
2015/01/08 03:48:49
Is there a reason to recreate this rather than mak
ckocagil
2015/01/08 14:16:32
Done, it's a member now.
|
+ |
// TODO(vadimt): Remove is_first_paint_text_ before crbug.com/431326 is |
// closed. |
bool is_first_paint_text_; |