Commit 97f70f30 authored by sangwoo's avatar sangwoo Committed by Commit Bot

Align immersive fullscreen animation to the compositor

Interpose views::AnimationDelegateViews using gfx::AnimationDelegateNotifier,
which helps to adapt align animation to the Compositor's frame.

There's no intended behavior change.

Bug: 824026
Change-Id: I2cb9a06e89b9627a933a83c5d44eac19a3792c28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953240Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Sang Woo Ko <sangwoo108@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722404}
parent 99c6f601
......@@ -20,8 +20,10 @@
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/animation/animation_delegate_notifier.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/animation/animation_delegate_views.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
......@@ -106,6 +108,10 @@ void ImmersiveFullscreenController::Init(
delegate_ = delegate;
top_container_ = top_container;
animation_notifier_ = std::make_unique<
gfx::AnimationDelegateNotifier<views::AnimationDelegateViews>>(
this, top_container);
animation_ = std::make_unique<gfx::SlideAnimation>(animation_notifier_.get());
widget_ = widget;
// A widget can have more than one ImmersiveFullscreenController
......@@ -300,6 +306,9 @@ void ImmersiveFullscreenController::EnableWindowObservers(bool enable) {
widget_->GetNativeWindow()->RemoveObserver(this);
widget_ = nullptr;
}
animation_.reset();
animation_notifier_.reset();
}
}
......@@ -322,7 +331,7 @@ void ImmersiveFullscreenController::EnableEventObservers(bool enable) {
env->RemoveEventObserver(this);
immersive_focus_watcher_.reset();
animation_.Stop();
animation_->Stop();
}
}
......@@ -572,11 +581,11 @@ void ImmersiveFullscreenController::MaybeStartReveal(Animate animate) {
}
// Slide in the reveal view.
if (animate == ANIMATE_NO) {
animation_.Reset(1);
animation_->Reset(1);
OnSlideOpenAnimationCompleted();
} else {
animation_.SetSlideDuration(GetAnimationDuration(animate));
animation_.Show();
animation_->SetSlideDuration(GetAnimationDuration(animate));
animation_->Show();
}
}
......@@ -607,10 +616,10 @@ void ImmersiveFullscreenController::MaybeEndReveal(Animate animate) {
reveal_state_ = SLIDING_CLOSED;
base::TimeDelta duration = GetAnimationDuration(animate);
if (duration > base::TimeDelta()) {
animation_.SetSlideDuration(duration);
animation_.Hide();
animation_->SetSlideDuration(duration);
animation_->Hide();
} else {
animation_.Reset(0);
animation_->Reset(0);
OnSlideClosedAnimationCompleted();
}
}
......
......@@ -285,8 +285,10 @@ class ASH_PUBLIC_EXPORT ImmersiveFullscreenController
// and when the user does a SWIPE_OPEN edge gesture.
std::unique_ptr<ImmersiveRevealedLock> located_event_revealed_lock_;
std::unique_ptr<gfx::AnimationDelegate> animation_notifier_;
// The animation which controls sliding the top-of-window views in and out.
gfx::SlideAnimation animation_{this};
std::unique_ptr<gfx::SlideAnimation> animation_;
// Whether the animations are disabled for testing.
bool animations_disabled_for_test_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment