Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: ui/touch_selection/touch_selection_controller.cc

Issue 698253004: Reland: Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed overrides in TouchHandleDrawableAura Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/touch_selection/touch_selection_controller.cc
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc
index f5a4bda90a6d6704702a2c57a1099b78c54c544f..0f560dda907d5ae60c52b77b3870c2009527e681 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -30,10 +30,12 @@ TouchHandleOrientation ToTouchHandleOrientation(SelectionBound::Type type) {
TouchSelectionController::TouchSelectionController(
TouchSelectionControllerClient* client,
base::TimeDelta tap_timeout,
- float tap_slop)
+ float tap_slop,
+ bool show_on_tap_for_empty_editable)
: client_(client),
tap_timeout_(tap_timeout),
tap_slop_(tap_slop),
+ show_on_tap_for_empty_editable_(show_on_tap_for_empty_editable),
response_pending_input_event_(INPUT_EVENT_TYPE_NONE),
start_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED),
end_orientation_(TOUCH_HANDLE_ORIENTATION_UNDEFINED),
@@ -45,13 +47,12 @@ TouchSelectionController::TouchSelectionController(
selection_editable_(false),
temporarily_hidden_(false) {
DCHECK(client_);
- HideAndDisallowShowingAutomatically();
}
TouchSelectionController::~TouchSelectionController() {
}
-void TouchSelectionController::OnSelectionBoundsChanged(
+void TouchSelectionController::OnSelectionBoundsUpdated(
const SelectionBound& start,
const SelectionBound& end) {
if (start == start_ && end_ == end)
@@ -213,6 +214,15 @@ bool TouchSelectionController::Animate(base::TimeTicks frame_time) {
return false;
}
+void TouchSelectionController::TryActivateSelection() {
jdduke (slow) 2015/01/28 16:35:32 How exactly does this differ from |AllowShowingFro
mohsen 2015/02/22 23:23:09 Oh, I missed |AllowShowingFromCurrentSelection()|
+ if (GetStartPosition() != GetEndPosition()) {
+ SelectionBound start = start_;
+ SelectionBound end = end_;
+ ShowSelectionHandlesAutomatically();
+ OnSelectionBoundsUpdated(start, end);
+ }
+}
+
void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) {
if (&handle == insertion_handle_.get()) {
client_->OnSelectionEvent(INSERTION_DRAG_STARTED, handle.position());
@@ -251,7 +261,9 @@ void TouchSelectionController::OnHandleDragUpdate(const TouchHandle& handle,
}
void TouchSelectionController::OnHandleDragEnd(const TouchHandle& handle) {
- if (&handle != insertion_handle_.get())
+ if (&handle == insertion_handle_.get())
+ client_->OnSelectionEvent(INSERTION_DRAG_STOPPED, handle.position());
+ else
client_->OnSelectionEvent(SELECTION_DRAG_STOPPED, handle.position());
}
@@ -293,7 +305,8 @@ void TouchSelectionController::ShowSelectionHandlesAutomatically() {
void TouchSelectionController::OnInsertionChanged() {
DeactivateSelection();
- if (response_pending_input_event_ == TAP && selection_empty_) {
+ if (response_pending_input_event_ == TAP && selection_empty_ &&
+ !show_on_tap_for_empty_editable_) {
HideAndDisallowShowingAutomatically();
return;
}
@@ -316,7 +329,7 @@ void TouchSelectionController::OnInsertionChanged() {
void TouchSelectionController::OnSelectionChanged() {
DeactivateInsertion();
- if (!activate_selection_automatically_)
+ if (!activate_selection_automatically_) // XXX: needed?
return;
const bool was_active = is_selection_active_;

Powered by Google App Engine
This is Rietveld 408576698