Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 103293004: No touch handles when Views textfield cannot get focused (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/native_textfield_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index c4cae0e228127bcf44b62eaf022a768526217d56..9e978f9c9b83e7e3e05c566b0f0090beb16ed403 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -206,31 +206,31 @@ void NativeTextfieldViews::OnGestureEvent(ui::GestureEvent* event) {
if (!GetRenderText()->IsPointInSelection(event->location())) {
OnBeforeUserAction();
model_->SelectWord();
- touch_selection_controller_.reset(
- ui::TouchSelectionController::create(this));
OnCaretBoundsChanged();
SchedulePaint();
OnAfterUserAction();
- if (touch_selection_controller_.get())
+ if (!touch_selection_controller_)
+ CreateTouchSelectionControllerAndNotifyIt();
+ if (touch_selection_controller_)
event->SetHandled();
} else if (switches::IsTouchDragDropEnabled()) {
initiating_drag_ = true;
touch_selection_controller_.reset();
} else {
- if (!touch_selection_controller_.get())
+ if (!touch_selection_controller_)
CreateTouchSelectionControllerAndNotifyIt();
- if (touch_selection_controller_.get())
+ if (touch_selection_controller_)
event->SetHandled();
}
return;
case ui::ET_GESTURE_LONG_TAP:
- if (!touch_selection_controller_.get())
+ if (!touch_selection_controller_)
CreateTouchSelectionControllerAndNotifyIt();
// If touch selection is enabled, the context menu on long tap will be
// shown by the |touch_selection_controller_|, hence we mark the event
// handled so views does not try to show context menu on it.
- if (touch_selection_controller_.get())
+ if (touch_selection_controller_)
event->SetHandled();
break;
default:
@@ -1393,7 +1393,7 @@ void NativeTextfieldViews::OnCaretBoundsChanged() {
textfield_->GetInputMethod()->OnCaretBoundsChanged(textfield_);
// Notify selection controller
- if (touch_selection_controller_.get())
+ if (touch_selection_controller_)
touch_selection_controller_->SelectionChanged();
}
@@ -1519,6 +1519,9 @@ bool NativeTextfieldViews::ShouldInsertChar(char16 ch, int flags) {
}
void NativeTextfieldViews::CreateTouchSelectionControllerAndNotifyIt() {
+ if (!textfield_->IsFocusable() || !textfield_->HasFocus())
sky 2013/12/04 03:56:06 Why do you need to check IsFocusable? Don't you on
mohsen 2013/12/04 05:22:22 The textfield might have focus before getting disa
+ return;
+
if (!touch_selection_controller_) {
touch_selection_controller_.reset(
ui::TouchSelectionController::create(this));
« no previous file with comments | « no previous file | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698