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

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

Issue 312293002: Paste popup is positioning properly during content scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Unittest failure issues. Created 6 years, 4 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 "content/browser/renderer_host/input/touch_selection_controller.h" 5 #include "content/browser/renderer_host/input/touch_selection_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/web/WebInputEvent.h" 8 #include "third_party/WebKit/public/web/WebInputEvent.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 end_orientation_ != TOUCH_HANDLE_ORIENTATION_UNDEFINED)) { 79 end_orientation_ != TOUCH_HANDLE_ORIENTATION_UNDEFINED)) {
80 OnSelectionChanged(); 80 OnSelectionChanged();
81 return; 81 return;
82 } 82 }
83 83
84 if (start_orientation_ == TOUCH_HANDLE_CENTER && selection_editable_) { 84 if (start_orientation_ == TOUCH_HANDLE_CENTER && selection_editable_) {
85 OnInsertionChanged(); 85 OnInsertionChanged();
86 return; 86 return;
87 } 87 }
88 88
89 HideAndDisallowShowingAutomatically(); 89 if (last_input_event_type_ != LONG_PRESS)
jdduke (slow) 2014/08/02 14:23:00 Did you change this? This looks wrong, and it's co
AKVT 2014/08/04 13:45:32 Corrected the condition to show the insertion hand
90 HideAndDisallowShowingAutomatically();
90 } 91 }
91 92
92 bool TouchSelectionController::WillHandleTouchEvent( 93 bool TouchSelectionController::WillHandleTouchEvent(
93 const ui::MotionEvent& event) { 94 const ui::MotionEvent& event) {
94 if (is_insertion_active_) { 95 if (is_insertion_active_) {
95 DCHECK(insertion_handle_); 96 DCHECK(insertion_handle_);
96 return insertion_handle_->WillHandleTouchEvent(event); 97 return insertion_handle_->WillHandleTouchEvent(event);
97 } 98 }
98 99
99 if (is_selection_active_) { 100 if (is_selection_active_) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (is_selection_active_) { 177 if (is_selection_active_) {
177 bool needs_animate = start_selection_handle_->Animate(frame_time); 178 bool needs_animate = start_selection_handle_->Animate(frame_time);
178 needs_animate |= end_selection_handle_->Animate(frame_time); 179 needs_animate |= end_selection_handle_->Animate(frame_time);
179 return needs_animate; 180 return needs_animate;
180 } 181 }
181 182
182 return false; 183 return false;
183 } 184 }
184 185
185 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { 186 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) {
186 if (&handle == insertion_handle_.get()) 187 if (&handle == insertion_handle_.get()) {
188 client_->OnSelectionEvent(INSERTION_DRAG_STARTED, GetStartPosition());
187 return; 189 return;
190 }
188 191
189 if (&handle == start_selection_handle_.get()) { 192 if (&handle == start_selection_handle_.get()) {
190 fixed_handle_position_ = end_selection_handle_->position() - 193 fixed_handle_position_ = end_selection_handle_->position() -
191 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); 194 gfx::Vector2dF(0, GetEndLineHeight() / 2.f);
192 } else { 195 } else {
193 fixed_handle_position_ = start_selection_handle_->position() - 196 fixed_handle_position_ = start_selection_handle_->position() -
194 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); 197 gfx::Vector2dF(0, GetStartLineHeight() / 2.f);
195 } 198 }
196 } 199 }
197 200
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 375 }
373 376
374 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( 377 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle(
375 bool was_active) const { 378 bool was_active) const {
376 return was_active && client_->SupportsAnimation() 379 return was_active && client_->SupportsAnimation()
377 ? TouchHandle::ANIMATION_SMOOTH 380 ? TouchHandle::ANIMATION_SMOOTH
378 : TouchHandle::ANIMATION_NONE; 381 : TouchHandle::ANIMATION_NONE;
379 } 382 }
380 383
381 } // namespace content 384 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698