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

Side by Side Diff: content/browser/renderer_host/input/touch_selection_controller_client_aura.cc

Issue 2124913002: Fix long press touch selection on empty text fields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: EmptyTextfield -> ClearTextfield Created 4 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/touch_selection_controller_client_ aura.h" 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_ aura.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "content/browser/renderer_host/render_widget_host_delegate.h" 8 #include "content/browser/renderer_host/render_widget_host_delegate.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 10 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 void TouchSelectionControllerClientAura::OnScrollCompleted() { 151 void TouchSelectionControllerClientAura::OnScrollCompleted() {
152 scroll_in_progress_ = false; 152 scroll_in_progress_ = false;
153 rwhva_->selection_controller()->SetTemporarilyHidden(false); 153 rwhva_->selection_controller()->SetTemporarilyHidden(false);
154 UpdateQuickMenu(); 154 UpdateQuickMenu();
155 } 155 }
156 156
157 bool TouchSelectionControllerClientAura::HandleContextMenu( 157 bool TouchSelectionControllerClientAura::HandleContextMenu(
158 const ContextMenuParams& params) { 158 const ContextMenuParams& params) {
159 if (params.source_type == ui::MENU_SOURCE_TOUCH && params.is_editable && 159 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS &&
160 params.selection_text.empty() && IsQuickMenuAvailable()) { 160 rwhva_->selection_controller()->insertion_active_or_requested() &&
161 IsQuickMenuAvailable()) {
162 DCHECK(params.is_editable);
163 DCHECK(params.selection_text.empty());
161 quick_menu_requested_ = true; 164 quick_menu_requested_ = true;
162 UpdateQuickMenu(); 165 UpdateQuickMenu();
163 return true; 166 return true;
164 } 167 }
165 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); 168 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically();
166 return false; 169 return false;
167 } 170 }
168 171
169 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const { 172 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const {
170 return ui::TouchSelectionMenuRunner::GetInstance() && 173 return ui::TouchSelectionMenuRunner::GetInstance() &&
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 ui::MENU_SOURCE_TOUCH_EDIT_MENU, 370 ui::MENU_SOURCE_TOUCH_EDIT_MENU,
368 gfx::ToRoundedPoint(anchor_point))); 371 gfx::ToRoundedPoint(anchor_point)));
369 372
370 // Hide selection handles after getting rect-between-bounds from touch 373 // Hide selection handles after getting rect-between-bounds from touch
371 // selection controller; otherwise, rect would be empty and the above 374 // selection controller; otherwise, rect would be empty and the above
372 // calculations would be invalid. 375 // calculations would be invalid.
373 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); 376 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically();
374 } 377 }
375 378
376 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698