| 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 "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 207 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
| 208 event->SetHandled(); | 208 event->SetHandled(); |
| 209 switch (event->type()) { | 209 switch (event->type()) { |
| 210 case ui::ET_GESTURE_SCROLL_BEGIN: | 210 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 211 widget_->SetCapture(this); | 211 widget_->SetCapture(this); |
| 212 controller_->SetDraggingHandle(this); | 212 controller_->SetDraggingHandle(this); |
| 213 drag_offset_ = event->y() - selection_rect_.height() + | 213 drag_offset_ = event->y() - selection_rect_.height() + |
| 214 kSelectionHandleVerticalDragOffset; | 214 kSelectionHandleVerticalDragOffset; |
| 215 break; | 215 break; |
| 216 case ui::ET_GESTURE_SCROLL_UPDATE: { | 216 case ui::ET_GESTURE_SCROLL_UPDATE: { |
| 217 gfx::Point drag_pos(event->location().x(), | 217 gfx::Point drag_pos( |
| 218 event->location().y() - drag_offset_); | 218 gfx::ToFlooredPoint(event->location()).x(), |
| 219 gfx::ToFlooredPoint(event->location()).y() - drag_offset_); |
| 219 controller_->SelectionHandleDragged(drag_pos); | 220 controller_->SelectionHandleDragged(drag_pos); |
| 220 break; | 221 break; |
| 221 } | 222 } |
| 222 case ui::ET_GESTURE_SCROLL_END: | 223 case ui::ET_GESTURE_SCROLL_END: |
| 223 case ui::ET_SCROLL_FLING_START: | 224 case ui::ET_SCROLL_FLING_START: |
| 224 widget_->ReleaseCapture(); | 225 widget_->ReleaseCapture(); |
| 225 controller_->SetDraggingHandle(NULL); | 226 controller_->SetDraggingHandle(NULL); |
| 226 break; | 227 break; |
| 227 default: | 228 default: |
| 228 break; | 229 break; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 603 |
| 603 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 604 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
| 604 return selection_handle_2_->IsWidgetVisible(); | 605 return selection_handle_2_->IsWidgetVisible(); |
| 605 } | 606 } |
| 606 | 607 |
| 607 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { | 608 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { |
| 608 return cursor_handle_->IsWidgetVisible(); | 609 return cursor_handle_->IsWidgetVisible(); |
| 609 } | 610 } |
| 610 | 611 |
| 611 } // namespace views | 612 } // namespace views |
| OLD | NEW |