From fa192fb2727ddf3bc27cdf674722f8458a83d77c Mon Sep 17 00:00:00 2001 From: "junmin.zhu@intel.com" Date: Tue, 17 Jul 2012 07:48:07 +0000 Subject: TextField should be able to copy&paste with long press gesture. BUG=135188 Test=manually Review URL: https://chromiumcodereview.appspot.com/10699036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146960 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/views/controls/textfield/native_textfield_views.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ui/views/controls') diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index 6372aaf..746d2d4 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -149,12 +149,18 @@ void NativeTextfieldViews::OnMouseReleased(const MouseEvent& event) { ui::GestureStatus NativeTextfieldViews::OnGestureEvent( const GestureEvent& event) { + ui::GestureStatus status = textfield_->OnGestureEvent(event); + if (status != ui::GESTURE_STATUS_UNKNOWN) + return status; switch (event.type()) { case ui::ET_GESTURE_TAP_DOWN: OnBeforeUserAction(); textfield_->RequestFocus(); - if (MoveCursorTo(event.location(), false)) + // We don't deselect if the point is in the selection + // because TAP_DOWN may turn into a LONG_PRESS. + if (!GetRenderText()->IsPointInSelection(event.location()) && + MoveCursorTo(event.location(), false)) SchedulePaint(); OnAfterUserAction(); return ui::GESTURE_STATUS_CONSUMED; -- cgit v1.1