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

Unified Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 10274006: Fix a small layout glitch in Metro after the recent Ash/Desktop merge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 3675cdbd1f9851ae487848b05d28db198203998a..142e47b2a1d0428f80d6616525aa0f8ea854e4ff 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -105,7 +105,24 @@ const int GetBottomPadding() {
}
// Height of the shadow at the top of the tab image assets.
-static const int kDropShadowHeight = 4;
+const int GetDropShadowHeight() {
+ static int value = -1;
+ if (value == -1) {
+ switch (ui::GetDisplayLayout()) {
+ case ui::LAYOUT_ASH:
+ case ui::LAYOUT_DESKTOP:
+ value = 4;
+ break;
+ case ui::LAYOUT_TOUCH:
+ value = 2;
+ break;
+ default:
+ NOTREACHED();
+ }
+ }
+ return value;
+}
+
static const int kToolbarOverlap = 1;
static const int kFaviconTitleSpacing = 4;
#if defined(USE_ASH)
@@ -554,15 +571,15 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
theme_r.height() - kToolbarOverlap, false);
// Draw center. Instead of masking out the top portion we simply skip over
- // it by incrementing by kDropShadowHeight, since it's a simple rectangle.
- // And again, don't draw over the toolbar.
+ // it by incrementing by GetDropShadowHeight(), since it's a simple
+ // rectangle. And again, don't draw over the toolbar.
background_canvas.TileImageInt(*tab_bg,
offset + tab_image->l_width,
- bg_offset_y + kDropShadowHeight + tab_image->y_offset,
+ bg_offset_y + GetDropShadowHeight() + tab_image->y_offset,
tab_image->l_width,
- kDropShadowHeight + tab_image->y_offset,
+ GetDropShadowHeight() + tab_image->y_offset,
width() - tab_image->l_width - tab_image->r_width,
- height() - kDropShadowHeight - kToolbarOverlap - tab_image->y_offset);
+ height() - GetDropShadowHeight() - kToolbarOverlap - tab_image->y_offset);
canvas->DrawBitmapInt(background_canvas.ExtractBitmap(), 0, 0);
@@ -607,14 +624,14 @@ void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(theme_r, width() - tab_image->r_width, 0);
// Draw center. Instead of masking out the top portion we simply skip over it
- // by incrementing by kDropShadowHeight, since it's a simple rectangle.
+ // by incrementing by GetDropShadowHeight(), since it's a simple rectangle.
canvas->TileImageInt(*tab_bg,
offset + tab_image->l_width,
- kDropShadowHeight + tab_image->y_offset,
+ GetDropShadowHeight() + tab_image->y_offset,
tab_image->l_width,
- kDropShadowHeight + tab_image->y_offset,
+ GetDropShadowHeight() + tab_image->y_offset,
width() - tab_image->l_width - tab_image->r_width,
- height() - kDropShadowHeight - tab_image->y_offset);
+ height() - GetDropShadowHeight() - tab_image->y_offset);
// Now draw the highlights/shadows around the tab edge.
canvas->DrawBitmapInt(*tab_image->image_l, 0, 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698