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

Unified Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 2821011: Removes phantom tabs. (Closed)
Patch Set: Created 10 years, 6 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 | « chrome/browser/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tabs/tab_strip.cc
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index a1631fd32e096fc69baf0e445c08ffc934c8c808..7d96529a1a11d6ba0d81c6dd61643a6ed469375f 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -69,12 +69,6 @@ static const int kSuspendAnimationsTimeMs = 200;
static const int kTabHOffset = -16;
static const int kTabStripAnimationVSlop = 40;
-// Alpha value phantom tabs are rendered at.
-static const int kPhantomTabAlpha = 105;
-
-// Alpha value phantom tab icons are rendered at.
-static const int kPhantomTabIconAlpha = 160;
-
// Size of the drop indicator.
static int drop_indicator_width;
static int drop_indicator_height;
@@ -330,38 +324,6 @@ BaseTab* TabStrip::CreateTabForDragging() {
void TabStrip::PaintChildren(gfx::Canvas* canvas) {
// Tabs are painted in reverse order, so they stack to the left.
- // Phantom tabs appear behind all other tabs and are rendered first. To make
- // them slightly transparent we render them to a different layer.
- if (HasPhantomTabs()) {
- SkRect bounds;
- bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
- canvas->saveLayerAlpha(&bounds, kPhantomTabAlpha,
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
- for (int i = tab_count() - 1; i >= 0; --i) {
- Tab* tab = GetTabAtTabDataIndex(i);
- if (tab->data().phantom)
- tab->ProcessPaint(canvas);
- }
- canvas->restore();
-
- canvas->saveLayerAlpha(&bounds, kPhantomTabIconAlpha,
- SkCanvas::kARGB_ClipLayer_SaveFlag);
- canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
- for (int i = tab_count() - 1; i >= 0; --i) {
- Tab* tab = GetTabAtTabDataIndex(i);
- if (tab->data().phantom) {
- canvas->save();
- canvas->ClipRectInt(tab->MirroredX(), tab->y(), tab->width(),
- tab->height());
- canvas->TranslateInt(tab->MirroredX(), tab->y());
- tab->PaintIcon(canvas);
- canvas->restore();
- }
- }
- canvas->restore();
- }
-
Tab* selected_tab = NULL;
Tab* dragging_tab = NULL;
@@ -373,27 +335,25 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) {
// We must ask the _Tab's_ model, not ourselves, because in some situations
// the model will be different to this object, e.g. when a Tab is being
// removed after its TabContents has been destroyed.
- if (!tab->data().phantom) {
- if (tab->dragging()) {
- dragging_tab = tab;
- } else if (!tab->IsSelected()) {
- if (tab->render_unselected() && model_count > 1) {
- // See comment above kNetTabAnimationSelectedOffset as to why we do
- // this.
- Tab* last_tab = GetTabAtModelIndex(model_count - 2);
- canvas->save();
- int clip_x = last_tab->bounds().right() + kNetTabSelectedOffset;
- int clip_width = width() - clip_x;
- clip_x = MirroredXWithWidthInsideView(clip_x, clip_width);
- canvas->ClipRectInt(clip_x, 0, clip_width, height());
- tab->ProcessPaint(canvas);
- canvas->restore();
- } else {
- tab->ProcessPaint(canvas);
- }
+ if (tab->dragging()) {
+ dragging_tab = tab;
+ } else if (!tab->IsSelected()) {
+ if (tab->render_unselected() && model_count > 1) {
+ // See comment above kNetTabAnimationSelectedOffset as to why we do
+ // this.
+ Tab* last_tab = GetTabAtModelIndex(model_count - 2);
+ canvas->save();
+ int clip_x = last_tab->bounds().right() + kNetTabSelectedOffset;
+ int clip_width = width() - clip_x;
+ clip_x = MirroredXWithWidthInsideView(clip_x, clip_width);
+ canvas->ClipRectInt(clip_x, 0, clip_width, height());
+ tab->ProcessPaint(canvas);
+ canvas->restore();
} else {
- selected_tab = tab;
+ tab->ProcessPaint(canvas);
}
+ } else {
+ selected_tab = tab;
}
}
@@ -1363,11 +1323,3 @@ void TabStrip::HandleGlobalMouseMoveEvent() {
resize_layout_factory_.RevokeAll();
}
}
-
-bool TabStrip::HasPhantomTabs() const {
- for (int i = 0; i < tab_count(); ++i) {
- if (GetTabAtTabDataIndex(i)->data().phantom)
- return true;
- }
- return false;
-}
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698