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

Side by Side Diff: ui/touch_selection/touch_selection_controller.cc

Issue 829913004: WIP: Plumbing through text selection granularity control support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unified_text_selection_diff
Patch Set: Missing file. Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 const gfx::PointF& position) { 248 const gfx::PointF& position) {
249 // As the position corresponds to the bottom left point of the selection 249 // As the position corresponds to the bottom left point of the selection
250 // bound, offset it by half the corresponding line height. 250 // bound, offset it by half the corresponding line height.
251 gfx::Vector2dF line_offset = &handle == end_selection_handle_.get() 251 gfx::Vector2dF line_offset = &handle == end_selection_handle_.get()
252 ? GetStartLineOffset() 252 ? GetStartLineOffset()
253 : GetEndLineOffset(); 253 : GetEndLineOffset();
254 gfx::PointF line_position = position + line_offset; 254 gfx::PointF line_position = position + line_offset;
255 if (&handle == insertion_handle_.get()) { 255 if (&handle == insertion_handle_.get()) {
256 client_->MoveCaret(line_position); 256 client_->MoveCaret(line_position);
257 } else { 257 } else {
258 client_->MoveRangeSelectionExtent(line_position); 258 client_->MoveRangeSelectionExtent(line_position, ui::CHARACTER_GRANULARITY);
259 } 259 }
260 } 260 }
261 261
262 void TouchSelectionController::OnHandleDragEnd(const TouchHandle& handle) { 262 void TouchSelectionController::OnHandleDragEnd(const TouchHandle& handle) {
263 if (&handle != insertion_handle_.get()) 263 if (&handle != insertion_handle_.get())
264 client_->OnSelectionEvent(SELECTION_DRAG_STOPPED, handle.position()); 264 client_->OnSelectionEvent(SELECTION_DRAG_STOPPED, handle.position());
265 } 265 }
266 266
267 void TouchSelectionController::OnHandleTapped(const TouchHandle& handle) { 267 void TouchSelectionController::OnHandleTapped(const TouchHandle& handle) {
268 if (insertion_handle_ && &handle == insertion_handle_.get()) 268 if (insertion_handle_ && &handle == insertion_handle_.get())
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 434 }
435 435
436 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( 436 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle(
437 bool was_active) const { 437 bool was_active) const {
438 return was_active && client_->SupportsAnimation() 438 return was_active && client_->SupportsAnimation()
439 ? TouchHandle::ANIMATION_SMOOTH 439 ? TouchHandle::ANIMATION_SMOOTH
440 : TouchHandle::ANIMATION_NONE; 440 : TouchHandle::ANIMATION_NONE;
441 } 441 }
442 442
443 } // namespace ui 443 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller.h ('k') | ui/touch_selection/touch_selection_controller_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698