summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-12 18:44:00 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-12 18:44:00 +0000
commit71049e4a1656e31cad1c88d942c540ebfe03b07b (patch)
tree4ba08b81b4d29000fb4659e545b59a03fd5aea04 /ash
parentd1ec71427e8b19a37066fab4ed84e90b51487fe5 (diff)
downloadchromium_src-71049e4a1656e31cad1c88d942c540ebfe03b07b.zip
chromium_src-71049e4a1656e31cad1c88d942c540ebfe03b07b.tar.gz
chromium_src-71049e4a1656e31cad1c88d942c540ebfe03b07b.tar.bz2
Makes FramePainter not animate the header if the parent (a workspace)
is already animating. Doing so leads to lots of painting when switching workspaces and a bad frame rate for the animation. The rationale for disabling here is that if you are switching worskpaces, you're not going to notice the header animating. BUG=147350 TEST=none R=jamescook@chromium.org Review URL: https://chromiumcodereview.appspot.com/10917214 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156339 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/frame_painter.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index a63f68a..ebe0cf0 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -302,11 +302,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 =