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 0389cc1f34affcb61a24a649411cfcb745af2910..99694ff5d8e18f33040352c679ad5fa09654d208 100644 |
--- a/chrome/browser/ui/views/tabs/tab.cc |
+++ b/chrome/browser/ui/views/tabs/tab.cc |
@@ -1154,23 +1154,33 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange( |
void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { |
int tab_id; |
+ int tab_base_id; |
views::Widget* widget = GetWidget(); |
if (widget && widget->GetTopLevelWidget()->ShouldUseNativeFrame()) { |
tab_id = IDR_THEME_TAB_BACKGROUND_V; |
+ tab_base_id = 0; |
sky
2013/02/11 21:21:55
Is 0 known to be ignored? I think I would rather h
|
} else if (data().incognito) { |
tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; |
+ tab_base_id = IDR_THEME_FRAME_INCOGNITO; |
#if defined(OS_WIN) |
} else if (win8::IsSingleWindowMetroMode()) { |
tab_id = IDR_THEME_TAB_BACKGROUND_V; |
+ tab_base_id = 0; |
#endif |
} else { |
tab_id = IDR_THEME_TAB_BACKGROUND; |
+ tab_base_id = IDR_THEME_FRAME; |
} |
// Explicitly map the id so we cache correctly. |
const chrome::HostDesktopType host_desktop_type = GetHostDesktopType(this); |
tab_id = chrome::MapThemeImage(host_desktop_type, tab_id); |
- const bool can_cache = !GetThemeProvider()->HasCustomImage(tab_id) && |
+ // Do not cache the tab background if the theme provides a custom tab |
+ // background or if a tab background was autogenerated by the theme |
+ // machinery. |
+ ui::ThemeProvider* theme_provider = GetThemeProvider(); |
+ const bool can_cache = !theme_provider->HasCustomImage(tab_id) && |
+ !theme_provider->HasCustomImage(tab_base_id) && |
!hover_controller_.ShouldDraw(); |
if (can_cache) { |