summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/gfx/text_elider.cc8
-rw-r--r--app/gfx/text_elider_unittest.cc4
2 files changed, 9 insertions, 3 deletions
diff --git a/app/gfx/text_elider.cc b/app/gfx/text_elider.cc
index dc9b199..3d94813 100644
--- a/app/gfx/text_elider.cc
+++ b/app/gfx/text_elider.cc
@@ -301,6 +301,14 @@ std::wstring ElideText(const std::wstring& text,
return text;
int current_text_pixel_width = font.GetStringWidth(text);
+
+ // Pango will return 0 width for absurdly long strings. Cut the string in
+ // half and try again.
+ if (current_text_pixel_width <= 0 && !text.empty()) {
+ return ElideText(text.substr(0, text.length() / 2), font,
+ available_pixel_width);
+ }
+
if (current_text_pixel_width <= available_pixel_width)
return text;
diff --git a/app/gfx/text_elider_unittest.cc b/app/gfx/text_elider_unittest.cc
index fb6e7523..385d92d 100644
--- a/app/gfx/text_elider_unittest.cc
+++ b/app/gfx/text_elider_unittest.cc
@@ -186,9 +186,7 @@ TEST(TextEliderTest, TestFilenameEliding) {
}
}
-// This test is disabled.
-// See bug 15435.
-TEST(TextEliderTest, DISABLED_ElideTextLongStrings) {
+TEST(TextEliderTest, ElideTextLongStrings) {
const std::wstring kEllipsisStr(kEllipsis);
std::wstring data_scheme(L"data:text/plain,");