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

Unified Diff: ui/gfx/render_text.h

Issue 354963003: Move gfx::ElideText functionality to RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exclude unreachable code by platform. Created 6 years, 6 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
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 3c87440eddd7f4da2852a61348607c0b348abc70..cb983b4dde66a92d02788ea6299bba6f13b380bf 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;
@@ -254,11 +253,12 @@ 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);
+ base::string16 layout_text() const { return layout_text_; }
Alexei Svitkine (slow) 2014/07/03 20:12:33 Return const base::string16&.
msw 2014/07/08 19:07:36 Done.
+
const Rect& display_rect() const { return display_rect_; }
void SetDisplayRect(const Rect& r);
@@ -580,9 +580,13 @@ 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 |text| as needed to fit in the |available_width| using |behavior|.
+ base::string16 Elide(const base::string16& text,
+ float available_width,
+ ElideBehavior behavior);
+
+ // 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.

Powered by Google App Engine
This is Rietveld 408576698