summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordxie@chromium.org <dxie@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-19 07:13:06 +0000
committerdxie@chromium.org <dxie@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-19 07:13:06 +0000
commit3ed8e3a6ecfe6a63b824002e8a826df154e4d203 (patch)
tree248883bb428b88b9b907059cb0b163b1af6a2519
parent4a27768933b356adf5289b63a0174fcaaf156759 (diff)
downloadchromium_src-3ed8e3a6ecfe6a63b824002e8a826df154e4d203.zip
chromium_src-3ed8e3a6ecfe6a63b824002e8a826df154e4d203.tar.gz
chromium_src-3ed8e3a6ecfe6a63b824002e8a826df154e4d203.tar.bz2
Revert 245610 "Consistent fading behavior for touch editing handles"
> Consistent fading behavior for touch editing handles > > The general rule is that touch editing handles should fade out when they > are dismissed, unless handles and text are moving relative to each > other. So, handles fade out except in following cases, in which they > disappear almost immediately (i.e. they fade out super quickly): > - When handle is dragged out of content view. In this case it should > actually scroll the contents, but that's a separate issue (see > crbug.com/269003); > - When starting touch scrolling or gesture navigation. > > BUG=313561 > > Review URL: https://codereview.chromium.org/138033014 TBR=mohsen@chromium.org Review URL: https://codereview.chromium.org/142543002 git-svn-id: svn://svn.chromium.org/chrome/branches/1794/src@245823 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h5
-rw-r--r--content/browser/web_contents/touch_editable_impl_aura.cc20
-rw-r--r--content/browser/web_contents/touch_editable_impl_aura.h2
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc4
-rw-r--r--ui/base/touch/touch_editing_controller.h4
-rw-r--r--ui/views/touchui/touch_selection_controller_impl.cc33
-rw-r--r--ui/views/touchui/touch_selection_controller_impl.h1
8 files changed, 23 insertions, 50 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 27f54ec..67d8f98 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2548,7 +2548,7 @@ bool RenderWidgetHostViewAura::CanFocus() {
void RenderWidgetHostViewAura::OnCaptureLost() {
host_->LostCapture();
if (touch_editing_client_)
- touch_editing_client_->EndTouchEditing(false);
+ touch_editing_client_->EndTouchEditing();
}
void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
@@ -3063,7 +3063,7 @@ void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus,
host_->SetInputMethodActive(false);
if (touch_editing_client_)
- touch_editing_client_->EndTouchEditing(false);
+ touch_editing_client_->EndTouchEditing();
// If we lose the focus while fullscreen, close the window; Pepper Flash
// won't do it for us (unlike NPAPI Flash). However, we do not close the
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 9e11115..37f5f4e 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -120,9 +120,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Tells the client to start showing touch editing handles.
virtual void StartTouchEditing() = 0;
- // Notifies the client that touch editing is no longer needed. |quick|
- // determines whether the handles should fade out quickly or slowly.
- virtual void EndTouchEditing(bool quick) = 0;
+ // Notifies the client that touch editing is no longer needed.
+ virtual void EndTouchEditing() = 0;
// Notifies the client that the selection bounds need to be updated.
virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
diff --git a/content/browser/web_contents/touch_editable_impl_aura.cc b/content/browser/web_contents/touch_editable_impl_aura.cc
index 00c69ce..a9569df 100644
--- a/content/browser/web_contents/touch_editable_impl_aura.cc
+++ b/content/browser/web_contents/touch_editable_impl_aura.cc
@@ -62,7 +62,7 @@ void TouchEditableImplAura::UpdateEditingController() {
if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
} else {
- EndTouchEditing(false);
+ EndTouchEditing();
}
}
@@ -105,14 +105,12 @@ void TouchEditableImplAura::StartTouchEditing() {
touch_selection_controller_->SelectionChanged();
}
-void TouchEditableImplAura::EndTouchEditing(bool quick) {
+void TouchEditableImplAura::EndTouchEditing() {
if (touch_selection_controller_) {
- if (touch_selection_controller_->IsHandleDragInProgress()) {
+ if (touch_selection_controller_->IsHandleDragInProgress())
touch_selection_controller_->SelectionChanged();
- } else {
- touch_selection_controller_->HideHandles(quick);
+ else
touch_selection_controller_.reset();
- }
}
}
@@ -133,7 +131,7 @@ bool TouchEditableImplAura::HandleInputEvent(const ui::Event* event) {
return false;
if (!event->IsGestureEvent()) {
- EndTouchEditing(false);
+ EndTouchEditing();
return false;
}
@@ -177,7 +175,7 @@ bool TouchEditableImplAura::HandleInputEvent(const ui::Event* event) {
handles_hidden_due_to_scroll_ = false;
if (touch_selection_controller_)
handles_hidden_due_to_scroll_ = true;
- EndTouchEditing(true);
+ EndTouchEditing();
break;
case ui::ET_GESTURE_SCROLL_END:
// Scroll has ended, but we might still be in overscroll animation.
@@ -289,7 +287,7 @@ void TouchEditableImplAura::OpenContextMenu(const gfx::Point& anchor) {
ConvertPointFromScreen(&point);
RenderWidgetHost* host = rwhva_->GetRenderWidgetHost();
host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), point));
- EndTouchEditing(false);
+ EndTouchEditing();
}
bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const {
@@ -354,7 +352,7 @@ void TouchEditableImplAura::ExecuteCommand(int command_id, int event_flags) {
NOTREACHED();
break;
}
- EndTouchEditing(false);
+ EndTouchEditing();
}
////////////////////////////////////////////////////////////////////////////////
@@ -376,7 +374,7 @@ void TouchEditableImplAura::Cleanup() {
rwhva_ = NULL;
}
text_input_type_ = ui::TEXT_INPUT_TYPE_NONE;
- EndTouchEditing(true);
+ touch_selection_controller_.reset();
handles_hidden_due_to_scroll_ = false;
scroll_in_progress_ = false;
overscroll_in_progress_ = false;
diff --git a/content/browser/web_contents/touch_editable_impl_aura.h b/content/browser/web_contents/touch_editable_impl_aura.h
index 8190b7c..2758702 100644
--- a/content/browser/web_contents/touch_editable_impl_aura.h
+++ b/content/browser/web_contents/touch_editable_impl_aura.h
@@ -43,7 +43,7 @@ class CONTENT_EXPORT TouchEditableImplAura
// Overridden from RenderWidgetHostViewAura::TouchEditingClient.
virtual void StartTouchEditing() OVERRIDE;
- virtual void EndTouchEditing(bool quick) OVERRIDE;
+ virtual void EndTouchEditing() OVERRIDE;
virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
const gfx::Rect& focus) OVERRIDE;
virtual void OnTextInputTypeChanged(ui::TextInputType type) OVERRIDE;
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 1c12260..09fdb7dc 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -1405,7 +1405,7 @@ void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) {
void WebContentsViewAura::ShowContextMenu(const ContextMenuParams& params) {
if (touch_editable_)
- touch_editable_->EndTouchEditing(false);
+ touch_editable_->EndTouchEditing();
if (delegate_) {
delegate_->ShowContextMenu(params);
// WARNING: we may have been deleted during the call to ShowContextMenu().
@@ -1436,7 +1436,7 @@ void WebContentsViewAura::StartDragging(
}
if (touch_editable_)
- touch_editable_->EndTouchEditing(false);
+ touch_editable_->EndTouchEditing();
ui::OSExchangeData::Provider* provider = ui::OSExchangeData::CreateProvider();
PrepareDragData(drop_data, provider, web_contents_);
diff --git a/ui/base/touch/touch_editing_controller.h b/ui/base/touch/touch_editing_controller.h
index 8be9317..a48a045 100644
--- a/ui/base/touch/touch_editing_controller.h
+++ b/ui/base/touch/touch_editing_controller.h
@@ -74,10 +74,6 @@ class UI_BASE_EXPORT TouchSelectionController {
// Returns true if the user is currently dragging one of the handles.
virtual bool IsHandleDragInProgress() = 0;
-
- // Hides visible handles. According to the value of |quick|, handles might
- // fade out quickly or slowly.
- virtual void HideHandles(bool quick) = 0;
};
class UI_BASE_EXPORT TouchSelectionControllerFactory {
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc
index c87eb82..fd35332 100644
--- a/ui/views/touchui/touch_selection_controller_impl.cc
+++ b/ui/views/touchui/touch_selection_controller_impl.cc
@@ -16,7 +16,6 @@
#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"
@@ -58,8 +57,6 @@ const int kSelectionHandleVertPadding = 20;
const int kContextMenuTimoutMs = 200;
-const int kSelectionHandleQuickFadeDurationMs = 50;
-
// Creates a widget to host SelectionHandleView.
views::Widget* CreateTouchSelectionPopupWidget(
gfx::NativeView context,
@@ -157,7 +154,6 @@ class TouchSelectionControllerImpl::EditingHandleView
}
virtual ~EditingHandleView() {
- SetWidgetVisible(false, false);
}
// Overridden from views::WidgetDelegateView:
@@ -232,22 +228,13 @@ class TouchSelectionControllerImpl::EditingHandleView
return widget_->IsVisible();
}
- void SetWidgetVisible(bool visible, bool quick) {
+ void SetWidgetVisible(bool visible) {
if (widget_->IsVisible() == visible)
return;
- if (visible) {
- corewm::SetWindowShowAnimationDuration(
- widget_->GetNativeView(),
- base::TimeDelta::FromMilliseconds(
- quick ? kSelectionHandleQuickFadeDurationMs : 0));
+ if (visible)
widget_->Show();
- } else {
- corewm::SetWindowHideAnimationDuration(
- widget_->GetNativeView(),
- base::TimeDelta::FromMilliseconds(
- quick ? kSelectionHandleQuickFadeDurationMs : 0));
+ else
widget_->Hide();
- }
}
void SetSelectionRectInScreen(const gfx::Rect& rect) {
@@ -389,13 +376,13 @@ void TouchSelectionControllerImpl::SelectionChanged() {
// Check if there is any selection at all.
if (screen_pos_1 == screen_pos_2) {
- selection_handle_1_->SetWidgetVisible(false, false);
- selection_handle_2_->SetWidgetVisible(false, false);
+ selection_handle_1_->SetWidgetVisible(false);
+ selection_handle_2_->SetWidgetVisible(false);
SetHandleSelectionRect(cursor_handle_.get(), r1, screen_rect_1);
return;
}
- cursor_handle_->SetWidgetVisible(false, false);
+ cursor_handle_->SetWidgetVisible(false);
SetHandleSelectionRect(selection_handle_1_.get(), r1, screen_rect_1);
SetHandleSelectionRect(selection_handle_2_.get(), r2, screen_rect_2);
}
@@ -405,12 +392,6 @@ 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;
@@ -460,7 +441,7 @@ void TouchSelectionControllerImpl::SetHandleSelectionRect(
EditingHandleView* handle,
const gfx::Rect& rect,
const gfx::Rect& rect_in_screen) {
- handle->SetWidgetVisible(client_view_->GetBounds().Contains(rect), false);
+ handle->SetWidgetVisible(client_view_->GetBounds().Contains(rect));
if (handle->IsWidgetVisible())
handle->SetSelectionRectInScreen(rect_in_screen);
}
diff --git a/ui/views/touchui/touch_selection_controller_impl.h b/ui/views/touchui/touch_selection_controller_impl.h
index d96868d..31c9bc0 100644
--- a/ui/views/touchui/touch_selection_controller_impl.h
+++ b/ui/views/touchui/touch_selection_controller_impl.h
@@ -32,7 +32,6 @@ class VIEWS_EXPORT TouchSelectionControllerImpl
// TextSelectionController.
virtual void SelectionChanged() OVERRIDE;
virtual bool IsHandleDragInProgress() OVERRIDE;
- virtual void HideHandles(bool quick) OVERRIDE;
private:
friend class TouchSelectionControllerImplTest;