Index: ui/base/text/text_elider.h |
diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h |
index 5dd3dc5c5250b68ad1df965fab84aba86c062505..b6cf1342124617b9087e95e2299e312fd3b1e47e 100644 |
--- a/ui/base/text/text_elider.h |
+++ b/ui/base/text/text_elider.h |
@@ -12,6 +12,8 @@ |
#include "base/basictypes.h" |
#include "base/string16.h" |
#include "ui/gfx/font.h" |
+#include "third_party/skia/include/core/SkPaint.h" |
+#include "third_party/skia/include/core/SkScalar.h" |
class FilePath; |
class GURL; |
@@ -20,6 +22,13 @@ namespace ui { |
extern const char kEllipsis[]; |
+// Specifies what type of object is passed into the Elide functions. |
+// These are used to measure the width of the text string. |
+enum ObjectType { |
+ Skia_Paint, // SkPaint object. |
+ GFX_Font // gfx::Font object. |
+}; |
+ |
// This function takes a GURL object and elides it. It returns a string |
// which composed of parts from subdomain, domain, path, filename and query. |
// A "..." is added automatically at the end if the elided string is bigger |
@@ -38,6 +47,13 @@ string16 ElideUrl(const GURL& url, |
int available_pixel_width, |
const std::string& languages); |
+// Overloaded function. |
+// Takes a SkPaint object to determine the width of the text on the screen. |
+string16 ElideUrl(const GURL& url, |
+ const SkPaint paint, |
+ SkScalar available_point_width, |
+ const std::string& languages); |
+ |
// Elides |text| to fit in |available_pixel_width|. If |elide_in_middle| is |
// set the ellipsis is placed in the middle of the string; otherwise it is |
// placed at the end. |
@@ -46,6 +62,13 @@ string16 ElideText(const string16& text, |
int available_pixel_width, |
bool elide_in_middle); |
+// Overloaded function. |
+// Takes a SkPaint object to determine the width of the text on the screen. |
+string16 ElideText(const string16& text, |
+ const SkPaint paint, |
+ SkScalar available_point_width, |
+ bool elide_in_middle); |
+ |
// Elide a filename to fit a given pixel width, with an emphasis on not hiding |
// the extension unless we have to. If filename contains a path, the path will |
// be removed if filename doesn't fit into available_pixel_width. The elided |