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

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

Issue 10816027: alternate ntp: toolbar background and separator animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build break Created 8 years, 4 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
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 984b6133d793c99afed1a1af6f7fbb76cb5764a2..26b957942b63daaa8c9e711cc75ad9bbe4f29ca2 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -518,29 +518,28 @@ gfx::ImageSkia* Tab::GetTabBackgroundImage(
void Tab::PaintTabBackground(gfx::Canvas* canvas) {
if (IsActive()) {
bool fading_in = false;
- // If mode is SEARCH, we might be waiting to fade in or fading in new
- // background, in which case, the previous background needs to be painted.
- if (data().mode == chrome::search::Mode::MODE_SEARCH &&
- data().background_state &
- chrome::search::ToolbarSearchAnimator::BACKGROUND_STATE_NTP) {
- // Paint background for NTP mode.
+ // If |gradient_background_opacity| < 1f, paint flat background at full
+ // opacity, and only paint gradient background if
+ // |gradient_background_opacity| is not 0f;
+ // if |gradient_opacity| is 1f, paint the background for the current mode
+ // at full opacity.
+ if (data().gradient_background_opacity < 1.0f) {
+ // Paint flat background of NTP mode.
PaintActiveTabBackground(canvas,
GetTabBackgroundImage(chrome::search::Mode::MODE_NTP));
- // We're done if we're not showing background for |MODE_SEARCH|.
- if (!(data().background_state & chrome::search::ToolbarSearchAnimator::
- BACKGROUND_STATE_SEARCH)) {
+ // We're done if we're not showing gradient background.
+ if (data().gradient_background_opacity == 0.0f)
return;
- }
- // Otherwise, we're fading in the background for |MODE_SEARCH| at
- // |data().search_background_opacity|.
+ // Otherwise, we're fading in the gradient background at
+ // |data().gradient_background_opacity|.
fading_in = true;
canvas->SaveLayerAlpha(
- static_cast<uint8>(data().search_background_opacity * 0xFF),
+ static_cast<uint8>(data().gradient_background_opacity * 0xFF),
gfx::Rect(width(), height()));
}
// Paint the background for the current mode.
PaintActiveTabBackground(canvas, GetTabBackgroundImage(data().mode));
- // If we're fading in and have saved canvas, restore it now.
+ // If we're fading and have saved canvas, restore it now.
if (fading_in)
canvas->Restore();
} else {
« no previous file with comments | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc ('k') | chrome/browser/ui/views/tabs/tab_renderer_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698