| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (is_selection_active_) { | 176 if (is_selection_active_) { |
| 177 bool needs_animate = start_selection_handle_->Animate(frame_time); | 177 bool needs_animate = start_selection_handle_->Animate(frame_time); |
| 178 needs_animate |= end_selection_handle_->Animate(frame_time); | 178 needs_animate |= end_selection_handle_->Animate(frame_time); |
| 179 return needs_animate; | 179 return needs_animate; |
| 180 } | 180 } |
| 181 | 181 |
| 182 return false; | 182 return false; |
| 183 } | 183 } |
| 184 | 184 |
| 185 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { | 185 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { |
| 186 if (&handle == insertion_handle_.get()) | 186 if (&handle == insertion_handle_.get()) { |
| 187 client_->OnSelectionEvent(INSERTION_DRAG_STARTED, GetStartPosition()); |
| 187 return; | 188 return; |
| 189 } |
| 188 | 190 |
| 189 if (&handle == start_selection_handle_.get()) { | 191 if (&handle == start_selection_handle_.get()) { |
| 190 fixed_handle_position_ = end_selection_handle_->position() - | 192 fixed_handle_position_ = end_selection_handle_->position() - |
| 191 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); | 193 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); |
| 192 } else { | 194 } else { |
| 193 fixed_handle_position_ = start_selection_handle_->position() - | 195 fixed_handle_position_ = start_selection_handle_->position() - |
| 194 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); | 196 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); |
| 195 } | 197 } |
| 196 } | 198 } |
| 197 | 199 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 374 } |
| 373 | 375 |
| 374 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( | 376 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
| 375 bool was_active) const { | 377 bool was_active) const { |
| 376 return was_active && client_->SupportsAnimation() | 378 return was_active && client_->SupportsAnimation() |
| 377 ? TouchHandle::ANIMATION_SMOOTH | 379 ? TouchHandle::ANIMATION_SMOOTH |
| 378 : TouchHandle::ANIMATION_NONE; | 380 : TouchHandle::ANIMATION_NONE; |
| 379 } | 381 } |
| 380 | 382 |
| 381 } // namespace content | 383 } // namespace content |
| OLD | NEW |