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

Unified Diff: ui/base/text/text_elider.h

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Custom length strings being printed Created 9 years, 5 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/base/text/text_elider.h
diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h
index c87011f10ce7fa9e814554b7b107bb6eb1bb2650..c3be88a4aae2737bcb886fe22042e1096f6d7021 100644
--- a/ui/base/text/text_elider.h
+++ b/ui/base/text/text_elider.h
@@ -11,6 +11,8 @@
#include "base/basictypes.h"
#include "base/string16.h"
+#include "third_party/skia/include/core/SkPaint.h"
+#include "third_party/skia/include/core/SkScalar.h"
#include "ui/gfx/font.h"
#include "ui/ui_api.h"
@@ -21,6 +23,13 @@ namespace ui {
UI_API 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
@@ -39,6 +48,13 @@ UI_API string16 ElideUrl(const GURL& url,
int available_pixel_width,
const std::string& languages);
+// Overloaded function.
dpapad 2011/07/19 20:34:01 I do not think that this comment is needed. Also c
vandebo (ex-Chrome) 2011/07/19 21:31:20 Yea, this doesn't look like a valid overload.
Aayush Kumar 2011/07/21 21:58:53 Restored changes. On 2011/07/19 21:31:20, vandebo
+// 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.
@@ -47,6 +63,13 @@ UI_API 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

Powered by Google App Engine
This is Rietveld 408576698