Chromium Code Reviews| Index: ash/wm/frame_painter.cc |
| diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc |
| index 1bfede63597ed7b1054a4553ceb65b4b7a8b54e8..6d9bc6169a0dd740a728331aab2e17b86e9706bf 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 worskpace) is already |
|
James Cook
2012/09/12 15:49:35
worskpace -> workspace
sky
2012/09/12 16:14:23
Done.
|
| + // 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 = |