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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (is_selection_active_) { | 166 if (is_selection_active_) { |
167 bool needs_animate = start_selection_handle_->Animate(frame_time); | 167 bool needs_animate = start_selection_handle_->Animate(frame_time); |
168 needs_animate |= end_selection_handle_->Animate(frame_time); | 168 needs_animate |= end_selection_handle_->Animate(frame_time); |
169 return needs_animate; | 169 return needs_animate; |
170 } | 170 } |
171 | 171 |
172 return false; | 172 return false; |
173 } | 173 } |
174 | 174 |
175 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { | 175 void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { |
176 if (&handle == insertion_handle_.get()) | 176 if (&handle == insertion_handle_.get()) { |
| 177 client_->OnSelectionEvent(INSERTION_DRAG_BEGUN, GetStartPosition()); |
177 return; | 178 return; |
| 179 } |
178 | 180 |
179 if (&handle == start_selection_handle_.get()) { | 181 if (&handle == start_selection_handle_.get()) { |
180 fixed_handle_position_ = end_selection_handle_->position() - | 182 fixed_handle_position_ = end_selection_handle_->position() - |
181 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); | 183 gfx::Vector2dF(0, GetEndLineHeight() / 2.f); |
182 } else { | 184 } else { |
183 fixed_handle_position_ = start_selection_handle_->position() - | 185 fixed_handle_position_ = start_selection_handle_->position() - |
184 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); | 186 gfx::Vector2dF(0, GetStartLineHeight() / 2.f); |
185 } | 187 } |
186 } | 188 } |
187 | 189 |
(...skipping 174 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 |