diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 01:37:39 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 01:37:39 +0000 |
commit | ff78867e2099c53502786705092c77929123ae56 (patch) | |
tree | 1cd16f4dbaf38bad9c99dd55b8e143c7a6ef4c79 /chrome | |
parent | cef6492128ea70329523cbcf5d4c204660090857 (diff) | |
download | chromium_src-ff78867e2099c53502786705092c77929123ae56.zip chromium_src-ff78867e2099c53502786705092c77929123ae56.tar.gz chromium_src-ff78867e2099c53502786705092c77929123ae56.tar.bz2 |
Align custom background tab images correctly.
BUG=16879
TEST=Install a theme with a background tab image and verify that the image is aligned to the top of the tab, and not to the top of the frame.
Review URL: http://codereview.chromium.org/149727
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 47d139b..2b29341 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -598,10 +598,16 @@ void TabRenderer::PaintInactiveTabBackground(gfx::Canvas* canvas) { SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(tab_id); + // If the theme is providing a custom background image, then its top edge + // should be at the top of the tab. Otherwise, we assume that the background + // image is a composited foreground + frame image. + int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ? + 0 : background_offset_.y(); + // Draw left edge. Don't draw over the toolbar, as we're not the foreground // tab. SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, offset, background_offset_.y(), + *tab_bg, offset, bg_offset_y, tab_active.l_width, height()); SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap( tab_l, *tab_alpha.image_l); @@ -613,7 +619,7 @@ void TabRenderer::PaintInactiveTabBackground(gfx::Canvas* canvas) { // Draw right edge. Again, don't draw over the toolbar. SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap( *tab_bg, - offset + width() - tab_active.r_width, background_offset_.y(), + offset + width() - tab_active.r_width, bg_offset_y, tab_active.r_width, height()); SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap( tab_r, *tab_alpha.image_r); @@ -626,7 +632,7 @@ void TabRenderer::PaintInactiveTabBackground(gfx::Canvas* canvas) { // by incrementing by kDropShadowHeight, since it's a simple rectangle. And // again, don't draw over the toolbar. canvas->TileImageInt(*tab_bg, - offset + tab_active.l_width, background_offset_.y() + kDropShadowHeight, + offset + tab_active.l_width, bg_offset_y + kDropShadowHeight, tab_active.l_width, kDropShadowHeight, width() - tab_active.l_width - tab_active.r_width, height() - kDropShadowHeight - kToolbarOverlap); |