summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/tabs/base_tab.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/views/tabs/base_tab.cc')
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.cc19
1 files changed, 5 insertions, 14 deletions
diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc
index f954081..81a7262 100644
--- a/chrome/browser/ui/views/tabs/base_tab.cc
+++ b/chrome/browser/ui/views/tabs/base_tab.cc
@@ -471,7 +471,6 @@ void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) {
// Paint the Title.
const gfx::Rect& title_bounds = GetTitleBounds();
string16 title = data().title;
- bool should_truncate = false;
if (title.empty()) {
title = data().loading ?
l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) :
@@ -481,23 +480,15 @@ void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) {
// If we'll need to truncate, check if we should also truncate
// a common prefix, but only if there is enough room for it.
// We arbitrarily choose to request enough room for 10 average chars.
- should_truncate = data().common_prefix_length > 0 &&
- font_->GetExpectedTextWidth(10) < title_bounds.width() &&
- font_->GetStringWidth(title) > title_bounds.width();
+ if (data().common_prefix_length > 0 &&
+ font_->GetExpectedTextWidth(10) < title_bounds.width() &&
+ font_->GetStringWidth(title) > title_bounds.width()) {
+ title.replace(0, data().common_prefix_length, UTF8ToUTF16(ui::kEllipsis));
+ }
}
-
-#if defined(OS_WIN)
- canvas->AsCanvasSkia()->DrawFadeTruncatingString(title,
- should_truncate ? gfx::CanvasSkia::TruncateFadeHeadAndTail :
- gfx::CanvasSkia::TruncateFadeTail,
- data().common_prefix_length, *font_, title_color, title_bounds);
-#else
- if (should_truncate)
- title.replace(0, data().common_prefix_length, UTF8ToUTF16(ui::kEllipsis));
canvas->DrawStringInt(title, *font_, title_color,
title_bounds.x(), title_bounds.y(),
title_bounds.width(), title_bounds.height());
-#endif
}
void BaseTab::AnimationProgressed(const ui::Animation* animation) {