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

Unified Diff: ui/gfx/text_elider.cc

Issue 1562833002: Revert of Enable url_formatter::ElideUrl and url_formatter::ElideHost for aura Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « components/url_formatter/url_formatter.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/text_elider.cc
diff --git a/ui/gfx/text_elider.cc b/ui/gfx/text_elider.cc
index cac4fa0675be4859afb75522d2a2437990da8201..654b1aac4b699e812df5ecfb3d88c87d85bec5b8 100644
--- a/ui/gfx/text_elider.cc
+++ b/ui/gfx/text_elider.cc
@@ -39,7 +39,7 @@
namespace {
-#if defined(OS_ANDROID) && !defined(USE_AURA) || defined(OS_IOS)
+#if defined(OS_ANDROID) || defined(OS_IOS)
// The returned string will have at least one character besides the ellipsis
// on either side of '@'; if that's impossible, a single ellipsis is returned.
// If possible, only the username is elided. Otherwise, the domain is elided
@@ -194,7 +194,21 @@
const FontList& font_list,
float available_pixel_width,
ElideBehavior behavior) {
-#if defined(OS_ANDROID) && !defined(USE_AURA) || defined(OS_IOS)
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ DCHECK_NE(behavior, FADE_TAIL);
+ scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
+ render_text->SetCursorEnabled(false);
+ // Do not bother accurately sizing strings over 5000 characters here, for
+ // performance purposes. This matches the behavior of Canvas::SizeStringFloat.
+ render_text->set_truncate_length(5000);
+ render_text->SetFontList(font_list);
+ available_pixel_width = std::ceil(available_pixel_width);
+ render_text->SetDisplayRect(
+ gfx::ToEnclosingRect(gfx::RectF(gfx::SizeF(available_pixel_width, 1))));
+ render_text->SetElideBehavior(behavior);
+ render_text->SetText(text);
+ return render_text->GetDisplayText();
+#else
DCHECK_NE(behavior, FADE_TAIL);
if (text.empty() || behavior == FADE_TAIL || behavior == NO_ELIDE ||
GetStringWidthF(text, font_list) <= available_pixel_width) {
@@ -238,21 +252,6 @@
}
return cut;
-#else
- DCHECK_NE(behavior, FADE_TAIL);
- scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
- render_text->SetCursorEnabled(false);
- // TODO(bshe): 5000 is out dated. We should remove it. See crbug.com/551660.
msw 2016/01/06 18:58:11 It would have been nice to keep this updated comme
bshe 2016/01/06 19:05:30 Will upload a new patch to add the comment back.
- // Do not bother accurately sizing strings over 5000 characters here, for
- // performance purposes. This matches the behavior of Canvas::SizeStringFloat.
- render_text->set_truncate_length(5000);
- render_text->SetFontList(font_list);
- available_pixel_width = std::ceil(available_pixel_width);
- render_text->SetDisplayRect(
- gfx::ToEnclosingRect(gfx::RectF(gfx::SizeF(available_pixel_width, 1))));
- render_text->SetElideBehavior(behavior);
- render_text->SetText(text);
- return render_text->GetDisplayText();
#endif
}
« no previous file with comments | « components/url_formatter/url_formatter.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698