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

Unified Diff: ui/touch_selection/touch_selection_controller.h

Issue 1087893003: Support longpress drag selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 8 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.h
diff --git a/ui/touch_selection/touch_selection_controller.h b/ui/touch_selection/touch_selection_controller.h
index 115dd0d637046b44aa49c42e832fc5e82489cc95..423c966a2396f0f52b668f360531e596a5609cae 100644
--- a/ui/touch_selection/touch_selection_controller.h
+++ b/ui/touch_selection/touch_selection_controller.h
@@ -8,6 +8,7 @@
#include "ui/base/touch/selection_bound.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect_f.h"
+#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/touch_selection/selection_event_type.h"
#include "ui/touch_selection/touch_handle.h"
#include "ui/touch_selection/touch_handle_orientation.h"
@@ -59,7 +60,7 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
// To be called before forwarding a longpress event. This allows automatically
// showing the selection or insertion handles from subsequent bounds changes.
- void OnLongPressEvent();
+ void OnLongPressEvent(const gfx::PointF& location);
// Allow showing the selection handles from the most recent selection bounds
// update (if valid), or a future valid bounds update.
@@ -123,6 +124,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
void DeactivateSelection();
void ResetCachedValuesIfInactive();
+ bool WillHandleTouchEventForLongPressDrag(const MotionEvent& event);
+ void SetTemporarilyHiddenForLongPressDrag(bool hidden);
+ void OnHandleVisibilityOverrideChanged();
+
gfx::Vector2dF GetStartLineOffset() const;
gfx::Vector2dF GetEndLineOffset() const;
bool GetStartVisible() const;
@@ -160,6 +165,18 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
bool temporarily_hidden_;
+ // Longpress drag allows direct manipulation of longpress-initiated selection.
+ // TODO(jdduke): Factor out longpress drag-specific logic into a more isolated
mfomitchev 2015/04/18 16:09:08 I wonder if we can reuse some of the TouchHandle c
jdduke (slow) 2015/04/21 19:25:57 I think this is very reasonable. I'd been planning
mfomitchev 2015/04/21 21:08:57 Do you mean StylusTextSelector?
+ // logic unit.
+ bool temporarily_hidden_for_longpress_drag_;
mfomitchev 2015/04/18 16:09:08 handles_hidden_for_longpress_drag_? Otherwise it's
jdduke (slow) 2015/04/21 19:25:57 Hmm, well this is a parallel of the existing |temp
+ bool consume_remaining_motion_for_longpress_drag_;
+ bool has_begun_longpress_drag_;
+ gfx::PointF longpress_drag_initial_position_;
+ gfx::Vector2dF longpress_drag_selection_offset_;
+
+ bool has_active_touch_sequence_;
+ gfx::PointF touch_sequence_start_position_;
+
base::TimeTicks selection_start_time_;
// Whether a selection handle was dragged during the current 'selection
// session' - i.e. since the current selection has been activated.

Powered by Google App Engine
This is Rietveld 408576698