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

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

Issue 434583002: Prevent repeated taps from resetting insertion handle position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 end_selection_handle_->SetVisible(GetEndVisible(), animation_style); 140 end_selection_handle_->SetVisible(GetEndVisible(), animation_style);
141 } 141 }
142 if (is_insertion_active_) 142 if (is_insertion_active_)
143 insertion_handle_->SetVisible(GetStartVisible(), animation_style); 143 insertion_handle_->SetVisible(GetStartVisible(), animation_style);
144 } 144 }
145 145
146 void TouchSelectionController::OnSelectionEditable(bool editable) { 146 void TouchSelectionController::OnSelectionEditable(bool editable) {
147 if (selection_editable_ == editable) 147 if (selection_editable_ == editable)
148 return; 148 return;
149 selection_editable_ = editable; 149 selection_editable_ = editable;
150 ResetCachedValues(); 150 if (!is_insertion_active_ && !is_selection_active_)
151 ResetCachedValues();
151 if (!selection_editable_) 152 if (!selection_editable_)
152 DeactivateInsertion(); 153 DeactivateInsertion();
153 } 154 }
154 155
155 void TouchSelectionController::OnSelectionEmpty(bool empty) { 156 void TouchSelectionController::OnSelectionEmpty(bool empty) {
156 if (selection_empty_ == empty) 157 if (selection_empty_ == empty)
157 return; 158 return;
158 selection_empty_ = empty; 159 selection_empty_ = empty;
159 ResetCachedValues(); 160 if (!is_insertion_active_ && !is_selection_active_)
jdduke (slow) 2014/07/31 12:04:45 Hmm, maybe rename to ResetCachedValuesIfInactive a
161 ResetCachedValues();
160 } 162 }
161 163
162 bool TouchSelectionController::Animate(base::TimeTicks frame_time) { 164 bool TouchSelectionController::Animate(base::TimeTicks frame_time) {
163 if (is_insertion_active_) 165 if (is_insertion_active_)
164 return insertion_handle_->Animate(frame_time); 166 return insertion_handle_->Animate(frame_time);
165 167
166 if (is_selection_active_) { 168 if (is_selection_active_) {
167 bool needs_animate = start_selection_handle_->Animate(frame_time); 169 bool needs_animate = start_selection_handle_->Animate(frame_time);
168 needs_animate |= end_selection_handle_->Animate(frame_time); 170 needs_animate |= end_selection_handle_->Animate(frame_time);
169 return needs_animate; 171 return needs_animate;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 364 }
363 365
364 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( 366 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle(
365 bool was_active) const { 367 bool was_active) const {
366 return was_active && client_->SupportsAnimation() 368 return was_active && client_->SupportsAnimation()
367 ? TouchHandle::ANIMATION_SMOOTH 369 ? TouchHandle::ANIMATION_SMOOTH
368 : TouchHandle::ANIMATION_NONE; 370 : TouchHandle::ANIMATION_NONE;
369 } 371 }
370 372
371 } // namespace content 373 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698