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

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

Issue 12218093: Do not cache the tab background if a tab background was autogenerated by a theme (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 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) {
« 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