diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 06:10:38 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 06:10:38 +0000 |
commit | 4b924a72810156ec8279c845d6d9c1246e84d7b8 (patch) | |
tree | 2e1518c3fba9d4831f2a13d23a4fb233ad19f413 /chrome | |
parent | 389366027320c1244c1eeedcc4494f8775431492 (diff) | |
download | chromium_src-4b924a72810156ec8279c845d6d9c1246e84d7b8.zip chromium_src-4b924a72810156ec8279c845d6d9c1246e84d7b8.tar.gz chromium_src-4b924a72810156ec8279c845d6d9c1246e84d7b8.tar.bz2 |
Revert 80748 - Fade tab titlesThis change fades tab titles instead of truncating them with a "...".I tried to copy the Mac implemenation from here:http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/AppKit/GTMFadeTruncatingTextFieldCell.mbut my version is not as good since I couldn't figure out how to draw text on a transparent background.BUG=69301TEST=Ran Chromium and verified that things looked ok.Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=80416Review URL: http://codereview.chromium.org/6695043
TBR=sail@chromium.org
Review URL: http://codereview.chromium.org/6815004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/views/tabs/base_tab.cc | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 2e9f222..327fd8e 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -472,9 +472,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; - int prefix_length = 0; - if (title.empty()) { title = data().loading ? l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : @@ -484,26 +481,18 @@ 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 6 average chars. - should_truncate = - data().common_prefix_length > TitlePrefixMatcher::kMinElidingLength && + if (data().common_prefix_length > TitlePrefixMatcher::kMinElidingLength && font_->GetExpectedTextWidth(6) < title_bounds.width() && - font_->GetStringWidth(title) > title_bounds.width(); - prefix_length = data().common_prefix_length - - TitlePrefixMatcher::kCommonCharsToShow; + font_->GetStringWidth(title) > title_bounds.width()) { + title.replace(0, + data().common_prefix_length - + TitlePrefixMatcher::kCommonCharsToShow, + UTF8ToUTF16(ui::kEllipsis)); + } } - -#if defined(OS_WIN) - canvas->AsCanvasSkia()->DrawFadeTruncatingString(title, - should_truncate ? gfx::CanvasSkia::TruncateFadeHeadAndTail : - gfx::CanvasSkia::TruncateFadeTail, - prefix_length, *font_, title_color, title_bounds); -#else - if (should_truncate) - title.replace(0, 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) { |