Commit 31628dc5 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: The animation types use the correct metrics reporters.

I dont think this fixes the bug, but its nice to have the correct
information.

Test: manual
Bug: 863304
Change-Id: I60198f34e624ef2faae9734faee17441d44d002f
Reviewed-on: https://chromium-review.googlesource.com/1182521
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584829}
parent 61e450a2
...@@ -18,7 +18,9 @@ enum OverviewAnimationType { ...@@ -18,7 +18,9 @@ enum OverviewAnimationType {
OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT, OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT,
// Used to position windows when entering/exiting overview mode and when a // Used to position windows when entering/exiting overview mode and when a
// window is closed while overview mode is active. // window is closed while overview mode is active.
OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS, OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER,
OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW,
OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT,
// Used to restore windows to their original position when exiting overview // Used to restore windows to their original position when exiting overview
// mode. // mode.
OVERVIEW_ANIMATION_RESTORE_WINDOW, OVERVIEW_ANIMATION_RESTORE_WINDOW,
......
...@@ -106,7 +106,7 @@ bool IsOverviewSwipeToCloseEnabled() { ...@@ -106,7 +106,7 @@ bool IsOverviewSwipeToCloseEnabled() {
return base::FeatureList::IsEnabled(features::kOverviewSwipeToClose); return base::FeatureList::IsEnabled(features::kOverviewSwipeToClose);
} }
void FadeOutWidgetAndMaybeSlideOnEnter(views::Widget* widget, void FadeInWidgetAndMaybeSlideOnEnter(views::Widget* widget,
OverviewAnimationType animation_type, OverviewAnimationType animation_type,
bool slide) { bool slide) {
aura::Window* window = widget->GetNativeWindow(); aura::Window* window = widget->GetNativeWindow();
......
...@@ -30,7 +30,7 @@ bool IsOverviewSwipeToCloseEnabled(); ...@@ -30,7 +30,7 @@ bool IsOverviewSwipeToCloseEnabled();
// Fades |widget| to opacity one with the enter overview settings. Additionally // Fades |widget| to opacity one with the enter overview settings. Additionally
// place |widget| closer to the top of screen and slide it down if |slide| is // place |widget| closer to the top of screen and slide it down if |slide| is
// true. // true.
void FadeOutWidgetAndMaybeSlideOnEnter(views::Widget* widget, void FadeInWidgetAndMaybeSlideOnEnter(views::Widget* widget,
OverviewAnimationType animation_type, OverviewAnimationType animation_type,
bool slide); bool slide);
......
...@@ -169,7 +169,8 @@ void OverviewWindowDragController::CompleteDrag( ...@@ -169,7 +169,8 @@ void OverviewWindowDragController::CompleteDrag(
void OverviewWindowDragController::StartSplitViewDragMode( void OverviewWindowDragController::StartSplitViewDragMode(
const gfx::Point& location_in_screen) { const gfx::Point& location_in_screen) {
item_->ScaleUpSelectedItem(OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS); item_->ScaleUpSelectedItem(
OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW);
did_move_ = true; did_move_ = true;
current_drag_behavior_ = DragBehavior::kDragToSnap; current_drag_behavior_ = DragBehavior::kDragToSnap;
......
...@@ -43,7 +43,9 @@ base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) { ...@@ -43,7 +43,9 @@ base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
return base::TimeDelta::FromMilliseconds(kFadeInMs); return base::TimeDelta::FromMilliseconds(kFadeInMs);
case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT: case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
return base::TimeDelta::FromMilliseconds(kFadeOutMs); return base::TimeDelta::FromMilliseconds(kFadeOutMs);
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT:
case OVERVIEW_ANIMATION_RESTORE_WINDOW: case OVERVIEW_ANIMATION_RESTORE_WINDOW:
case OVERVIEW_ANIMATION_RESTORE_WINDOW_ZERO: case OVERVIEW_ANIMATION_RESTORE_WINDOW_ZERO:
return base::TimeDelta::FromMilliseconds(kTransitionMs); return base::TimeDelta::FromMilliseconds(kTransitionMs);
...@@ -112,14 +114,16 @@ ui::AnimationMetricsReporter* GetMetricsReporter( ...@@ -112,14 +114,16 @@ ui::AnimationMetricsReporter* GetMetricsReporter(
OverviewAnimationType animation_type) { OverviewAnimationType animation_type) {
switch (animation_type) { switch (animation_type) {
case OVERVIEW_ANIMATION_NONE: case OVERVIEW_ANIMATION_NONE:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW:
return nullptr; return nullptr;
case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER:
case OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER: case OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER:
return g_reporter_enter.Pointer(); return g_reporter_enter.Pointer();
case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT: case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
case OVERVIEW_ANIMATION_RESTORE_WINDOW: case OVERVIEW_ANIMATION_RESTORE_WINDOW:
case OVERVIEW_ANIMATION_RESTORE_WINDOW_ZERO: case OVERVIEW_ANIMATION_RESTORE_WINDOW_ZERO:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT:
case OVERVIEW_ANIMATION_EXIT_TO_HOME_LAUNCHER: case OVERVIEW_ANIMATION_EXIT_TO_HOME_LAUNCHER:
return g_reporter_exit.Pointer(); return g_reporter_exit.Pointer();
case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM: case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
...@@ -155,7 +159,9 @@ ScopedOverviewAnimationSettings::ScopedOverviewAnimationSettings( ...@@ -155,7 +159,9 @@ ScopedOverviewAnimationSettings::ScopedOverviewAnimationSettings(
animation_settings_->SetPreemptionStrategy( animation_settings_->SetPreemptionStrategy(
ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
break; break;
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW:
case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT:
case OVERVIEW_ANIMATION_RESTORE_WINDOW: case OVERVIEW_ANIMATION_RESTORE_WINDOW:
animation_settings_->SetTweenType(gfx::Tween::EASE_OUT); animation_settings_->SetTweenType(gfx::Tween::EASE_OUT);
animation_settings_->SetPreemptionStrategy( animation_settings_->SetPreemptionStrategy(
......
...@@ -253,10 +253,12 @@ void ScopedTransformOverviewWindow::BeginScopedAnimation( ...@@ -253,10 +253,12 @@ void ScopedTransformOverviewWindow::BeginScopedAnimation(
animation_settings->push_back(std::move(settings)); animation_settings->push_back(std::move(settings));
} }
if (animation_type == OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS && const bool is_layout_animation =
animation_settings->size() > 0u) { animation_type == OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER ||
animation_type == OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW ||
animation_type == OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT;
if (is_layout_animation && animation_settings->size() > 0u)
animation_settings->front()->AddObserver(this); animation_settings->front()->AddObserver(this);
}
} }
bool ScopedTransformOverviewWindow::Contains(const aura::Window* target) const { bool ScopedTransformOverviewWindow::Contains(const aura::Window* target) const {
...@@ -590,7 +592,7 @@ void ScopedTransformOverviewWindow::CreateMirrorWindowForMinimizedState() { ...@@ -590,7 +592,7 @@ void ScopedTransformOverviewWindow::CreateMirrorWindowForMinimizedState() {
minimized_widget_->SetBounds(bounds); minimized_widget_->SetBounds(bounds);
minimized_widget_->Show(); minimized_widget_->Show();
FadeOutWidgetAndMaybeSlideOnEnter( FadeInWidgetAndMaybeSlideOnEnter(
minimized_widget_.get(), OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN, minimized_widget_.get(), OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN,
/*slide=*/false); /*slide=*/false);
} }
......
...@@ -392,6 +392,10 @@ void WindowGrid::PositionWindows( ...@@ -392,6 +392,10 @@ void WindowGrid::PositionWindows(
// Position the windows centering the left-aligned rows vertically. Do not // Position the windows centering the left-aligned rows vertically. Do not
// position |ignored_item| if it is not nullptr and matches a item in // position |ignored_item| if it is not nullptr and matches a item in
// |window_list_|. // |window_list_|.
OverviewAnimationType animation_type =
transition == WindowSelector::OverviewTransition::kEnter
? OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_ENTER
: OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_IN_OVERVIEW;
for (size_t i = 0; i < window_list_.size(); ++i) { for (size_t i = 0; i < window_list_.size(); ++i) {
WindowSelectorItem* window_item = window_list_[i].get(); WindowSelectorItem* window_item = window_list_[i].get();
if (window_item->animating_to_close() || if (window_item->animating_to_close() ||
...@@ -410,9 +414,8 @@ void WindowGrid::PositionWindows( ...@@ -410,9 +414,8 @@ void WindowGrid::PositionWindows(
if (IsNewSelectorItemWindow(window_item->GetWindow())) if (IsNewSelectorItemWindow(window_item->GetWindow()))
should_animate_item = false; should_animate_item = false;
window_item->SetBounds(rects[i], window_item->SetBounds(rects[i], should_animate_item
should_animate_item ? animation_type
? OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS
: OVERVIEW_ANIMATION_NONE); : OVERVIEW_ANIMATION_NONE);
} }
......
...@@ -545,10 +545,10 @@ void WindowSelectorItem::SlideWindowIn() { ...@@ -545,10 +545,10 @@ void WindowSelectorItem::SlideWindowIn() {
DCHECK(item_widget_); DCHECK(item_widget_);
DCHECK(transform_window_.minimized_widget()); DCHECK(transform_window_.minimized_widget());
FadeOutWidgetAndMaybeSlideOnEnter(item_widget_.get(), FadeInWidgetAndMaybeSlideOnEnter(item_widget_.get(),
OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER, OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER,
/*slide=*/true); /*slide=*/true);
FadeOutWidgetAndMaybeSlideOnEnter(transform_window_.minimized_widget(), FadeInWidgetAndMaybeSlideOnEnter(transform_window_.minimized_widget(),
OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER, OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER,
/*slide=*/true); /*slide=*/true);
} }
...@@ -628,8 +628,8 @@ void WindowSelectorItem::AnimateAndCloseWindow(bool up) { ...@@ -628,8 +628,8 @@ void WindowSelectorItem::AnimateAndCloseWindow(bool up) {
auto animate_window = [this](aura::Window* window, auto animate_window = [this](aura::Window* window,
const gfx::Transform& transform, bool observe) { const gfx::Transform& transform, bool observe) {
ScopedOverviewAnimationSettings settings(OVERVIEW_ANIMATION_RESTORE_WINDOW, ScopedOverviewAnimationSettings settings(
window); OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM, window);
gfx::Transform original_transform = window->transform(); gfx::Transform original_transform = window->transform();
original_transform.ConcatTransform(transform); original_transform.ConcatTransform(transform);
window->SetTransform(original_transform); window->SetTransform(original_transform);
...@@ -637,7 +637,7 @@ void WindowSelectorItem::AnimateAndCloseWindow(bool up) { ...@@ -637,7 +637,7 @@ void WindowSelectorItem::AnimateAndCloseWindow(bool up) {
settings.AddObserver(this); settings.AddObserver(this);
}; };
AnimateOpacity(0.0, OVERVIEW_ANIMATION_RESTORE_WINDOW); AnimateOpacity(0.0, OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM);
animate_window(item_widget_->GetNativeWindow(), transform, false); animate_window(item_widget_->GetNativeWindow(), transform, false);
animate_window(GetWindowForStacking(), transform, true); animate_window(GetWindowForStacking(), transform, true);
} }
...@@ -646,13 +646,11 @@ void WindowSelectorItem::CloseWindow() { ...@@ -646,13 +646,11 @@ void WindowSelectorItem::CloseWindow() {
gfx::Rect inset_bounds(target_bounds_); gfx::Rect inset_bounds(target_bounds_);
inset_bounds.Inset(target_bounds_.width() * kPreCloseScale, inset_bounds.Inset(target_bounds_.width() * kPreCloseScale,
target_bounds_.height() * kPreCloseScale); target_bounds_.height() * kPreCloseScale);
OverviewAnimationType animation_type =
OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM;
// Scale down both the window and label. // Scale down both the window and label.
SetBounds(inset_bounds, animation_type); SetBounds(inset_bounds, OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM);
// First animate opacity to an intermediate value concurrently with the // First animate opacity to an intermediate value concurrently with the
// scaling animation. // scaling animation.
AnimateOpacity(kClosingItemOpacity, animation_type); AnimateOpacity(kClosingItemOpacity, OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM);
// Fade out the window and the label, effectively hiding them. // Fade out the window and the label, effectively hiding them.
AnimateOpacity(0.0, OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM); AnimateOpacity(0.0, OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM);
...@@ -947,7 +945,7 @@ float WindowSelectorItem::GetOpacity() { ...@@ -947,7 +945,7 @@ float WindowSelectorItem::GetOpacity() {
OverviewAnimationType WindowSelectorItem::GetExitOverviewAnimationType() { OverviewAnimationType WindowSelectorItem::GetExitOverviewAnimationType() {
return should_animate_when_exiting_ return should_animate_when_exiting_
? OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS ? OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS_ON_EXIT
: OVERVIEW_ANIMATION_NONE; : OVERVIEW_ANIMATION_NONE;
} }
...@@ -1051,10 +1049,12 @@ void WindowSelectorItem::CreateWindowLabel(const base::string16& title) { ...@@ -1051,10 +1049,12 @@ void WindowSelectorItem::CreateWindowLabel(const base::string16& title) {
UpdateCannotSnapWarningVisibility(); UpdateCannotSnapWarningVisibility();
item_widget_->SetContentsView(caption_container_view_); item_widget_->SetContentsView(caption_container_view_);
label_view_->SetVisible(false);
item_widget_->SetOpacity(0);
item_widget_->Show(); item_widget_->Show();
item_widget_->SetOpacity(0);
item_widget_->GetLayer()->SetMasksToBounds(false); item_widget_->GetLayer()->SetMasksToBounds(false);
FadeInWidgetAndMaybeSlideOnEnter(
item_widget_.get(), OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN,
/*slide=*/false);
} }
void WindowSelectorItem::UpdateHeaderLayout( void WindowSelectorItem::UpdateHeaderLayout(
...@@ -1074,13 +1074,6 @@ void WindowSelectorItem::UpdateHeaderLayout( ...@@ -1074,13 +1074,6 @@ void WindowSelectorItem::UpdateHeaderLayout(
? -label_rect.height() ? -label_rect.height()
: 0); : 0);
if (!label_view_->visible()) {
label_view_->SetVisible(true);
FadeOutWidgetAndMaybeSlideOnEnter(
item_widget_.get(), OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN,
false);
}
aura::Window* widget_window = item_widget_->GetNativeWindow(); aura::Window* widget_window = item_widget_->GetNativeWindow();
// For the first update, place the widget at its destination. // For the first update, place the widget at its destination.
ScopedOverviewAnimationSettings animation_settings( ScopedOverviewAnimationSettings animation_settings(
......
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