OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/views/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 kSelectionHandleVerticalDragOffset; | 215 kSelectionHandleVerticalDragOffset; |
216 break; | 216 break; |
217 case ui::ET_GESTURE_SCROLL_UPDATE: { | 217 case ui::ET_GESTURE_SCROLL_UPDATE: { |
218 gfx::Point drag_pos(event->location().x(), | 218 gfx::Point drag_pos(event->location().x(), |
219 event->location().y() - drag_offset_); | 219 event->location().y() - drag_offset_); |
220 controller_->SelectionHandleDragged(drag_pos); | 220 controller_->SelectionHandleDragged(drag_pos); |
221 break; | 221 break; |
222 } | 222 } |
223 case ui::ET_GESTURE_SCROLL_END: | 223 case ui::ET_GESTURE_SCROLL_END: |
224 case ui::ET_SCROLL_FLING_START: | 224 case ui::ET_SCROLL_FLING_START: |
| 225 controller_->SetDraggingHandle(NULL); |
| 226 // ReleaseCapture() is potentially destructive and should be done at |
| 227 // the very end. |
225 widget_->ReleaseCapture(); | 228 widget_->ReleaseCapture(); |
226 controller_->SetDraggingHandle(NULL); | |
227 break; | 229 break; |
228 default: | 230 default: |
229 break; | 231 break; |
230 } | 232 } |
231 } | 233 } |
232 | 234 |
233 virtual gfx::Size GetPreferredSize() const override { | 235 virtual gfx::Size GetPreferredSize() const override { |
234 gfx::Size image_size = GetHandleImageSize(); | 236 gfx::Size image_size = GetHandleImageSize(); |
235 return gfx::Size(image_size.width() + 2 * kSelectionHandleHorizPadding, | 237 return gfx::Size(image_size.width() + 2 * kSelectionHandleHorizPadding, |
236 image_size.height() + selection_rect_.height() + | 238 image_size.height() + selection_rect_.height() + |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 627 |
626 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 628 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
627 return selection_handle_2_->IsWidgetVisible(); | 629 return selection_handle_2_->IsWidgetVisible(); |
628 } | 630 } |
629 | 631 |
630 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { | 632 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { |
631 return cursor_handle_->IsWidgetVisible(); | 633 return cursor_handle_->IsWidgetVisible(); |
632 } | 634 } |
633 | 635 |
634 } // namespace views | 636 } // namespace views |
OLD | NEW |