Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index 885df0a9b41d4999c714e945811ac433f33e54fd..dc5e93ba0c4ca9237a265f756515bc52e8c023f8 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -28,7 +28,6 @@ |
| #include "ui/gfx/shadow_value.h" |
| #include "ui/gfx/size_f.h" |
| #include "ui/gfx/text_constants.h" |
| -#include "ui/gfx/text_elider.h" |
| #include "ui/gfx/vector2d.h" |
| class SkCanvas; |
| @@ -255,9 +254,8 @@ class GFX_EXPORT RenderText { |
| // WARNING: Only use this for system limits, it lacks complex text support. |
| void set_truncate_length(size_t length) { truncate_length_ = length; } |
| - // Elides the text to fit in |display_rect| according to the specified |
| - // |elide_behavior|. |ELIDE_MIDDLE| is not supported. If a truncate length and |
| - // an elide mode are specified, the shorter of the two will be applicable. |
| + // The layout text will be elided to fit |display_rect| using this behavior. |
| + // The layout text may be shortened further by the truncate length. |
| void SetElideBehavior(ElideBehavior elide_behavior); |
| const Rect& display_rect() const { return display_rect_; } |
| @@ -422,6 +420,11 @@ class GFX_EXPORT RenderText { |
| // Rect can't have a negative width.) |
| virtual Range GetGlyphBounds(size_t index) = 0; |
| + // Elides |text| as needed to fit in the |available_width| using |behavior|. |
| + base::string16 Elide(const base::string16& text, |
|
Alexei Svitkine (slow)
2014/06/27 21:54:33
It seems more natural to me to be able to set Elid
msw
2014/06/27 23:51:49
Done; this required disambiguating a new ElideBeha
|
| + float available_width, |
| + ElideBehavior behavior); |
| + |
| protected: |
| RenderText(); |
| @@ -581,9 +584,8 @@ class GFX_EXPORT RenderText { |
| // Updates |layout_text_| if the text is obscured or truncated. |
| void UpdateLayoutText(); |
| - // Elides |text| to fit in the |display_rect_| with given |elide_behavior_|. |
| - // See ElideText in ui/gfx/text_elider.cc for reference. |
| - base::string16 ElideText(const base::string16& text); |
| + // Elides |email| as needed to fit the |available_width|. |
| + base::string16 ElideEmail(const base::string16& email, float available_width); |
| // Update the cached bounds and display offset to ensure that the current |
| // cursor is within the visible display area. |