Index: ui/views/touchui/touch_selection_controller_impl.cc |
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc |
index 6f78c968b8ce49fea1b5df22d8d41d27a1a6c012..9b0477567254f5ea986ca99af9021141326cbd35 100644 |
--- a/ui/views/touchui/touch_selection_controller_impl.cc |
+++ b/ui/views/touchui/touch_selection_controller_impl.cc |
@@ -12,6 +12,7 @@ |
#include "ui/gfx/rect.h" |
#include "ui/gfx/screen.h" |
#include "ui/gfx/size.h" |
+#include "ui/views/corewm/shadow_types.h" |
#include "ui/views/widget/widget.h" |
namespace { |
@@ -37,12 +38,13 @@ struct Circle { |
// Creates a widget to host SelectionHandleView. |
views::Widget* CreateTouchSelectionPopupWidget(gfx::NativeView context) { |
views::Widget* widget = new views::Widget; |
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_TOOLTIP); |
sadrul
2013/04/12 01:34:31
Why do you need this change?
varunjain
2013/04/17 02:46:14
Removed.
|
params.can_activate = false; |
params.transparent = true; |
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
params.context = context; |
widget->Init(params); |
+ SetShadowType(widget->GetNativeView(), views::corewm::SHADOW_TYPE_NONE); |
return widget; |
} |
@@ -245,6 +247,10 @@ void TouchSelectionControllerImpl::SelectionChanged() { |
} |
} |
+bool TouchSelectionControllerImpl::IsHandleDragInProgress() { |
+ return !!dragging_handle_; |
+} |
+ |
void TouchSelectionControllerImpl::SetDraggingHandle( |
EditingHandleView* handle) { |
dragging_handle_ = handle; |
@@ -261,10 +267,12 @@ void TouchSelectionControllerImpl::SelectionHandleDragged( |
DCHECK(dragging_handle_); |
+ gfx::Point offset_drag_pos(drag_pos.x(), |
+ drag_pos.y() - dragging_handle_->cursor_height() / 2 - |
+ 2 * kSelectionHandleRadius); |
+ ConvertPointToClientView(dragging_handle_, &offset_drag_pos); |
if (dragging_handle_ == cursor_handle_.get()) { |
- gfx::Point p(drag_pos.x() + kSelectionHandleRadius, drag_pos.y()); |
- ConvertPointToClientView(dragging_handle_, &p); |
- client_view_->MoveCaretTo(p); |
+ client_view_->MoveCaretTo(offset_drag_pos); |
return; |
} |
@@ -274,16 +282,13 @@ void TouchSelectionControllerImpl::SelectionHandleDragged( |
fixed_handle = selection_handle_2_.get(); |
// Find selection end points in client_view's coordinate system. |
- gfx::Point p1(drag_pos.x() + kSelectionHandleRadius, drag_pos.y()); |
- ConvertPointToClientView(dragging_handle_, &p1); |
- |
gfx::Point p2(kSelectionHandleRadius, fixed_handle->cursor_height() / 2); |
ConvertPointToClientView(fixed_handle, &p2); |
// Instruct client_view to select the region between p1 and p2. The position |
// of |fixed_handle| is the start and that of |dragging_handle| is the end |
// of selection. |
- client_view_->SelectRect(p2, p1); |
+ client_view_->SelectRect(p2, offset_drag_pos); |
} |
void TouchSelectionControllerImpl::ConvertPointToClientView( |