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

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: Removed reduntant condition check 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 InputEventType last_input_event = last_input_event_type_;
89 HideAndDisallowShowingAutomatically(); 90 HideAndDisallowShowingAutomatically();
91 // We need to show insertion handle when we do long press on edit field
92 if (last_input_event == LONG_PRESS)
93 ShowInsertionHandleAutomatically();
jdduke (slow) 2014/08/04 14:34:58 I still don't understand this logic, is this becau
AKVT 2014/08/05 14:07:40 @jdduke Here the issue is when we long press on an
jdduke (slow) 2014/08/05 16:30:43 I have a workaround here, https://codereview.chrom
AKVT 2014/08/07 12:01:22 Thanks. I have rebased the patch according to late
90 } 94 }
91 95
92 bool TouchSelectionController::WillHandleTouchEvent( 96 bool TouchSelectionController::WillHandleTouchEvent(
93 const ui::MotionEvent& event) { 97 const ui::MotionEvent& event) {
94 if (is_insertion_active_) { 98 if (is_insertion_active_) {
95 DCHECK(insertion_handle_); 99 DCHECK(insertion_handle_);
96 return insertion_handle_->WillHandleTouchEvent(event); 100 return insertion_handle_->WillHandleTouchEvent(event);
97 } 101 }
98 102
99 if (is_selection_active_) { 103 if (is_selection_active_) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (is_selection_active_) { 180 if (is_selection_active_) {
177 bool needs_animate = start_selection_handle_->Animate(frame_time); 181 bool needs_animate = start_selection_handle_->Animate(frame_time);
178 needs_animate |= end_selection_handle_->Animate(frame_time); 182 needs_animate |= end_selection_handle_->Animate(frame_time);
179 return needs_animate; 183 return needs_animate;
180 } 184 }
181 185
182 return false; 186 return false;
183 } 187 }
184 188
185 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { 189 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) {
186 if (&handle == insertion_handle_.get()) 190 if (&handle == insertion_handle_.get()) {
191 client_->OnSelectionEvent(INSERTION_DRAG_STARTED, GetStartPosition());
187 return; 192 return;
193 }
188 194
189 if (&handle == start_selection_handle_.get()) { 195 if (&handle == start_selection_handle_.get()) {
190 fixed_handle_position_ = end_selection_handle_->position() - 196 fixed_handle_position_ = end_selection_handle_->position() -
191 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); 197 gfx::Vector2dF(0, GetEndLineHeight() / 2.f);
192 } else { 198 } else {
193 fixed_handle_position_ = start_selection_handle_->position() - 199 fixed_handle_position_ = start_selection_handle_->position() -
194 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); 200 gfx::Vector2dF(0, GetStartLineHeight() / 2.f);
195 } 201 }
196 } 202 }
197 203
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 378 }
373 379
374 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( 380 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle(
375 bool was_active) const { 381 bool was_active) const {
376 return was_active && client_->SupportsAnimation() 382 return was_active && client_->SupportsAnimation()
377 ? TouchHandle::ANIMATION_SMOOTH 383 ? TouchHandle::ANIMATION_SMOOTH
378 : TouchHandle::ANIMATION_NONE; 384 : TouchHandle::ANIMATION_NONE;
379 } 385 }
380 386
381 } // namespace content 387 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698