| Index: chrome/browser/ui/views/tabs/base_tab.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/tabs/base_tab.cc (revision 75998)
|
| +++ chrome/browser/ui/views/tabs/base_tab.cc (working copy)
|
| @@ -434,6 +434,7 @@
|
|
|
| void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) {
|
| // Paint the Title.
|
| + const gfx::Rect& title_bounds = GetTitleBounds();
|
| string16 title = data().title;
|
| if (title.empty()) {
|
| title = data().loading ?
|
| @@ -441,8 +442,15 @@
|
| TabContentsWrapper::GetDefaultTitle();
|
| } else {
|
| Browser::FormatTitleForDisplay(&title);
|
| + // 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.
|
| + 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, ASCIIToUTF16("..."));
|
| + }
|
| }
|
| - const gfx::Rect& title_bounds = GetTitleBounds();
|
| canvas->DrawStringInt(title, *font_, title_color,
|
| title_bounds.x(), title_bounds.y(),
|
| title_bounds.width(), title_bounds.height());
|
|
|