summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 20:17:26 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 20:17:26 +0000
commitc972de4dab685cad3a910792f9537d8ff18c973c (patch)
treeeb98bcbafe198be672a50892f4da59376bc8b330 /chrome/browser/views
parentb1095738002e4b6dad3f7a7fd82f3692051cc5fd (diff)
downloadchromium_src-c972de4dab685cad3a910792f9537d8ff18c973c.zip
chromium_src-c972de4dab685cad3a910792f9537d8ff18c973c.tar.gz
chromium_src-c972de4dab685cad3a910792f9537d8ff18c973c.tar.bz2
Makes side tabs render phantom state and close button when not
hovered. BUG=none TEST=none Review URL: http://codereview.chromium.org/2234008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48647 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/tabs/side_tab.cc25
-rw-r--r--chrome/browser/views/tabs/tab.cc3
2 files changed, 23 insertions, 5 deletions
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc
index fab7bf2..bad2b4e 100644
--- a/chrome/browser/views/tabs/side_tab.cc
+++ b/chrome/browser/views/tabs/side_tab.cc
@@ -21,12 +21,17 @@ const int kVerticalTabHeight = 27;
const int kTitleCloseSpacing = 4;
const SkScalar kRoundRectRadius = 4;
const SkColor kTabBackgroundColor = SK_ColorWHITE;
+const SkColor kTextColor = SK_ColorBLACK;
+const SkColor kPhantomTextColor = SK_ColorGRAY;
// Padding between the edge and the icon.
const int kIconLeftPadding = 5;
// Location the title starts at.
const int kTitleX = kIconLeftPadding + kFavIconSize + 5;
+
+// Alpha value phantom tab icons are rendered at.
+const int kPhantomTabIconAlpha = 100;
};
////////////////////////////////////////////////////////////////////////////////
@@ -34,6 +39,10 @@ const int kTitleX = kIconLeftPadding + kFavIconSize + 5;
SideTab::SideTab(TabController* controller)
: BaseTab(controller) {
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ close_button()->SetBackground(kTextColor,
+ rb.GetBitmapNamed(IDR_TAB_CLOSE),
+ rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK));
}
SideTab::~SideTab() {
@@ -90,10 +99,20 @@ void SideTab::Paint(gfx::Canvas* canvas) {
SkIntToScalar(kRoundRectRadius), paint);
}
- if (ShouldShowIcon())
- PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
+ if (ShouldShowIcon()) {
+ if (data().phantom) {
+ SkRect bounds;
+ bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
+ canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha,
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
+ PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
+ canvas->restore();
+ } else {
+ PaintIcon(canvas, icon_bounds_.x(), icon_bounds_.y());
+ }
+ }
- PaintTitle(canvas, SK_ColorBLACK);
+ PaintTitle(canvas, data().phantom ? kPhantomTextColor : kTextColor);
}
gfx::Size SideTab::GetPreferredSize() {
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 7c91604..90821f6 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -215,8 +215,7 @@ void Tab::Paint(gfx::Canvas* canvas) {
// See if the model changes whether the icons should be painted.
const bool show_icon = ShouldShowIcon() && !data().phantom;
const bool show_close_button = ShouldShowCloseBox();
- if (show_icon != showing_icon_ ||
- show_close_button != showing_close_button_)
+ if (show_icon != showing_icon_ || show_close_button != showing_close_button_)
Layout();
PaintTabBackground(canvas);