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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if (is_selection_active_) { | 159 if (is_selection_active_) { |
160 bool needs_animate = start_selection_handle_->Animate(frame_time); | 160 bool needs_animate = start_selection_handle_->Animate(frame_time); |
161 needs_animate |= end_selection_handle_->Animate(frame_time); | 161 needs_animate |= end_selection_handle_->Animate(frame_time); |
162 return needs_animate; | 162 return needs_animate; |
163 } | 163 } |
164 | 164 |
165 return false; | 165 return false; |
166 } | 166 } |
167 | 167 |
168 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { | 168 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { |
169 if (&handle == insertion_handle_.get()) | 169 if (&handle == insertion_handle_.get()) { |
| 170 client_->OnSelectionEvent(INSERTION_DRAG_BEGUN, GetStartPosition()); |
170 return; | 171 return; |
| 172 } |
171 | 173 |
172 if (&handle == start_selection_handle_.get()) { | 174 if (&handle == start_selection_handle_.get()) { |
173 fixed_handle_position_ = end_selection_handle_->position() - | 175 fixed_handle_position_ = end_selection_handle_->position() - |
174 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); | 176 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); |
175 } else { | 177 } else { |
176 fixed_handle_position_ = start_selection_handle_->position() - | 178 fixed_handle_position_ = start_selection_handle_->position() - |
177 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); | 179 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); |
178 } | 180 } |
179 } | 181 } |
180 | 182 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 337 } |
336 | 338 |
337 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( | 339 TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
338 bool was_active) const { | 340 bool was_active) const { |
339 return was_active && client_->SupportsAnimation() | 341 return was_active && client_->SupportsAnimation() |
340 ? TouchHandle::ANIMATION_SMOOTH | 342 ? TouchHandle::ANIMATION_SMOOTH |
341 : TouchHandle::ANIMATION_NONE; | 343 : TouchHandle::ANIMATION_NONE; |
342 } | 344 } |
343 | 345 |
344 } // namespace content | 346 } // namespace content |
OLD | NEW |