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

Unified Diff: ash/wm/frame_painter.cc

Issue 10917214: Makes FramePainter not animate the header if the parent (a workspace) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling Created 8 years, 3 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: ash/wm/frame_painter.cc
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 1bfede63597ed7b1054a4553ceb65b4b7a8b54e8..fac8f64905c56bfbef20e50fc05a1da4fe2dce38 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -299,11 +299,26 @@ void FramePainter::PaintHeader(views::NonClientFrameView* view,
const gfx::ImageSkia* theme_frame_overlay) {
if (previous_theme_frame_id_ != 0 &&
previous_theme_frame_id_ != theme_frame_id) {
- crossfade_animation_.reset(new ui::SlideAnimation(this));
- crossfade_theme_frame_id_ = previous_theme_frame_id_;
- crossfade_opacity_ = previous_opacity_;
- crossfade_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
- crossfade_animation_->Show();
+ aura::Window* parent = frame_->GetNativeWindow()->parent();
+ // Don't animate the header if the parent (a workspace) is already
+ // animating. Doing so results in continually painting during the animation
+ // and gives a slower frame rate.
+ // TODO(sky): expose a better way to determine this rather than assuming
+ // the parent is a workspace.
+ bool parent_animating = parent &&
+ (parent->layer()->GetAnimator()->IsAnimatingProperty(
+ ui::LayerAnimationElement::OPACITY) ||
+ parent->layer()->GetAnimator()->IsAnimatingProperty(
+ ui::LayerAnimationElement::VISIBILITY));
+ if (!parent_animating) {
+ crossfade_animation_.reset(new ui::SlideAnimation(this));
+ crossfade_theme_frame_id_ = previous_theme_frame_id_;
+ crossfade_opacity_ = previous_opacity_;
+ crossfade_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
+ crossfade_animation_->Show();
+ } else {
+ crossfade_animation_.reset();
+ }
}
int opacity =
« 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