| Index: chrome/browser/ui/touch/animation/screen_rotation.cc
|
| diff --git a/chrome/browser/ui/touch/animation/screen_rotation.cc b/chrome/browser/ui/touch/animation/screen_rotation.cc
|
| index 2307461e3293f2a973907440acc668b020dc64b8..81ebbcfb47abf1aafcbc402a5bd23714aa68287e 100644
|
| --- a/chrome/browser/ui/touch/animation/screen_rotation.cc
|
| +++ b/chrome/browser/ui/touch/animation/screen_rotation.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/task.h"
|
| #include "ui/base/animation/slide_animation.h"
|
| #include "ui/gfx/compositor/layer.h"
|
| +#include "ui/gfx/compositor/layer_animation_delegate.h"
|
| #include "ui/gfx/interpolated_transform.h"
|
| #include "ui/gfx/rect.h"
|
| #include "ui/gfx/transform.h"
|
| @@ -18,7 +19,6 @@
|
|
|
| namespace {
|
| const int kDefaultTransitionDurationMs = 350;
|
| -
|
| } // namespace
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -33,10 +33,12 @@ ScreenRotationListener::~ScreenRotationListener() {
|
| //
|
|
|
| ScreenRotation::ScreenRotation(views::View* view,
|
| + ui::LayerAnimationDelegate* delegate,
|
| ScreenRotationListener* listener,
|
| float old_degrees,
|
| float new_degrees)
|
| : view_(view),
|
| + delegate_(delegate),
|
| widget_(view->GetWidget()),
|
| listener_(listener),
|
| old_degrees_(old_degrees),
|
| @@ -65,15 +67,15 @@ ScreenRotation::~ScreenRotation() {
|
|
|
| void ScreenRotation::Stop() {
|
| animation_.reset();
|
| - if (view_->layer()) {
|
| + if (delegate_) {
|
| if (!interpolated_transform_.get()) {
|
| // attempt to initialize.
|
| Init();
|
| }
|
| if (interpolated_transform_.get()) {
|
| - view_->layer()->SetTransform(interpolated_transform_->Interpolate(1.0));
|
| - view_->GetWidget()->SchedulePaintInRect(
|
| - view_->GetWidget()->GetClientAreaScreenBounds());
|
| + delegate_->SetTransformFromAnimation(
|
| + interpolated_transform_->Interpolate(1.0));
|
| + delegate_->ScheduleDrawForAnimation();
|
| }
|
| }
|
| Finalize();
|
| @@ -85,9 +87,9 @@ void ScreenRotation::Stop() {
|
|
|
| void ScreenRotation::AnimationProgressed(const ui::Animation* anim) {
|
| TRACE_EVENT0("ScreenRotation", "step");
|
| - view_->layer()->SetTransform(interpolated_transform_->Interpolate(
|
| - anim->GetCurrentValue()));
|
| - widget_->SchedulePaintInRect(widget_->GetClientAreaScreenBounds());
|
| + delegate_->SetTransformFromAnimation(
|
| + interpolated_transform_->Interpolate(anim->GetCurrentValue()));
|
| + delegate_->ScheduleDrawForAnimation();
|
| }
|
|
|
| void ScreenRotation::AnimationEnded(const ui::Animation* anim) {
|
| @@ -102,8 +104,8 @@ void ScreenRotation::AnimationEnded(const ui::Animation* anim) {
|
| translation.SetTranslate(new_origin_.x() - origin.x(),
|
| new_origin_.y() - origin.y());
|
| xform.ConcatTransform(translation);
|
| - view_->layer()->SetTransform(xform);
|
| - widget_->SchedulePaintInRect(widget_->GetClientAreaScreenBounds());
|
| + delegate_->SetTransformFromAnimation(xform);
|
| + delegate_->ScheduleDrawForAnimation();
|
| animation_stopped_ = true;
|
| }
|
|
|
| @@ -124,8 +126,9 @@ void ScreenRotation::Init() {
|
|
|
| gfx::Point old_pivot;
|
| gfx::Point new_pivot;
|
| - int width = view_->layer()->bounds().width();
|
| - int height = view_->layer()->bounds().height();
|
| + const gfx::Rect bounds = delegate_->GetBoundsForAnimation();
|
| + int width = bounds.width();
|
| + int height = bounds.height();
|
|
|
| switch (degrees) {
|
| case 90:
|
|
|