 Chromium Code Reviews
 Chromium Code Reviews Issue 434583002:
  Prevent repeated taps from resetting insertion handle position  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 434583002:
  Prevent repeated taps from resetting insertion handle position  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 | 
| OLD | NEW |