| Index: ui/views/touchui/touch_selection_controller_impl.cc
|
| diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc
|
| index 4f1aac4b1e97826a5a2d5fdc72a5e4c2bc703f25..4f39cdf3917be1cf769e3762223dc26bf21efc92 100644
|
| --- a/ui/views/touchui/touch_selection_controller_impl.cc
|
| +++ b/ui/views/touchui/touch_selection_controller_impl.cc
|
| @@ -16,6 +16,7 @@
|
| #include "ui/gfx/screen.h"
|
| #include "ui/gfx/size.h"
|
| #include "ui/views/corewm/shadow_types.h"
|
| +#include "ui/views/corewm/window_animations.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/wm/public/masked_window_targeter.h"
|
|
|
| @@ -57,6 +58,8 @@ const int kSelectionHandleVertPadding = 20;
|
|
|
| const int kContextMenuTimoutMs = 200;
|
|
|
| +const int kSelectionHandleQuickFadeDurationMs = 50;
|
| +
|
| // Creates a widget to host SelectionHandleView.
|
| views::Widget* CreateTouchSelectionPopupWidget(
|
| gfx::NativeView context,
|
| @@ -228,13 +231,22 @@ class TouchSelectionControllerImpl::EditingHandleView
|
| return widget_->IsVisible();
|
| }
|
|
|
| - void SetWidgetVisible(bool visible) {
|
| + void SetWidgetVisible(bool visible, bool quick) {
|
| if (widget_->IsVisible() == visible)
|
| return;
|
| - if (visible)
|
| + if (visible) {
|
| + corewm::SetWindowShowAnimationDuration(
|
| + widget_->GetNativeView(),
|
| + base::TimeDelta::FromMilliseconds(
|
| + quick ? kSelectionHandleQuickFadeDurationMs : 0));
|
| widget_->Show();
|
| - else
|
| + } else {
|
| + corewm::SetWindowHideAnimationDuration(
|
| + widget_->GetNativeView(),
|
| + base::TimeDelta::FromMilliseconds(
|
| + quick ? kSelectionHandleQuickFadeDurationMs : 0));
|
| widget_->Hide();
|
| + }
|
| }
|
|
|
| void SetSelectionRectInScreen(const gfx::Rect& rect) {
|
| @@ -375,13 +387,13 @@ void TouchSelectionControllerImpl::SelectionChanged() {
|
|
|
| // Check if there is any selection at all.
|
| if (screen_pos_1 == screen_pos_2) {
|
| - selection_handle_1_->SetWidgetVisible(false);
|
| - selection_handle_2_->SetWidgetVisible(false);
|
| + selection_handle_1_->SetWidgetVisible(false, false);
|
| + selection_handle_2_->SetWidgetVisible(false, false);
|
| SetHandleSelectionRect(cursor_handle_.get(), r1, screen_rect_1);
|
| return;
|
| }
|
|
|
| - cursor_handle_->SetWidgetVisible(false);
|
| + cursor_handle_->SetWidgetVisible(false, false);
|
| SetHandleSelectionRect(selection_handle_1_.get(), r1, screen_rect_1);
|
| SetHandleSelectionRect(selection_handle_2_.get(), r2, screen_rect_2);
|
| }
|
| @@ -391,6 +403,12 @@ bool TouchSelectionControllerImpl::IsHandleDragInProgress() {
|
| return !!dragging_handle_;
|
| }
|
|
|
| +void TouchSelectionControllerImpl::HideHandles(bool quick) {
|
| + selection_handle_1_->SetWidgetVisible(false, quick);
|
| + selection_handle_2_->SetWidgetVisible(false, quick);
|
| + cursor_handle_->SetWidgetVisible(false, quick);
|
| +}
|
| +
|
| void TouchSelectionControllerImpl::SetDraggingHandle(
|
| EditingHandleView* handle) {
|
| dragging_handle_ = handle;
|
| @@ -440,7 +458,7 @@ void TouchSelectionControllerImpl::SetHandleSelectionRect(
|
| EditingHandleView* handle,
|
| const gfx::Rect& rect,
|
| const gfx::Rect& rect_in_screen) {
|
| - handle->SetWidgetVisible(client_view_->GetBounds().Contains(rect));
|
| + handle->SetWidgetVisible(client_view_->GetBounds().Contains(rect), false);
|
| if (handle->IsWidgetVisible())
|
| handle->SetSelectionRectInScreen(rect_in_screen);
|
| }
|
|
|